Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static bool jaConstaLevandoEmContaIEeCNPJ
- (List<IdentificationNumber> lista, IdentificationNumber novoItem)
- {
- switch (novoItem.IdentificationType)
- {
- case IdentificationType.Cpf:
- case IdentificationType.Cnpj:
- case IdentificationType.IE:
- break;
- default:
- throw new Exception("Tipo de identificação inválido para o envio " +
- "de comunicações eletrônicas (válidos: CPF, CNPJ ou IE)." +
- DtoConfiguracoes.envieEmailaoSuporte);
- }
- // cobre CPF e IE, CNPJ quando coincide o tipo:
- if (lista.Any(l => l.ToString(false) == novoItem.ToString(false))) return true;
- if(novoItem.IdentificationType==IdentificationType.Cnpj)
- {
- if(SvcCadastro.possuiInscricaoEstadual(novoItem))
- {
- string InscricaoEstadual = SvcCadastro.getInscricaoEstadual((Cnpj)novoItem);
- InscricaoEstadual = SvcDtec.limpaCPFCNPJIE(InscricaoEstadual);
- if (lista.Any(l => l.ToString(false) == InscricaoEstadual)) return true;
- }
- }
- if (novoItem.IdentificationType == IdentificationType.IE)
- {
- if (SvcCadastro.isPessoaJuridica((IE)novoItem))
- {
- string CNPJ = SvcCadastro.getCNPJ(novoItem);
- CNPJ = SvcDtec.limpaCPFCNPJIE(CNPJ);
- if (lista.Any(l => l.ToString(false) == CNPJ)) return true;
- }
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement