private void btIncluir_Click(object sender, RoutedEventArgs e) { try { PatrimBemDTO bem = new PatrimBemDTO(); this.criarListasBem(bem); viewModel.PatrimBemSelected = bem; viewModel.IsEditar = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Alerta do sistema"); } }
private void criarListasBem(PatrimBemDTO bem) { try { if(bem.ListaPatrimDepreciacaoBem == null) bem.ListaPatrimDepreciacaoBem = new List<PatrimDepreciacaoBemDTO>(); if (bem.ListaPatrimDocumentoBem == null) bem.ListaPatrimDocumentoBem = new List<PatrimDocumentoBemDTO>(); if (bem.ListaPatrimMovimentacaoBem == null) bem.ListaPatrimMovimentacaoBem = new List<PatrimMovimentacaoBemDTO>(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Alerta do sistema"); } }
public IList <PatrimBemDTO> selectPatrimBem(PatrimBemDTO patrimBem) { try { IList <PatrimBemDTO> resultado = null; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { PatrimonioBemDAL DAL = new PatrimonioBemDAL(session); resultado = DAL.select(patrimBem); } return(resultado); } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public PatrimBemDTO salvarAtualizarPatrimBem(PatrimBemDTO patrimBem) { try { using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { PatrimonioBemDAL DAL = new PatrimonioBemDAL(session); DAL.saveOrUpdate(patrimBem); session.Flush(); } return(patrimBem); } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public int deletePatrimBem(PatrimBemDTO patrimBem) { try { int resultado = -1; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { PatrimonioBemDAL DAL = new PatrimonioBemDAL(session); DAL.delete(patrimBem); session.Flush(); resultado = 0; } return(resultado); } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public new List <PatrimBemDTO> selectPatrimBem(PatrimBemDTO dtoPesquisa) { return(base.selectPatrimBem(dtoPesquisa)); }