public int deleteCargo(CargoDTO cargo) { try { int resultado = -1; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { NHibernateDAL<CargoDTO> DAL = new NHibernateDAL<CargoDTO>(session); DAL.delete(cargo); session.Flush(); resultado = 0; } return resultado; } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public CargoDTO salvarAtualizarCargo(CargoDTO cargo) { try { using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { NHibernateDAL<CargoDTO> DAL = new NHibernateDAL<CargoDTO>(session); DAL.saveOrUpdate(cargo); session.Flush(); } return cargo; } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public IList<CargoDTO> selectCargoPagina(int primeiroResultado, int quantidadeResultados, CargoDTO cargo) { try { IList<CargoDTO> resultado = null; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { NHibernateDAL<CargoDTO> DAL = new NHibernateDAL<CargoDTO>(session); resultado = DAL.selectPagina<CargoDTO>(primeiroResultado, quantidadeResultados, cargo); } return resultado; } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }
public IList<CargoDTO> selectCargo(CargoDTO cargo) { try { IList<CargoDTO> resultado = null; using (ISession session = NHibernateHelper.getSessionFactory().OpenSession()) { NHibernateDAL<CargoDTO> DAL = new NHibernateDAL<CargoDTO>(session); resultado = DAL.select(cargo); } return resultado; } catch (Exception ex) { throw new FaultException(ex.Message + (ex.InnerException != null ? " " + ex.InnerException.Message : "")); } }