public int deleteAlmoxarifado(AlmoxarifadoDTO almoxarifado) { try { int resultado = -1; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { NHibernateDAL<AlmoxarifadoDTO> DAL = new NHibernateDAL<AlmoxarifadoDTO>(session); DAL.delete(almoxarifado); session.Flush(); resultado = 0; } return resultado; } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public AlmoxarifadoDTO salvarAtualizarAlmoxarifado(AlmoxarifadoDTO almoxarifado) { try { using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { NHibernateDAL<AlmoxarifadoDTO> DAL = new NHibernateDAL<AlmoxarifadoDTO>(session); DAL.saveOrUpdate(almoxarifado); session.Flush(); } return almoxarifado; } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public IList<AlmoxarifadoDTO> selectAlmoxarifadoPagina(int primeiroResultado, int quantidadeResultados, AlmoxarifadoDTO almoxarifado) { try { IList<AlmoxarifadoDTO> resultado = null; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { NHibernateDAL<AlmoxarifadoDTO> DAL = new NHibernateDAL<AlmoxarifadoDTO>(session); resultado = DAL.selectPagina<AlmoxarifadoDTO>(primeiroResultado, quantidadeResultados, almoxarifado); } return resultado; } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }