Ejemplo n.º 1
0
        public static bool ValidaEliminacionAccesoHogar(YouCom.DTO.AccesoHogarDTO theAccesoHogarDTO, ref DataTable pobjDatatable)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();
            wobjSQLHelper.SetParametro("@idAccesoHogar", SqlDbType.VarChar, 20, theAccesoHogarDTO.IdAccesoHogar);

            try
            {
                //====================================================================================
                if (wobjSQLHelper.Ejecutar("validaEliminacionAccesoHogar", "YouCom", pobjDatatable) <= 0)
                {
                    retorno = false;
                }
                else
                {
                    retorno = true;
                }
            }
            catch (Exception eobjException)
            {
                throw eobjException;
            }
            return(retorno);
        }
Ejemplo n.º 2
0
        public static bool ActivaAccesoHogar(YouCom.DTO.AccesoHogarDTO theAccesoHogarDTO)
        {
            bool retorno = false;

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

            wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theAccesoHogarDTO.UsuarioModificacion);
            wobjSQLHelper.SetParametro("@pIdCasa", SqlDbType.VarChar, 20, theAccesoHogarDTO.IdAccesoHogar);

            try
            {
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("Activa_AccesoHogar", "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);
        }
Ejemplo n.º 3
0
        public static bool Update(YouCom.DTO.AccesoHogarDTO myAccesoHogarDTO)
        {
            bool retorno = false;

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

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdAcceso", SqlDbType.Decimal, -1, myAccesoHogarDTO.IdAccesoHogar);
                wobjSQLHelper.SetParametro("@pIdCasa", SqlDbType.Decimal, -1, myAccesoHogarDTO.IdCasa);
                wobjSQLHelper.SetParametro("@pIdTipoVisita", SqlDbType.Decimal, -1, myAccesoHogarDTO.IdTipoVisita);
                wobjSQLHelper.SetParametro("@pIdFrecuencia", SqlDbType.Decimal, -1, myAccesoHogarDTO.IdFrecuencia);
                wobjSQLHelper.SetParametro("@pIdFamilia", SqlDbType.Decimal, -1, myAccesoHogarDTO.IdFamilia);
                wobjSQLHelper.SetParametro("@pFechaInicio", SqlDbType.DateTime, -1, myAccesoHogarDTO.FechaInicio);
                wobjSQLHelper.SetParametro("@pFechaTermino", SqlDbType.DateTime, -1, myAccesoHogarDTO.FechaTermino);
                wobjSQLHelper.SetParametro("@pNombreVisita", SqlDbType.VarChar, 200, myAccesoHogarDTO.NombreVisita);
                wobjSQLHelper.SetParametro("@pRutVisita", SqlDbType.VarChar, 20, myAccesoHogarDTO.RutVisita);
                wobjSQLHelper.SetParametro("@pAvisar", SqlDbType.Char, 2, myAccesoHogarDTO.Avisar);
                wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myAccesoHogarDTO.UsuarioModificacion);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("UPD_AccesoHogar", "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);
        }
Ejemplo n.º 4
0
        public static bool ValidaEliminacionAccesoHogar(YouCom.DTO.AccesoHogarDTO theAccesoHogarDTO)
        {
            DataTable pobjDataTable = new DataTable();
            bool      retorno       = false;

            if (YouCom.DAL.AccesoHogarDAL.ValidaEliminacionAccesoHogar(theAccesoHogarDTO, ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    retorno = true;
                }
            }

            return(retorno);
        }
Ejemplo n.º 5
0
        public static bool Delete(YouCom.DTO.AccesoHogarDTO myAccesoHogarDTO)
        {
            bool retorno = false;

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

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdAcceso", SqlDbType.Decimal, -1, myAccesoHogarDTO.IdAccesoHogar);
                wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myAccesoHogarDTO.UsuarioModificacion);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("DEL_AccesoHogar", "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);
        }
Ejemplo n.º 6
0
        public static IList <YouCom.DTO.AccesoHogarDTO> getListadoAccesoHogar()
        {
            IList <YouCom.DTO.AccesoHogarDTO> IAccesoHogar = new List <YouCom.DTO.AccesoHogarDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.DAL.AccesoHogarDAL.getListadoAccesoHogar(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.AccesoHogarDTO accesoHogar = new YouCom.DTO.AccesoHogarDTO();

                    accesoHogar.IdAccesoHogar = decimal.Parse(wobjDataRow["IdAcceso"].ToString());
                    accesoHogar.IdCasa        = decimal.Parse(wobjDataRow["idCasa"].ToString());
                    accesoHogar.IdTipoVisita  = decimal.Parse(wobjDataRow["idTipoVisita"].ToString());
                    accesoHogar.IdFrecuencia  = decimal.Parse(wobjDataRow["idFrecuencia"].ToString());
                    accesoHogar.IdFamilia     = decimal.Parse(wobjDataRow["idFamilia"].ToString());
                    accesoHogar.FechaInicio   = DateTime.Parse(wobjDataRow["FechaInicio"].ToString());
                    accesoHogar.FechaTermino  = DateTime.Parse(wobjDataRow["fechaTermino"].ToString());
                    accesoHogar.NombreVisita  = wobjDataRow["nombreVisita"].ToString();
                    accesoHogar.RutVisita     = wobjDataRow["rutVisita"].ToString();
                    accesoHogar.Avisar        = wobjDataRow["avisar"].ToString();

                    accesoHogar.UsuarioIngreso      = wobjDataRow["usuario_ingreso"].ToString();
                    accesoHogar.FechaIngreso        = wobjDataRow["fecha_ingreso"].ToString();
                    accesoHogar.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString();
                    accesoHogar.FechaModificacion   = wobjDataRow["fecha_modificacion"].ToString();

                    accesoHogar.Estado = wobjDataRow["estado"].ToString();

                    IAccesoHogar.Add(accesoHogar);
                }
            }

            return(IAccesoHogar);
        }