public static bool ActivaEmpresaServicio(YouCom.DTO.Servicio.EmpresaServicioDTO theEmpresaServicioDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); wobjSQLHelper.SetParametro("@pUsuarioIngreso", SqlDbType.VarChar, 50, theEmpresaServicioDTO.UsuarioModificacion); wobjSQLHelper.SetParametro("@pIdEmpresaServicio", SqlDbType.VarChar, 20, theEmpresaServicioDTO.IdEmpresaServicio); try { //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("Activa_EmpresaServicio", "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 Update(YouCom.DTO.Servicio.EmpresaServicioDTO myEmpresaServicioDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdEmpresaServicio", SqlDbType.Decimal, -1, myEmpresaServicioDTO.IdEmpresaServicio); wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheCondominioDTO.IdCondominio); wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheComunidadDTO.IdComunidad); wobjSQLHelper.SetParametro("@pIdServicio", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheServiciosDTO.IdServicio); wobjSQLHelper.SetParametro("@pIdGiro", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheGiroDTO.IdGiro); wobjSQLHelper.SetParametro("@pRazonSocialEmpresaServicio", SqlDbType.VarChar, 300, myEmpresaServicioDTO.RazonSocialEmpresaServicio); wobjSQLHelper.SetParametro("@pRutEmpresaServicio", SqlDbType.VarChar, 20, myEmpresaServicioDTO.RutEmpresaServicio); wobjSQLHelper.SetParametro("@pDireccionEmpresaServicio", SqlDbType.VarChar, 500, myEmpresaServicioDTO.DireccionEmpresaServicio); wobjSQLHelper.SetParametro("@pIdPais", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheComunaDTO.TheCiudadDTO.TheRegionDTO.ThePaisDTO.IdPais); wobjSQLHelper.SetParametro("@pIdRegion", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheComunaDTO.TheCiudadDTO.TheRegionDTO.IdRegion); wobjSQLHelper.SetParametro("@pIdCiudad", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheComunaDTO.TheCiudadDTO.IdCiudad); wobjSQLHelper.SetParametro("@pIdComuna", SqlDbType.Decimal, -1, myEmpresaServicioDTO.TheComunaDTO.IdComuna); wobjSQLHelper.SetParametro("@pTelefonoEmpresaServicio", SqlDbType.VarChar, 20, myEmpresaServicioDTO.TelefonoEmpresaServicio); wobjSQLHelper.SetParametro("@pCelularEmpresaServicio", SqlDbType.VarChar, 20, myEmpresaServicioDTO.CelularEmpresaServicio); wobjSQLHelper.SetParametro("@pEmailEmpresaServicio", SqlDbType.VarChar, 300, myEmpresaServicioDTO.EmailEmpresaServicio); wobjSQLHelper.SetParametro("@pUrlEmpresaServicio", SqlDbType.VarChar, 200, myEmpresaServicioDTO.UrlEmpresaServicio); wobjSQLHelper.SetParametro("@pLogoEmpresaServicio", SqlDbType.VarChar, 200, !string.IsNullOrEmpty(myEmpresaServicioDTO.LogoEmpresaServicio) ? myEmpresaServicioDTO.LogoEmpresaServicio : System.Data.SqlTypes.SqlString.Null); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myEmpresaServicioDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("UPD_EmpresaServicio", "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 ValidaEliminacionEmpresaServicio(YouCom.DTO.Servicio.EmpresaServicioDTO theEmpresaServicioDTO) { DataTable pobjDataTable = new DataTable(); bool retorno = false; if (YouCom.DAL.EmpresaServicioDAL.ValidaEliminacionEmpresaServicio(theEmpresaServicioDTO, ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { retorno = true; } } return(retorno); }
public static IList <YouCom.DTO.Servicio.RankingServicioDTO> getListadoRankingServicio() { IList <YouCom.DTO.Servicio.RankingServicioDTO> IRankingServicio = new List <YouCom.DTO.Servicio.RankingServicioDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.RankingServicioDAL.getListadoRankingServicio(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.Servicio.RankingServicioDTO ranking = new YouCom.DTO.Servicio.RankingServicioDTO(); ranking.IdRanking = decimal.Parse(wobjDataRow["IdRanking"].ToString()); YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominioDTO.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); ranking.TheCondominioDTO = myCondominioDTO; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString()); ranking.TheComunidadDTO = myComunidadDTO; YouCom.DTO.Servicio.EmpresaServicioDTO myEmpresaServicioDTO = new YouCom.DTO.Servicio.EmpresaServicioDTO(); myEmpresaServicioDTO.IdEmpresaServicio = decimal.Parse(wobjDataRow["idEmpresaServicio"].ToString()); ranking.TheEmpresaServicioDTO = myEmpresaServicioDTO; YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO(); myFamiliaDTO.IdFamilia = decimal.Parse(wobjDataRow["idFamilia"].ToString()); ranking.TheFamiliaDTO = myFamiliaDTO; ranking.Comentario = wobjDataRow["comentario"].ToString(); ranking.Nota = int.Parse(wobjDataRow["nota"].ToString()); ranking.FechaRanking = Convert.ToDateTime(wobjDataRow["fechaRanking"].ToString()); ranking.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); ranking.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); ranking.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); ranking.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); ranking.Estado = wobjDataRow["estado"].ToString(); IRankingServicio.Add(ranking); } } return(IRankingServicio); }
public static bool Delete(YouCom.DTO.Servicio.EmpresaServicioDTO myEmpresaServicioDTO) { bool retorno = false; YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper(); try { //Seteo Parámetros. //==================================================================================== wobjSQLHelper.SetParametro("@pIdEmpresaServicio", SqlDbType.Decimal, -1, myEmpresaServicioDTO.IdEmpresaServicio); wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myEmpresaServicioDTO.UsuarioModificacion); //==================================================================================== //Ejecuto SP. //==================================================================================== switch (wobjSQLHelper.EjecutarNQ("DEL_EmpresaServicio", "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 IList <YouCom.DTO.Servicio.EmpresaServicioDTO> getListadoEmpresaServicio() { IList <YouCom.DTO.Servicio.EmpresaServicioDTO> IEmpresaServicio = new List <YouCom.DTO.Servicio.EmpresaServicioDTO>(); DataTable pobjDataTable = new DataTable(); if (YouCom.DAL.EmpresaServicioDAL.getListadoEmpresaServicio(ref pobjDataTable)) { foreach (DataRow wobjDataRow in pobjDataTable.Rows) { YouCom.DTO.Servicio.EmpresaServicioDTO empresa_servicio = new YouCom.DTO.Servicio.EmpresaServicioDTO(); empresa_servicio.IdEmpresaServicio = decimal.Parse(wobjDataRow["idEmpresaServicio"].ToString()); YouCom.DTO.Servicio.ServiciosDTO myServiciosDTO = new YouCom.DTO.Servicio.ServiciosDTO(); myServiciosDTO.IdServicio = decimal.Parse(wobjDataRow["idServicios"].ToString()); myServiciosDTO.NombreServicio = wobjDataRow["nombreServicio"].ToString(); empresa_servicio.TheServiciosDTO = myServiciosDTO; YouCom.DTO.GiroDTO myGiroDTO = new YouCom.DTO.GiroDTO(); myGiroDTO.IdGiro = decimal.Parse(wobjDataRow["idGiro"].ToString()); myGiroDTO.NombreGiro = wobjDataRow["nombreGiro"].ToString(); empresa_servicio.TheGiroDTO = myGiroDTO; empresa_servicio.RutEmpresaServicio = wobjDataRow["RutEmpresaServicio"].ToString(); empresa_servicio.RazonSocialEmpresaServicio = wobjDataRow["razonSocialEmpresaServicio"].ToString(); empresa_servicio.DireccionEmpresaServicio = wobjDataRow["direccionEmpresaServicio"].ToString(); YouCom.DTO.ComunaDTO myComunaDTO = new YouCom.DTO.ComunaDTO(); myComunaDTO.IdComuna = decimal.Parse(wobjDataRow["idComuna"].ToString()); YouCom.DTO.CiudadDTO myCiudadDTO = new YouCom.DTO.CiudadDTO(); myCiudadDTO.IdCiudad = decimal.Parse(wobjDataRow["idCiudad"].ToString()); YouCom.DTO.RegionDTO myRegionDTO = new YouCom.DTO.RegionDTO(); myRegionDTO.IdRegion = decimal.Parse(wobjDataRow["idRegion"].ToString()); YouCom.DTO.PaisDTO myPaisDTO = new YouCom.DTO.PaisDTO(); myPaisDTO.IdPais = decimal.Parse(wobjDataRow["idPais"].ToString()); myComunaDTO.TheCiudadDTO = myCiudadDTO; myCiudadDTO.TheRegionDTO = myRegionDTO; myRegionDTO.ThePaisDTO = myPaisDTO; empresa_servicio.TheComunaDTO = myComunaDTO; empresa_servicio.TelefonoEmpresaServicio = wobjDataRow["telefonoEmpresaServicio"].ToString(); empresa_servicio.CelularEmpresaServicio = wobjDataRow["telefonoEmpresaServicio"].ToString(); empresa_servicio.EmailEmpresaServicio = wobjDataRow["emailEmpresaServicio"].ToString(); empresa_servicio.UrlEmpresaServicio = wobjDataRow["urlEmpresaServicio"].ToString(); empresa_servicio.LogoEmpresaServicio = wobjDataRow["logoEmpresaServicio"].ToString(); YouCom.DTO.Seguridad.CondominioDTO myCondominio = new YouCom.DTO.Seguridad.CondominioDTO(); myCondominio.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString()); empresa_servicio.TheCondominioDTO = myCondominio; YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO(); myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString()); empresa_servicio.TheComunidadDTO = myComunidadDTO; empresa_servicio.UsuarioIngreso = wobjDataRow["usuario_ingreso"].ToString(); empresa_servicio.FechaIngreso = wobjDataRow["fecha_ingreso"].ToString(); empresa_servicio.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString(); empresa_servicio.FechaModificacion = wobjDataRow["fecha_modificacion"].ToString(); empresa_servicio.Estado = wobjDataRow["estado"].ToString(); IEmpresaServicio.Add(empresa_servicio); } } return(IEmpresaServicio); }