public virtual int Salvar(NotaFiscalEntity notaFiscalEntity, string xml)
 {
     try
     {
         if (notaFiscalEntity.Status != (int)Status.CANCELADA)
         {
             notaFiscalEntity.XmlPath = XmlFileHelper.SaveXmlFile(notaFiscalEntity, xml);
         }
         return(Salvar(notaFiscalEntity));
     }
     catch (Exception e)
     {
         log.Error(e);
         try
         {
             XmlFileHelper.DeleteXmlFile(notaFiscalEntity);
             throw;
         }
         catch (Exception ex)
         {
             log.Error(ex);
             throw new Exception("Não foi possível remover o xml de nota fiscal: " + e.Message);
         }
     }
 }
 public virtual void Salvar(NotaInutilizadaTO notaInutilizada, string xml)
 {
     try
     {
         notaInutilizada.XmlPath = XmlFileHelper.SaveXmlFile(notaInutilizada, xml);
         _notaInutilizadaRepository.Salvar((NotaInutilizadaEntity)notaInutilizada);
     }
     catch (Exception e)
     {
         log.Error(e);
         try
         {
             XmlFileHelper.DeleteXmlFile(notaInutilizada);
         }
         catch (Exception ex)
         {
             log.Error(ex);
             throw new Exception("Não foi possível remover o xml de nota fiscal: " + e.Message);
         }
     }
 }
Example #3
0
 public virtual void Salvar(EventoEntity eventoEntity)
 {
     try
     {
         eventoEntity.XmlPath = XmlFileHelper.SaveXmlFile(eventoEntity, eventoEntity.Xml);
         _eventoRepository.Salvar(eventoEntity);
     }
     catch (Exception e)
     {
         log.Error(e);
         try
         {
             XmlFileHelper.DeleteXmlFile(eventoEntity);
         }
         catch (Exception ex)
         {
             log.Error(ex);
             throw new Exception("Não foi possível remover o xml de evento: " + e.Message);
         }
     }
 }