private void btIncluir_Click(object sender, RoutedEventArgs e) { try { FinLancamentoReceberDTO lancamento = new FinLancamentoReceberDTO(); this.criarListas(lancamento); viewModel.FinLancamentoReceberSelected = lancamento; viewModel.IsEditar = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Alerta do sistema"); } }
public IList <FinLancamentoReceberDTO> selectFinLancamentoReceber(FinLancamentoReceberDTO FinLancamentoReceber) { try { IList <FinLancamentoReceberDTO> resultado = null; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { LancamentoReceberDAL DAL = new LancamentoReceberDAL(session); resultado = DAL.select(FinLancamentoReceber); } return(resultado); } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public FinLancamentoReceberDTO salvarAtualizarFinLancamentoReceber(FinLancamentoReceberDTO FinLancamentoReceber) { try { using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { LancamentoReceberDAL DAL = new LancamentoReceberDAL(session); DAL.saveOrUpdate(FinLancamentoReceber); session.Flush(); } return(FinLancamentoReceber); } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
private void criarListas(FinLancamentoReceberDTO lancamento) { try { if (lancamento.ListaFinParcelaReceber == null) { lancamento.ListaFinParcelaReceber = new List <FinParcelaReceberDTO>(); } if (lancamento.ListaNaturezaFinanceira == null) { lancamento.ListaNaturezaFinanceira = new List <FinLctoReceberNtFinanceiraDTO>(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Alerta do sistema"); } }
public int deleteFinLancamentoReceber(FinLancamentoReceberDTO FinLancamentoReceber) { try { int resultado = -1; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { LancamentoReceberDAL DAL = new LancamentoReceberDAL(session); DAL.delete(FinLancamentoReceber); session.Flush(); resultado = 0; } return(resultado); } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public static FinLancamentoReceberDTO GravaFinLancamentoReceber(FinLancamentoReceberDTO pFinLancamentoReceber) { try { using (ISession Session = NHibernateHelper.GetSessionFactory().OpenSession()) { NHibernateDAL <FinLancamentoReceberDTO> DAL = new NHibernateDAL <FinLancamentoReceberDTO>(Session); DAL.SaveOrUpdate(pFinLancamentoReceber); for (int i = 0; i <= pFinLancamentoReceber.ListaFinParcelaReceber.Count; i++) { NHibernateDAL <FinParcelaReceberDTO> DALDetalhe = new NHibernateDAL <FinParcelaReceberDTO>(Session); DALDetalhe.SaveOrUpdate(pFinLancamentoReceber.ListaFinParcelaReceber[i]); } Session.Flush(); } return(pFinLancamentoReceber); } catch (Exception ex) { throw new Exception(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }