Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            us = new Usuario();
            String valor = Request.QueryString["id"];
            int    id    = int.Parse(valor);

            us.Id_usuario = id;

            Mrol.DataSource     = NGUsuario.getInstance().listarRol();
            Mrol.DataTextField  = "Rol";
            Mrol.DataValueField = "Id_rol";
            Mrol.DataBind();

            this.registro    = NGUsuario.getInstance().getUsuarioporid(id);
            Id_usuario.Value = valor;


            if (registro.Read())
            {
                us.Nombre   = this.registro["Nombre_Usuario"].ToString();
                us.Id_rol   = Convert.ToInt32(this.registro["Id_rol"]);
                id_empleado = Convert.ToInt32(this.registro["Id_empleado"]);
            }
            //Mostrar datos en el textbox
            this.empleados = NGEmpleado.getInstance().ListarEmpleadoPorId(id_empleado);
            if (empleados.Read())
            {
                Mempleado.Text = empleados["Nombre_empleado"].ToString() + " " + empleados["Apellido"].ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.dtusuario = new DTUsuario();
            us             = new Usuario();
            this.dtrol     = new DTrol();
            String valor = Request.QueryString["id"];
            int    id    = int.Parse(valor);

            us.Id_usuario = id;

            Mrol.DataSource     = dtrol.listarRol();
            Mrol.DataTextField  = "Rol";
            Mrol.DataValueField = "Id_rol";
            Mrol.DataBind();

            this.registro    = dtusuario.getUsuarioporid(id);
            Id_usuario.Value = valor;


            if (registro.Read())
            {
                us.Nombre     = this.registro["Nombre_Usuario"].ToString();
                us.Contrasena = this.registro["Contrasena"].ToString();
                us.Id_rol     = Convert.ToInt32(this.registro["Id_rol"]);
            }
        }
Esempio n. 3
0
        //Extraer los datos de la vista
        public Usuario GetEntity()
        {
            Usuario us = new Usuario();

            if (Mnombre.ToString() == null)
            {
                RegularExpressionValidator.GetValidationProperty(RequiredFieldValidator1);
            }
            else
            {
                us.Nombre = Mnombre.Text;
            }

            if (Mcontrasena.ToString() == null)
            {
                RegularExpressionValidator.GetValidationProperty(RequiredFieldValidator1);
            }
            else
            {
                us.Contrasena = Mcontrasena.Text;
            }
            if (Mrol.ToString() == null)
            {
                RegularExpressionValidator.GetValidationProperty(RequiredFieldValidator1);
            }
            else
            {
                Rol       = Mrol.SelectedValue;
                us.Id_rol = Convert.ToInt32(Rol);
            }
            us.Id_empleado = int.Parse(Idempleado.Value.ToString());
            us.Activo      = 1;

            return(us);
        }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.dtusuario = new DTUsuario();
     this.registro  = this.dtusuario.listarTodo();
     this.conexion  = new Conexion();
     this.dtrol     = new DTrol();
     //en esta parte se carga el dropdownlist
     Mrol.DataSource     = dtrol.listarRol(); //aqui le paso mi consulta que esta en la clase dtdepartamento
     Mrol.DataTextField  = "Rol";             //le paso el texto del items
     Mrol.DataValueField = "Id_rol";          //le paso el id de cada items
     Mrol.DataBind();
 }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String rolid     = (string)Session["Id_rol"];
            string ubicacion = HttpContext.Current.Request.Url.AbsolutePath;

            int rol = Convert.ToInt32(rolid);

            bool permiso = false;

            if (rol == 1)
            {
                permiso = true;
            }
            else
            {
                permiso = NGUsuario.getInstance().acceso(rol, ubicacion);
            }

            //Se redirecciona si no tiene permiso
            if (permiso == false)
            {
                ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: Acceso(); ", true);
            }

            /*if(dtusuario.Sicrear() >= dtusuario.SicrearE())
             *         {
             *             ClientScript.RegisterStartupScript(GetType(), "Javascript", "javascript: Emleado(); ", true);
             *
             *         }*/


            this.empleado = NGUsuario.getInstance().ListarEmpleados();
            ;
            this.conexion = new Conexion();

            if (!IsPostBack)
            {
                //en esta parte se carga el dropdownlist
                Mrol.DataSource     = NGUsuario.getInstance().listarRol(); //aqui le paso mi consulta que esta en la clase dtdepartamento
                Mrol.DataTextField  = "Rol";                               //le paso el texto del items
                Mrol.DataValueField = "Id_rol";                            //le paso el id de cada items
                Mrol.DataBind();

                ListItem li = new ListItem("SELECCIONE", "0");//creamos una lista, para agregar el seleccione
                Mrol.Items.Insert(0, li);
            }
        }
Esempio n. 6
0
        public Usuario modificar()
        {
            Usuario usuario = new Usuario();
            String  valor   = Request.QueryString["id"];
            int     id      = int.Parse(valor);

            usuario.Id_usuario = id;

            if (Mnombre.ToString() == null)
            {
                RegularExpressionValidator.GetValidationProperty(RequiredFieldValidator1);
            }
            else
            {
                usuario.Nombre = Mnombre.Text;
            }

            if (Mcontrasena.ToString() == null)
            {
                RegularExpressionValidator.GetValidationProperty(RequiredFieldValidator1);
            }
            else
            {
                usuario.Contrasena = Mcontrasena.Text;
            }
            if (Mrol.ToString() == null)
            {
                RegularExpressionValidator.GetValidationProperty(RequiredFieldValidator1);
            }
            else
            {
                Rol            = Mrol.SelectedValue;
                usuario.Id_rol = Convert.ToInt32(Rol);
            }
            usuario.Id_empleado = int.Parse(Idempleado.Value.ToString());
            usuario.Activo      = 1;

            return(usuario);
        }
Esempio n. 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.empleado = NGEmpleado.getInstance().listarempleado();
            us            = new Usuario();
            String valor = Request.QueryString["id"];
            int    id    = int.Parse(valor);

            us.Id_usuario = id;

            if (!IsPostBack)
            {
                Mrol.DataSource     = NGUsuario.getInstance().listarRol();
                Mrol.DataTextField  = "Rol";
                Mrol.DataValueField = "Id_rol";
                Mrol.DataBind();
            }

            this.registro    = NGUsuario.getInstance().getUsuarioporid(id);
            Id_usuario.Value = valor;


            if (registro.Read())
            {
                us.Nombre = this.registro["Nombre_Usuario"].ToString();
                us.Id_rol = Convert.ToInt32(this.registro["Id_rol"]);
                // id_empleado = Convert.ToInt32(this.registro["Id_empleado"]);
            }

            /* if(!IsPostBack)
             * {
             *   //Mostrar datos en el textbox
             *   this.empleados = dte.getEmpleadoporid(id_empleado);
             *   if (empleados.Read())
             *   {
             *       Musuario.Text = empleados["Nombre_empleado"].ToString() + " " + empleados["Apellido"].ToString();
             *       Mcedula.Text = empleados["Cedula"].ToString();
             *   }
             * }*/
        }
        public Usuario modificar()
        {
            Usuario usuario = new Usuario();
            String  valor   = Request.QueryString["id"];
            int     id      = int.Parse(valor);

            if (Mnombre.ToString() != null)
            {
                usuario.Nombre = Mnombre.Text;
            }

            if (Mcontrasena.ToString() != null)
            {
                usuario.Contrasena = Mcontrasena.Text;
            }

            if (Mrol.ToString() != null)
            {
                string Rol = Mrol.SelectedValue;
                us.Id_rol = Convert.ToInt32(Rol);
            }

            return(usuario);
        }