コード例 #1
0
function libCorpUpdateEmail($updEmail, $userCredential = NULL)
{
    $xmlResult = '<result><status>%s</status><errocode>%s</errocode><response>%s</response></result>';
    try {
        Registry::factory()->setCredential($userCredential);
        $voEmail = EmailValueObject::factory()->loadData($updEmail);
        $voEmail = EmailBusiness::factory()->updateEmail($voEmail);
        return sprintf($xmlResult, 'success', '00000', $voEmail->toXml());
    } catch (\Exception $excp) {
        return sprintf($xmlResult, 'failure', $excp->getCode(), $excp->getMessage());
    }
}
コード例 #2
0
function libCorpEmailByCpf($nuCpf)
{
    try {
        $voPessoaFisica = PessoaFisicaValueObject::factory()->setNuCpf($nuCpf);
        $tmpResult = EmailBusiness::factory()->findByCpf($voPessoaFisica);
        $tmpTxt = '<result>';
        foreach ($tmpResult as $result) {
            $tmpTxt .= $result->toXml();
        }
        $tmpTxt .= '</result>';
        return $tmpTxt;
    } catch (\Exception $excp) {
        throw new IOException($excp->getMessage());
    }
}
コード例 #3
0
function libCorpEmailByPessoa($sqPessoa)
{
    try {
        $voEmail = EmailValueObject::factory()->setSqPessoa($sqPessoa);
        $tmpResult = EmailBusiness::factory()->findByParam($voEmail);
        $tmpTxt = '<result>';
        foreach ($tmpResult as $result) {
            $tmpTxt .= $result->toXml();
        }
        $tmpTxt .= '</result>';
        return $tmpTxt;
    } catch (\Exception $excp) {
        throw new IOException($excp->getMessage());
    }
}
コード例 #4
0
ファイル: EmailBusiness.php プロジェクト: sgdoc/sgdoce-codigo
 /**
  * Atualiza os dados de Email
  *
  * @example EmailBusiness::updateEmail
  * @code
  * <?php
  *     # cria filtro usado por agencia
  *     $voEmail       = ValueObjectAbstract::factory('fullnamespace');
  *     # outra forma de utilizar
  *     # $voEmail = EmailValueObject::factory();
  *     $voEmail->setSqEmail(1);
  *
  *     # efetua atualizacao
  *     $emailBusiness = EmailBusiness::factory();
  *     $emailBusiness->updateEmail($voEmail);
  * ?>
  * @endcode
  *
  * @param EmailValueObject $voEmail
  * @return EmailValueObject
  * @throws BusinessException
  */
 public function updateEmail(EmailValueObject $voEmail)
 {
     try {
         $this->_checkOnlyOneEmailByType($voEmail);
         $voEmailTmp = EmailBusiness::factory(NULL, 'libcorp')->find($voEmail->getSqEmail());
         $voEmailTmp->loadData($this->keepUpdateData($voEmail));
         $this->getModelPersist('libcorp')->update($voEmailTmp);
         return $voEmailTmp;
     } catch (ModelException $mExcp) {
         throw new BusinessException($mExcp->getMessage(), $mExcp->getCode());
     }
 }