private void btIncluir_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         FinLancamentoPagarDTO lancamento = new FinLancamentoPagarDTO();
         this.criarListas(lancamento);
         viewModel.FinLancamentoPagarSelected = lancamento;
         viewModel.IsEditar = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Alerta do sistema");
     }
 }
 public IList <FinLancamentoPagarDTO> selectFinLancamentoPagar(FinLancamentoPagarDTO FinLancamentoPagar)
 {
     try
     {
         IList <FinLancamentoPagarDTO> resultado = null;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             LancamentoPagarDAL DAL = new LancamentoPagarDAL(session);
             resultado = DAL.select(FinLancamentoPagar);
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
 public FinLancamentoPagarDTO salvarAtualizarFinLancamentoPagar(FinLancamentoPagarDTO FinLancamentoPagar)
 {
     try
     {
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             LancamentoPagarDAL DAL = new LancamentoPagarDAL(session);
             DAL.saveOrUpdate(FinLancamentoPagar);
             session.Flush();
         }
         return(FinLancamentoPagar);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }
 private void criarListas(FinLancamentoPagarDTO lancamento)
 {
     try
     {
         if (lancamento.ListaFinParcelaPagar == null)
         {
             lancamento.ListaFinParcelaPagar = new List <FinParcelaPagarDTO>();
         }
         if (lancamento.ListaNaturezaFinanceira == null)
         {
             lancamento.ListaNaturezaFinanceira = new List <FinLctoPagarNtFinanceiraDTO>();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Alerta do sistema");
     }
 }
 public int deleteFinLancamentoPagar(FinLancamentoPagarDTO FinLancamentoPagar)
 {
     try
     {
         int resultado = -1;
         using (ISession session = NHibernateHelper.getSessionFactory().OpenSession())
         {
             LancamentoPagarDAL DAL = new LancamentoPagarDAL(session);
             DAL.delete(FinLancamentoPagar);
             session.Flush();
             resultado = 0;
         }
         return(resultado);
     }
     catch (Exception ex)
     {
         throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : ""));
     }
 }