예제 #1
0
        public static bool ValidaEliminacionServicio(YouCom.DTO.Servicio.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);
        }
예제 #2
0
        public static bool ActivaServicio(YouCom.DTO.Servicio.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);
        }
예제 #3
0
        public static bool Update(YouCom.DTO.Servicio.ServiciosDTO myServiciosDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            try
            {
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdServicio", SqlDbType.Decimal, -1, myServiciosDTO.IdServicio);
                wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myServiciosDTO.TheCondominioDTO.IdCondominio);
                wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myServiciosDTO.TheComunidadDTO.IdComunidad);
                wobjSQLHelper.SetParametro("@pNombreServicio", SqlDbType.VarChar, 200, myServiciosDTO.NombreServicio);
                wobjSQLHelper.SetParametro("@pDescripcionServicio", SqlDbType.Text, -1, myServiciosDTO.DescripcionServicio);
                wobjSQLHelper.SetParametro("@pIdCategoria", SqlDbType.Decimal, -1, myServiciosDTO.TheCategoriaDTO.IdCategoria);
                wobjSQLHelper.SetParametro("@pFechaInicio", SqlDbType.DateTime, -1, myServiciosDTO.FechaInicio);
                wobjSQLHelper.SetParametro("@pFechaTermino", SqlDbType.DateTime, -1, myServiciosDTO.FechaTermino);
                wobjSQLHelper.SetParametro("@pImagenServicio", SqlDbType.VarChar, 200, myServiciosDTO.ImagenServicio);
                wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myServiciosDTO.UsuarioModificacion);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("UPD_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);
        }
예제 #4
0
        public static bool ValidaEliminacionServicio(YouCom.DTO.Servicio.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);
        }
예제 #5
0
        public static bool Insert(YouCom.DTO.Servicio.ServiciosDTO myServiciosDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();
            DataTable pobjDataTable = new DataTable();

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myServiciosDTO.TheCondominioDTO.IdCondominio);
                wobjSQLHelper.SetParametro("@pIdComunidad", SqlDbType.Decimal, -1, myServiciosDTO.TheComunidadDTO.IdComunidad);
                wobjSQLHelper.SetParametro("@pNombreServicio", SqlDbType.VarChar, 200, myServiciosDTO.NombreServicio);
                wobjSQLHelper.SetParametro("@pDescripcionServicio", SqlDbType.Text, -1, myServiciosDTO.DescripcionServicio);
                wobjSQLHelper.SetParametro("@pIdCategoria", SqlDbType.Decimal, -1, myServiciosDTO.TheCategoriaDTO.IdCategoria);
                wobjSQLHelper.SetParametro("@pFechaInicio", SqlDbType.DateTime, -1, myServiciosDTO.FechaInicio);
                wobjSQLHelper.SetParametro("@pFechaTermino", SqlDbType.DateTime, -1, myServiciosDTO.FechaTermino);
                wobjSQLHelper.SetParametro("@pImagenServicio", SqlDbType.VarChar, 200, myServiciosDTO.ImagenServicio);
                wobjSQLHelper.SetParametro("@pUsuarioIngreso", SqlDbType.VarChar, 20, myServiciosDTO.UsuarioIngreso);

                wobjSQLHelper.SetParametroOut("@identity",
                                              SqlDbType.BigInt,
                                              -1);


                if (wobjSQLHelper.Ejecutar("INS_Servicio",
                                           "YouCom",
                                           pobjDataTable) <= 0)
                {
                    myServiciosDTO.IdServicio = decimal.Parse(wobjSQLHelper.GetParametro("@identity").ToString());
                }
                //====================================================================================

                retorno = true;
            }

            #region Catch

            catch (Exception eobjException)
            {
                throw eobjException;
            }
            #endregion

            return(retorno);
        }
예제 #6
0
        public static IList <YouCom.DTO.Servicio.ServiciosDTO> getListadoServicios()
        {
            IList <YouCom.DTO.Servicio.ServiciosDTO> IServicios = new List <YouCom.DTO.Servicio.ServiciosDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.DAL.ServiciosDAL.getListadoServicios(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.Servicio.ServiciosDTO servicio = new YouCom.DTO.Servicio.ServiciosDTO();

                    servicio.IdServicio = decimal.Parse(wobjDataRow["IdServicio"].ToString());

                    YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO();
                    myCondominioDTO.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString());
                    servicio.TheCondominioDTO    = myCondominioDTO;

                    YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
                    myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString());
                    servicio.TheComunidadDTO   = myComunidadDTO;

                    YouCom.DTO.CategoriaDTO myCategoriaDTO = new YouCom.DTO.CategoriaDTO();
                    myCategoriaDTO.IdCategoria     = decimal.Parse(wobjDataRow["idCategoria"].ToString());
                    myCategoriaDTO.NombreCategoria = wobjDataRow["nombreCategoria"].ToString();
                    servicio.TheCategoriaDTO       = myCategoriaDTO;

                    servicio.NombreServicio      = wobjDataRow["nombreServicio"].ToString();
                    servicio.DescripcionServicio = wobjDataRow["descripcionServicio"].ToString();
                    servicio.ImagenServicio      = wobjDataRow["imagenServicio"].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);
        }
예제 #7
0
        public static bool Delete(YouCom.DTO.Servicio.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);
        }
예제 #8
0
        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);
        }