Esempio n. 1
0
        public List <ClsRol> FnRRolD()
        {
            ClsRol ObjRol = null;

            try
            {
                ObjConexion       = new ClsConexion();
                Cmd_D             = new MySqlCommand("spRRol", ObjConexion.Con_D);
                Cmd_D.CommandType = CommandType.StoredProcedure;
                ObjConexion.Abrircon();
                Dr_D = Cmd_D.ExecuteReader();
                List <ClsRol> LstRol = new List <ClsRol>();
                while (Dr_D.Read())
                {
                    ObjRol                 = new ClsRol();
                    ObjRol.Id_rol          = Dr_D[0].ToString();
                    ObjRol.Rol             = Dr_D[1].ToString();
                    ObjRol.Fecha_inicioRol = Dr_D[3].ToString();
                    LstRol.Add(ObjRol);
                }
                return(LstRol);
            }
            catch (Exception ex)
            {
                return(null);

                throw ex;
            }
            finally
            {
                ObjConexion.Cerrarcon();
            }
        }
Esempio n. 2
0
        public bool FnERolD(ClsRol ORol)
        {
            bool ExisteRol = true;

            try
            {
                ObjConexion       = new ClsConexion();
                Cmd_D             = new MySqlCommand("spERol", ObjConexion.Con_D);
                Cmd_D.CommandType = CommandType.StoredProcedure;
                Cmd_D.Parameters.AddWithValue("prmIdRol", Convert.ToInt16(ORol.Id_rol));
                Cmd_D.Parameters.AddWithValue("prmRol", ORol.Rol);

                ObjConexion.Abrircon();
                Dr_D = Cmd_D.ExecuteReader();
                if (Dr_D.Read())
                {
                    ExisteRol = Convert.ToBoolean(Dr_D[0]);
                }
                return(ExisteRol);
            }
            catch (Exception ex)
            {
                return(true);

                throw ex;
            }
            finally
            {
                ObjConexion.Cerrarcon();
            }
        }
Esempio n. 3
0
        public bool FnURolD(ClsRol ORol)
        {
            bool UpdateRol = false;

            try
            {
                ObjConexion       = new ClsConexion();
                Cmd_D             = new MySqlCommand("spURol", ObjConexion.Con_D);
                Cmd_D.CommandType = CommandType.StoredProcedure;
                Cmd_D.Parameters.AddWithValue("prmIdRol", Convert.ToInt16(ORol.Id_rol));
                Cmd_D.Parameters.AddWithValue("prmRol", ORol.Rol);

                ObjConexion.Abrircon();
                int FilasURol = Cmd_D.ExecuteNonQuery();
                if (FilasURol > 0)
                {
                    UpdateRol = true;
                }

                return(UpdateRol);
            }
            catch (Exception ex)
            {
                return(false);

                throw ex;
            }
            finally
            {
                ObjConexion.Cerrarcon();
            }
        }
Esempio n. 4
0
        protected void btnIngresar_Click(object sender, EventArgs e)
        {
            ClsPersona clsPersona = new ClsPersona();
            ClsRol     clsRol     = new ClsRol();
            Persona    persona    = new Persona();

            persona = clsPersona.Login(int.Parse(txtDocumento.Text), txtPassword.Text);

            if (persona.cedula != 0)
            {
                Session["idUsuario"] = persona.cedula;
                Session["nombre"]    = persona.nombre;
                Session["apellido"]  = persona.apellido;
                Session["idRol"]     = persona.id_rol;
                Session["rol"]       = clsRol.Rol(persona.id_rol);

                //if (persona.id_rol == 1)
                //{
                //    Response.Redirect("dashAdmin.aspx", false);
                //}
                //else if (persona.id_rol == 2)
                //{
                //    Response.Redirect("dashContenido.aspx", false);
                //}
                //else if (persona.id_rol == 3)
                //{
                //    Response.Redirect("dashPersona.aspx", false);
                //}
                Server.Transfer("dashboard.aspx");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Documento o contraseña incorrectos');", true);
            }
        }
Esempio n. 5
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            ClsRol objRol = new ClsRol();

            cmbRol.DataSource    = objRol.listarRoles().Tables[0];
            cmbRol.DisplayMember = "NombreRol";
            cmbRol.ValueMember   = "idRol";
            cmbRol.SelectedIndex = 2;
        }
Esempio n. 6
0
        public static bool FnNRolV(string IdRol)
        {
            bool   CloneRol = false;
            ClsRol ORol     = new ClsRol();

            ORol.Id_rol = IdRol;
            CloneRol    = new ClsRolN().FnNRolN(ORol);
            return(CloneRol);
        }
Esempio n. 7
0
        public static bool FnCRolV(string Rol)
        {
            bool   CreateRol = false;
            ClsRol ORol      = new ClsRol();

            ORol.Rol  = Rol;
            CreateRol = new ClsRolN().FnCRolN(ORol);
            return(CreateRol);
        }
Esempio n. 8
0
        public static bool FnERolV(string IdRol, string Rol)
        {
            bool   ExistRol = false;
            ClsRol ORol     = new ClsRol();

            ORol.Id_rol = IdRol;
            ORol.Rol    = Rol;
            ExistRol    = new ClsRolN().FnERolN(ORol);
            return(ExistRol);
        }
Esempio n. 9
0
        public static bool FnDRolV(string IdRol)
        {
            bool   DeleteRol = false;
            ClsRol ORol      = new ClsRol();

            ORol.Id_rol = IdRol;

            DeleteRol = new ClsRolN().FnDRolN(ORol);
            return(DeleteRol);
        }
Esempio n. 10
0
        public static bool FnURolV(string IdRol, string Rol)
        {
            bool   UpdateRol = false;
            ClsRol ORol      = new ClsRol();

            ORol.Id_rol = IdRol;
            ORol.Rol    = Rol;
            UpdateRol   = new ClsRolN().FnURolN(ORol);
            return(UpdateRol);
        }
Esempio n. 11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ClsRol objRol = new ClsRol();
         ddlRoles.DataSource     = objRol.listarRoles().Tables[0];
         ddlRoles.DataTextField  = "NombreRol";
         ddlRoles.DataValueField = "idRol";
         ddlRoles.DataBind();
     }
 }
Esempio n. 12
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            ClsPersona clsPersona = new ClsPersona();
            ClsRol     clsRol     = new ClsRol();
            persona    persona    = new persona();

            persona = clsPersona.Login(int.Parse(TextCedula.Text), TextPassword.Text);
            if (persona.cedula != 0)
            {
                Session["idPersona"] = persona.id_persona;
                Session["nombre"]    = persona.nombre;
                Session["apellido"]  = persona.apellido;
                Session["idRol"]     = persona.id_rol;
                Session["rol"]       = clsRol.Rol(persona.id_rol);
                Server.Transfer("dashboard.aspx");
            }
            else
            {
                Page.RegisterStartupScript("script", "<script languaje=JavaScript>alert('Datos Incorrectos')</script>");
            }
        }
Esempio n. 13
0
        public bool FnCRolN(ClsRol ORol)
        {
            bool CreateRol = new ClsRolD().FnCRolD(ORol);

            return(CreateRol);
        }
Esempio n. 14
0
        public bool FnURolN(ClsRol ORol)
        {
            bool UpdateRol = new ClsRolD().FnURolD(ORol);

            return(UpdateRol);
        }
Esempio n. 15
0
        public bool FnNRolN(ClsRol ORol)
        {
            bool CloneRol = new ClsRolD().FnNRolD(ORol);

            return(CloneRol);
        }
Esempio n. 16
0
        public bool FnERolN(ClsRol ORol)
        {
            bool ExistRol = new ClsRolD().FnERolD(ORol);

            return(ExistRol);
        }
Esempio n. 17
0
        public bool FnDRolN(ClsRol ORol)
        {
            bool DeleteRol = new ClsRolD().FnDRolD(ORol);

            return(DeleteRol);
        }