private void criarListas(TributConfiguraOfGtDTO configuracao)
 {
     try
     {
         if (configuracao.ListaTributIpiDipi == null)
         {
             configuracao.ListaTributIpiDipi = new List <TributIpiDipiDTO>();
         }
         if (configuracao.ListaTributIcmsUf == null)
         {
             configuracao.ListaTributIcmsUf = new List <TributIcmsUfDTO>();
         }
         if (configuracao.ListaTributPisCodApuracao == null)
         {
             configuracao.ListaTributPisCodApuracao = new List <TributPisCodApuracaoDTO>();
         }
         if (configuracao.ListaTributCofinsCodApuracao == null)
         {
             configuracao.ListaTributCofinsCodApuracao = new List <TributCofinsCodApuracaoDTO>();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Alerta do sistema");
     }
 }
 private void btIncluir_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         TributConfiguraOfGtDTO TributConfiguraOfGt = new TributConfiguraOfGtDTO();
         this.criarListas(TributConfiguraOfGt);
         viewModel.TributConfiguraOfGtSelected = TributConfiguraOfGt;
         viewModel.IsEditar = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Alerta do sistema");
     }
 }
 public IList <TributConfiguraOfGtDTO> selectTributConfiguraOfGt(TributConfiguraOfGtDTO tributConfiguraOfGt)
 {
     try
     {
         IList <TributConfiguraOfGtDTO> resultado = null;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             ConfiguraTributacaoDAL DAL = new ConfiguraTributacaoDAL(session);
             resultado = DAL.select(tributConfiguraOfGt);
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
 public TributConfiguraOfGtDTO salvarAtualizarTributConfiguraOfGt(TributConfiguraOfGtDTO tributConfiguraOfGt)
 {
     try
     {
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             ConfiguraTributacaoDAL DAL = new ConfiguraTributacaoDAL(session);
             DAL.saveOrUpdate(tributConfiguraOfGt);
             session.Flush();
         }
         return(tributConfiguraOfGt);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
 public int deleteTributConfiguraOfGt(TributConfiguraOfGtDTO tributConfiguraOfGt)
 {
     try
     {
         int resultado = -1;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             ConfiguraTributacaoDAL DAL = new ConfiguraTributacaoDAL(session);
             DAL.delete(tributConfiguraOfGt);
             session.Flush();
             resultado = 0;
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }