public ActionResult Index(int?page, int?pageSize) { List <PermisoEntity> permisos = proxy.GetPermisoList(); ViewData["Permiso"] = permisos; ViewData["Roles"] = proxyRole.GetRoleList(); ViewData["Module"] = proxyModule.GetModuleList(); return(View()); }
public ActionResult Index(int?page, int?pageSize) { //PermisosAcceso("Permiso"); //ViewData["Title"] = "Permiso"; //ViewData["Message"] = "Permiso"; //int pSize = pageSize ?? SoftvMVC.Properties.Settings.Default.pagnum; //int pageNumber = (page ?? 1); //SoftvList<PermisoEntity> listResult = proxy.GetPermisoPagedListXml(pageNumber, pSize, SerializeTool.Serialize<PermisoEntity>(new PermisoEntity())); //List<RoleEntity> lstRole = new List<RoleEntity>(); //lstRole.Add(new RoleEntity() { IdRol = null, Nombre = "Todos" }); //lstRole.AddRange(proxyRole.GetRoleList().OrderBy(x => x.Nombre.Trim())); //ViewBag.IdRoltxt = new SelectList(lstRole, "IdRol", "Nombre"); //List<ModuleEntity> lstModule = new List<ModuleEntity>(); //lstModule.Add(new ModuleEntity() { IdModule = null, Description = "Todos" }); //lstModule.AddRange(proxyModule.GetModuleList().OrderBy(x => x.Description.Trim())); //ViewBag.IdModuletxt = new SelectList(lstModule, "IdModule", "Nombre"); //CheckNotify(); //ViewBag.CustomScriptsDefault = BuildScriptsDefault("Permiso"); //return View(new StaticPagedList<PermisoEntity>(listResult.ToList(), pageNumber, pSize, listResult.totalCount)); List <PermisoEntity> permisos = proxy.GetPermisoList(); ViewData["Permiso"] = permisos; ViewData["Roles"] = proxyRole.GetRoleList(); ViewData["Module"] = proxyModule.GetModuleList(); return(View()); }
protected override void ExecuteCore() { // Primero se valida que el usuario este autenticado por medio de las variables de session ValidateCookiesUser(); Session["POptAdd"] = true; Session["POptUpdate"] = true; Session["POptDelete"] = true; List <ModuleEntity> lstModule = null; if (HttpContext != null && HttpContext.User.Identity.IsAuthenticated) { } // si el usuario tiene esta autenticado if (this.Session == null || this.Session["Access"] != null) { UsuarioEntity um = new UsuarioEntity(); List <PermisoEntity> permiso = new List <PermisoEntity>(); List <ModuleEntity> lstModuleFilter = new List <ModuleEntity>(); um = (UsuarioEntity)Session["Usuario"]; if (um != null) { if (proxyUsuario.GetUsuario(um.IdUsuario).Estado == true && proxyRol.GetRole(um.IdRol).Estado == true) { // una vez validado que el usuario este autenticado y su estado sea activo lista los modulos a los que tiene permiso List <PermisoEntity> lstPermiso = proxyPermiso.GetXmlPermiso(Globals.SerializeTool.Serialize <PermisoEntity>(new PermisoEntity() { IdRol = um.IdRol })).ToList(); permiso = proxyPermiso.GetPermisoList().Where(o => o.IdRol == um.IdRol).ToList(); lstModuleFilter = (from c in BuildMenu() where (from o in lstPermiso select o.IdModule).Contains(c.IdModule) select c).ToList(); lstPermiso.ForEach(XPermiso => lstModuleFilter.Where(x => x.IdModule.HasValue).Where(x => x.IdModule == XPermiso.IdModule).ToList().ForEach(y => y.Permiso = XPermiso)); lstModule = (from c in lstModuleFilter where c.Permiso.OptSelect == true select c).ToList(); //lstPermiso.ForEach(Xpermiso => lstMoldeFilter.Where(x => x.IdModule.HasValue).Where(x => x.IdModule == Xpermiso.IdModule).ToList().ForEach(y => y.Permiso = Xpermiso)); lstPermiso.ForEach(Xpermiso => lstPermiso.Where(z => z.OptAdd == true || z.OptDelete == true || z.OptSelect == true || z.OptUpdate == true).ToList()); } else { Session.RemoveAll(); } } proxy = new SoftvService.ModuleClient(); List <ModuleEntity> lm = lstModule; ViewBag.Permisos = permiso; ViewBag.Menu2 = lm; TipoCambioPass(); } if (this.Session == null || this.Session["Access"] == null) { Session["Access"] = "NG"; // RedirectToRoute("Home/Access"); } int culture = 0; if (this.Session == null || this.Session["CurrentCulture"] == null) { int.TryParse(System.Configuration.ConfigurationManager.AppSettings["Culture"], out culture); this.Session["CurrentCulture"] = culture; } else { culture = (int)this.Session["CurrentCulture"]; } // //SessionManager.CurrentCulture = culture; // // Invokes the action in the current controller context. // base.ExecuteCore(); }