Exemplo n.º 1
0
        public static bool ValidaEliminacionPerfil(YouCom.DTO.Seguridad.PerfilDTO thePerfilDTO, ref DataTable pobjDatatable)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();
            wobjSQLHelper.SetParametro("@idPerfil", SqlDbType.VarChar, 20, thePerfilDTO.IdPerfil);

            try
            {
                //====================================================================================
                if (wobjSQLHelper.Ejecutar("validaEliminacionPerfil", "YouCom", pobjDatatable) <= 0)
                {
                    retorno = false;
                }
                else
                {
                    retorno = true;
                }
            }
            catch (Exception eobjException)
            {
                throw eobjException;
            }
            return(retorno);
        }
Exemplo n.º 2
0
        public static IList <YouCom.DTO.Seguridad.PerfilDTO> getListadoPerfil()
        {
            IList <YouCom.DTO.Seguridad.PerfilDTO> IPerfil = new List <YouCom.DTO.Seguridad.PerfilDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.Seguridad.DAL.PerfilDAL.getListadoPerfil(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.Seguridad.PerfilDTO Perfil = new YouCom.DTO.Seguridad.PerfilDTO();

                    Perfil.IdPerfil          = decimal.Parse(wobjDataRow["IdPerfil"].ToString());
                    Perfil.NombrePerfil      = wobjDataRow["nombrePerfil"].ToString();
                    Perfil.DescripcionPerfil = wobjDataRow["descripcionPerfil"].ToString();

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

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

                    IPerfil.Add(Perfil);
                }
            }

            return(IPerfil);
        }
Exemplo n.º 3
0
        public static bool ActivaPerfil(YouCom.DTO.Seguridad.PerfilDTO thePerfilDTO)
        {
            bool retorno = false;

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

            wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, thePerfilDTO.UsuarioModificacion);
            wobjSQLHelper.SetParametro("@pIdPerfil", SqlDbType.VarChar, 20, thePerfilDTO.IdPerfil);

            try
            {
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("Activa_Perfil", "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);
        }
Exemplo n.º 4
0
        public static bool ValidaEliminacionPerfil(YouCom.DTO.Seguridad.PerfilDTO thePerfilDTO)
        {
            DataTable pobjDataTable = new DataTable();
            bool      retorno       = false;

            if (YouCom.Seguridad.DAL.PerfilDAL.ValidaEliminacionPerfil(thePerfilDTO, ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    retorno = true;
                }
            }

            return(retorno);
        }
Exemplo n.º 5
0
        public static bool Update(YouCom.DTO.Seguridad.PerfilDTO myPerfilDTO)
        {
            bool retorno = false;

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

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdPerfil", SqlDbType.Decimal, -1, myPerfilDTO.IdPerfil);
                wobjSQLHelper.SetParametro("@pNombrePerfil", SqlDbType.VarChar, 20, myPerfilDTO.NombrePerfil);
                wobjSQLHelper.SetParametro("@pDescripcionPerfil", SqlDbType.Text, -1, myPerfilDTO.DescripcionPerfil);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("UPD_Perfil", "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);
        }