Пример #1
0
        private void SalvarXmlNaPastaDoEmitente(NotaFiscal nota, XElement xml)
        {
            try
            {
                if (!Directory.Exists("nfes"))
                    Directory.CreateDirectory("nfes");

                if (!Directory.Exists("nfes//" + nota.CnpjCpfEmitente))
                    Directory.CreateDirectory("nfes//" + nota.CnpjCpfEmitente);

                var arquivo = string.Format("nfes//{0}//{1}.xml", nota.CnpjCpfEmitente, nota.ChaveAcesso);
                nota.CaminhoXml = arquivo;
                xml.Save(arquivo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
 private void ValidarNotaFiscal(NotaFiscal nota)
 {
     if (RepositorioNota.BuscarPorChaveAcesso(nota.ChaveAcesso) != null)
         throw new ServicosException("Nota já cadastrada", 200);
 }