Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            homeCtrl = new HomeController();
            pc       = new PersonaController();
            rolCtrl  = new RolController();

            if (!IsPostBack)
            {
                if (!SitePrincipal.IsIntruso())
                {
                    if (SitePrincipal.ExisteActiva())
                    {
                        cargarTipoPersona();
                        CargarRoles();
                    }
                    else
                    {
                        SitePrincipal.pagRedireccion   = "~/Vistas/Personas/Create";
                        SitePrincipal.countRedireccion = 0;
                        Response.Redirect("~/Vistas/Empresas/Panel");
                    }
                }
                else
                {
                    Response.Redirect("~/Account/Login");
                }
            }
        }
 public void cargar_menu_padre(int aux_rol)
 {
     controlador_rol = new RolController(aux_rol, "", "");
     consulta        = controlador_rol.consulta_menu_unico();
     this.lista_menu_padre.DataTextField = "descripcion";
     this.lista_menu_padre.DataSource    = consulta;
     lista_menu_padre.DataBind();
 }
Beispiel #3
0
        void Application_Start(object sender, EventArgs e)
        {
            // Código que se ejecuta al iniciar la aplicación
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            var rm = new RoleManager <IdentityRole>(new RoleStore <IdentityRole>(new ApplicationDbContext()));

            var um = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));

            um.UserValidator = new UserValidator <ApplicationUser>(um)
            {
                AllowOnlyAlphanumericUserNames = false
            };

            if (!rm.RoleExists("SA"))
            {
                rolCtrl     = new RolController();
                personaCtrl = new PersonaController();

                rm.Create(new IdentityRole("SA"));
                var rol = rm.FindByName("SA");

                rolCtrl.AddNivel(rol.Id, 1, true);
                rolCtrl.CargarPrivilegiosSA(rol.Id);

                var user = new ApplicationUser()
                {
                    UserName = "******", Email = "*****@*****.**"
                };

                um.Create(user, "Elimelec1*");
                um.AddToRole(user.Id, "SA");

                Persona p = new Persona
                {
                    CI           = "1",
                    Nombre       = "Sistemas",
                    ApellidoP    = "Etech",
                    ApellidoM    = "Group",
                    Direccion    = "Av. San Martin 14 Edif. Fragata Piso 3 Of. 1",
                    Telefono     = "+59133390306",
                    Email        = "*****@*****.**",
                    Contacto     = "",
                    TelfContacto = "",
                    Estado       = true,
                    CodTipo      = 2,
                    CategoriaL   = "",
                    IdUser       = user.Id,
                    UsuaReg      = "sistemas",
                    FechaReg     = DateTime.Now
                };

                personaCtrl.add(p);
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            RolController Rol   = new RolController();
            List <string> lista = Rol.consultarRoles(Rol.modelo);

            select_roles.Items.Clear();
            Permisos = Rol.Permisos();
            for (int i = 0; i < lista.Count; i++)
            {
                select_roles.Items.Add(lista[i]);
            }
        }
Beispiel #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            rolCtrl = new RolController();

            if (!SitePrincipal.IsIntruso())
            {
                CargarNiveles();
            }
            else
            {
                Response.Redirect("~/Account/Login");
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["ENTRADA"].ToString().Equals("F"))
            {
                Response.Redirect("../../Login.aspx");
            }
            if (!Session["ROL"].ToString().Equals("director"))
            {
                Response.Redirect("../Home/Principal.aspx");
            }
            RolController p = new RolController();

            lista = p.consultarRoles(p.modelo);
        }
Beispiel #7
0
        protected void brt_Click(object sender, EventArgs e)
        {
            string aux;

            if (tx_rol.Text.Equals("") == false)
            {
                RolController r = new RolController();
                r.RegistrarRol(tx_rol.Text);
                aux = "Operacion Exitosa";
            }
            else
            {
                aux = "Error campos vacios";
            }
            Response.Write("<script> alert('" + aux + "'); </script>");
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            usuarioCtrl = new UsuarioController();
            rolCtrl     = new RolController();
            empresaCtrl = new EmpresaController();

            CargarPrivilegios();
            Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetNoStore();
            var list = HttpContext.Current.Cache;

            foreach (System.Collections.DictionaryEntry entry in HttpContext.Current.Cache)
            {
                HttpContext.Current.Cache.Remove((string)entry.Key);
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            personaCtrl = new PersonaController();
            rolCtrl     = new RolController();
            usuarioCtrl = new UsuarioController();

            if (!IsPostBack)
            {
                if (!SitePrincipal.IsIntruso())
                {
                    if (SitePrincipal.ExisteActiva())
                    {
                        string ci = Request.QueryString["ci"];
                        if (!String.IsNullOrEmpty(ci))
                        {
                            var resultd = personaCtrl.listar(ci);
                            if (resultd.Estado)
                            {
                                cargarTipoPersona();
                                CargarPersona();
                                CargarRoles();
                            }
                            else
                            {
                                MensajeAlerta("El personal ya ha sido dado de baja");
                                Response.Redirect("~/Vistas/Personas/Index");
                            }
                        }
                        else
                        {
                            Response.Redirect("~/Vistas/Personas/Index");
                        }
                    }
                    else
                    {
                        SitePrincipal.pagRedireccion   = "~/Vistas/Personas/Edit";
                        SitePrincipal.countRedireccion = 0;
                        Response.Redirect("~/Vistas/Empresas/Panel");
                    }
                }
                else
                {
                    Response.Redirect("~/Account/Login");
                }
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            usuarioCtrl = new UsuarioController();
            rolCtrl     = new RolController();

            if (!IsPostBack)
            {
                if (!SitePrincipal.IsIntruso())
                {
                    CargarUsuario();
                    CargarPersonas();
                    CargarRoles();
                }
                else
                {
                    Response.Redirect("~/Account/Login");
                }
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            rolCtrl = new RolController();
            string userName = HttpContext.Current.User.Identity.Name;

            if (!IsPostBack)
            {
                if (!SitePrincipal.IsIntruso())
                {
                    dpdRoles.DataValueField = "Id";
                    dpdRoles.DataTextField  = "Name";
                    dpdRoles.DataSource     = rolCtrl.GetAll(userName);
                    dpdRoles.DataBind();
                }
                else
                {
                    Response.Redirect("~/Account/Login");
                }
            }
        }