protected void Page_Load(object sender, EventArgs e)
        {
            miRol = (Rol)Session["objRol"];

            TextIdRol.Text = miRol.IdRol.ToString();
            TextNombreRol.Text = miRol.NombreRol;
            TextDescipRol.Text = miRol.Descripcion;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            miUsu = (Usuario)Session["SesionUsuario"];
            miRol = (Rol)Session["sesionRol"];

            NombreRol.Text = miRol.NombreRol;
            DescripcionRol.Text = miRol.Descripcion;

            NombreUsu.Text = miUsu.PrimerNombre + miUsu.SegundoNombre;
            Apellidousu.Text = miUsu.PrimerApellido + miUsu.SegundoApellido;
        }
Example #3
0
 public Boolean AsignarRol(Usuario miUsuario, Rol miRol)
 {
     Boolean asignar;
     try
     {
         asignar = new DAORol().AsirgnarRol(miUsuario, miRol);
         return asignar;
     }
     catch (NullReferenceException e)
     {
         throw new Exception("Error en las Referenciasn estan Nulas", e);
     }
     catch (Exception e)
     {
         throw new Exception("Error General", e);
     }
 }
Example #4
0
        protected void defaultButton_Click(object sender, EventArgs e)
        {
            Rol nuevoRol = new Rol();
            bool agregar;
               // LogicaRol logicaRol = new LogicaRol();
            DAORol daorol = new DAORol();

            nuevoRol.NombreRol = nombreRol.Text;
            nuevoRol.Descripcion = DescripcionRol.Text;
            nuevoRol.Estado = true;

            agregar= daorol.AgregarRol(nuevoRol);

            if (nuevoRol != null)
            {
                Exito.Visible = true;
            }
            else
            {
                falla.Visible = true;
            }
        }
Example #5
0
        public Rol ModificarRol(Entidad _rol)
        {
            Rol rolModificar = new Rol();
            bool modificar = false;
            try
            {
                /* rolModificar.IdRol = id;
                 rolModificar.NombreRol = nombre;
                 rolModificar.Descripcion = descrip;
                 rolModificar.Estado = estado;*/

                modificar = new DAORol().ModificarRoles(rolModificar);

                if (modificar == true)
                {
                    return rolModificar;
                }
                else
                {
                    return null;
                }
            }

            catch (NullReferenceException e)
            {
                throw new Exception("Error en las Referenciasn estan Nulas", e);
            }
            catch (Exception e)
            {
                throw new Exception("Error General", e);
            }
        }
Example #6
0
        public Boolean AsirgnarRol(Usuario miUsuario, Rol miRol)
        {
            SqlCommand command = new SqlCommand();
            SqlDataReader reader;

            Boolean resultado = false;
            try
            {
                conex.AbrirConexion();
                command.Connection = conex.ObjetoConexion();
                command.CommandType = System.Data.CommandType.StoredProcedure;
                command.CommandText = "[dbo].[AsignarRol]";
                command.CommandTimeout = 10;

                command.Parameters.AddWithValue("@idRolAsig", miRol.IdRol);
                command.Parameters["@idRolAsig"].Direction = ParameterDirection.Input;
                command.Parameters.AddWithValue("@idUsuarioAsig", miUsuario.IdUsuario);
                command.Parameters["@idUsuarioAsig"].Direction = ParameterDirection.Input;

                reader = command.ExecuteReader();

                resultado = true;
            }
            catch (SqlException e)
            {
                throw new Exception("Error en la conexion", e);
            }
            catch (NullReferenceException e)
            {
                throw new Exception("Error Referencia Nula", e);
            }
            catch (Exception e)
            {
                throw new Exception("Error" + e.Message, e);
            }
            finally
            {
                conex.CerrarConexion();
            }

            return resultado;
        }