public static IList <YouCom.DTO.ServiciosDTO> getListadoServicios() { IList <YouCom.DTO.ServiciosDTO> IServicios = new List <YouCom.DTO.ServiciosDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.ServiciosDAL.getListadoServicios(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.ServiciosDTO servicio = new YouCom.DTO.ServiciosDTO(); servicio.IdServicio = decimal.Parse(wobjDataRow["IdServicio"].ToString()); servicio.IdRespServicio = decimal.Parse(wobjDataRow["idRespServicio"].ToString()); servicio.NombreServicio = wobjDataRow["nombreServicio"].ToString(); servicio.DescripcionServicio = wobjDataRow["descripcionServicio"].ToString(); servicio.IdCategoria = decimal.Parse(wobjDataRow["idCategoria"].ToString()); servicio.IdAdministracion = decimal.Parse(wobjDataRow["idAdministracion"].ToString()); servicio.FechaInicio = DateTime.Parse(wobjDataRow["fechaInicio"].ToString()); servicio.FechaTermino = DateTime.Parse(wobjDataRow["fechaTermino"].ToString()); servicio.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); servicio.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); servicio.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); servicio.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); servicio.Estado = wobjDataRow["estado"].ToString(); IServicios.Add(servicio); } } return(IServicios); }
public static bool ValidaEliminacionServicio(YouCom.DTO.ServiciosDTO theServiciosDTO, ref DataTable pobjDatatable) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@idServicio", SqlDbType.VarChar, 20, theServiciosDTO.IdServicio); try { //==================================================================================== if (wobjSQLHelper.Ejecutar("validaEliminacionServicio", "YouCom", pobjDatatable) <= 0) { retorno = false; } else { retorno = true; } } catch (Exception eobjException) { throw eobjException; } return(retorno); }
public static bool ActivaServicio(YouCom.DTO.ServiciosDTO theServiciosDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theServiciosDTO.UsuarioModificacion); wobjSQLHelper.SetParametro("@pIdServicio", SqlDbType.VarChar, 20, theServiciosDTO.IdServicio); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("Activa_Servicio", "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; } catch (Exception eobjException) { throw eobjException; } return(retorno); }
public static bool ValidaEliminacionServicio(YouCom.DTO.ServiciosDTO theServiciosDTO) { DataTable pobjDataTable = new DataTable(); bool retorno = false; if (YouCom.DAL.ServiciosDAL.ValidaEliminacionServicio(theServiciosDTO, ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { retorno = true; } } return(retorno); }
public static bool Insert(YouCom.DTO.ServiciosDTO myServiciosDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdRespServicio", SqlDbType.Decimal, -1, myServiciosDTO.IdRespServicio); wobjSQLHelper.SetParametro("@pNombreServicio", SqlDbType.VarChar, 200, myServiciosDTO.NombreServicio); wobjSQLHelper.SetParametro("@pDescripcionServicio", SqlDbType.Text, -1, myServiciosDTO.DescripcionServicio); wobjSQLHelper.SetParametro("@pIdCategoria", SqlDbType.Decimal, -1, myServiciosDTO.IdCategoria); wobjSQLHelper.SetParametro("@pFechaInicio", SqlDbType.DateTime, -1, myServiciosDTO.FechaInicio); wobjSQLHelper.SetParametro("@pFechaTermino", SqlDbType.DateTime, -1, myServiciosDTO.FechaTermino); wobjSQLHelper.SetParametro("@pUsuarioIngreso", SqlDbType.VarChar, 20, myServiciosDTO.UsuarioIngreso); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("INS_Servicio", "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.ServiciosDTO theServiciosDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdServicio", SqlDbType.Decimal, -1, theServiciosDTO.IdServicio); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, theServiciosDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("DEL_Servicio", "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); }