public static IList <YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO> getListadoAccesoHogarDetalle() { IList <YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO> IAccesoHogarDetalle = new List <YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.AccesoHogar.AccesoHogarDetalleDAL.getListadoAccesoHogarDetalle(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO acceso_detalle = new YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO(); acceso_detalle.IdAccesoHogarDetalle = decimal.Parse(wobjDataRow["IdAccesoHogarDetalle"].ToString()); DTO.AccesoHogar.AccesoHogarDTO myAccesoHogarDTO = new DTO.AccesoHogar.AccesoHogarDTO(); myAccesoHogarDTO.IdAccesoHogar = decimal.Parse(wobjDataRow["idAccesoHogar"].ToString()); acceso_detalle.TheAccesoHogarDTO = myAccesoHogarDTO; acceso_detalle.Fecha = DateTime.Parse(wobjDataRow["Fecha"].ToString()); acceso_detalle.FechaVisita = !string.IsNullOrEmpty(wobjDataRow["fechaVisita"].ToString()) ? DateTime.Parse(wobjDataRow["fechaVisita"].ToString()) : DateTime.MinValue; acceso_detalle.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); acceso_detalle.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); acceso_detalle.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); acceso_detalle.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); acceso_detalle.Estado = wobjDataRow["estado"].ToString(); IAccesoHogarDetalle.Add(acceso_detalle); } } return(IAccesoHogarDetalle); }
public static bool Update(YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO myAccesoHogarDetalleDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdAccesoHogarDetalle", SqlDbType.Decimal, -1, myAccesoHogarDetalleDTO.IdAccesoHogarDetalle); wobjSQLHelper.SetParametro("@pIdAccesoHogar", SqlDbType.Decimal, -1, myAccesoHogarDetalleDTO.TheAccesoHogarDTO.IdAccesoHogar); wobjSQLHelper.SetParametro("@pFecha", SqlDbType.DateTime, -1, myAccesoHogarDetalleDTO.Fecha); wobjSQLHelper.SetParametro("@pFechaVisita", SqlDbType.DateTime, -1, myAccesoHogarDetalleDTO.FechaVisita); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myAccesoHogarDetalleDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("UPD_AccesoHogarDetalle", "YouCom")) { case 0: throw new Exception("No se pudo grabar."); case -1: throw new Exception("Hubo un error."); case -2: throw new Exception("Hubo un error."); } //==================================================================================== retorno = true; } #region Catch catch (Exception eobjException) { throw eobjException; } #endregion return(retorno); }
public static bool Delete(YouCom.DTO.AccesoHogar.AccesoHogarDetalleDTO myAccesoHogarDetalleDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdAccesoHogarDetalle", SqlDbType.Decimal, -1, myAccesoHogarDetalleDTO.IdAccesoHogarDetalle); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("DEL_AccesoHogarDetalle", "YouCom")) { case 0: throw new Exception("No se pudo grabar."); case -1: throw new Exception("Hubo un error."); case -2: throw new Exception("Hubo un error."); } //==================================================================================== retorno = true; } #region Catch catch (Exception eobjException) { throw eobjException; } #endregion return(retorno); }