Ejemplo n.º 1
0
        public ActionResult SysMod(string sysid, string moduleid)
        {
            SchSysModuleRelRepository rep = new SchSysModuleRelService().GetSysModRel(sysid, moduleid);

            Models.ModelSchedule model = getModel(rep.MAIN_ID, DateTime.Now.ToString("yyyyMM"));
            model.Authority = (rep != null && rep.MAIN_ID != null && Session["SCH_" + UserService.Pernr + "_" + rep.MAIN_ID] != null && Convert.ToBoolean(Session["SCH_" + UserService.Pernr + "_" + rep.MAIN_ID]))
                ? Models.enumAuthority.Adm : Models.enumAuthority.Read;
            //model.Authority = Models.enumAuthority.Adm;
            return(View("Index", model));
        }
Ejemplo n.º 2
0
        protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }

            SchSysModuleRelService sysModuleRelService = new SchSysModuleRelService();
            string sName;
            string mainid   = httpContext.Request["mainid"];
            string sysid    = httpContext.Request.RequestContext.RouteData.Values["sysid"] as string ?? httpContext.Request["sysid"] as string;
            string moduleid = httpContext.Request.RequestContext.RouteData.Values["moduleid"] as string ?? httpContext.Request["moduleid"] as string;
            SchSysModuleRelRepository repo = sysModuleRelService.GetSysModRel(mainid: mainid, sysid: sysid, moduleid: moduleid);

            if (mainid == "F0EC4C5F384E2973E043E0C4380A7471" || (string.IsNullOrEmpty(mainid) && string.IsNullOrEmpty(sysid) && string.IsNullOrEmpty(moduleid)))
            {
                mainid = "F0EC4C5F384E2973E043E0C4380A7471";
                sName  = "SCH_" + UserService.Pernr + "_" + mainid;

                httpContext.Session[sName] = true;
                return(true);
            }
            sysid    = repo.SYSID;
            moduleid = repo.MODULEID;

            List <string> memids = sysModuleRelService.GetOwnersBySysMod(sysid, moduleid);



            sName = (repo != null && !string.IsNullOrEmpty(repo.MAIN_ID)) ? "SCH_" + UserService.Pernr + "_" + repo.MAIN_ID : "SCH_";

            httpContext.Session[sName] = memids.Contains(UserService.Pernr);

            if (this.Roles == "ALL")
            {
                return(true);
            }
            else if (mainid == "F0EC4C5F384E2973E043E0C4380A7471")
            {
                return(true);
            }
            else if (this.Roles == "ADM")
            {
                return(memids.Contains(UserService.Pernr));
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext)
        {
            if (httpContext == null)
                throw new ArgumentNullException("httpContext");

            SchSysModuleRelService sysModuleRelService = new SchSysModuleRelService();
            string sName;
            string mainid = httpContext.Request["mainid"];
            string sysid = httpContext.Request.RequestContext.RouteData.Values["sysid"] as string ?? httpContext.Request["sysid"] as string;
            string moduleid = httpContext.Request.RequestContext.RouteData.Values["moduleid"] as string ?? httpContext.Request["moduleid"] as string;
            SchSysModuleRelRepository repo = sysModuleRelService.GetSysModRel(mainid: mainid, sysid: sysid, moduleid: moduleid);
            if (mainid == "F0EC4C5F384E2973E043E0C4380A7471" || (string.IsNullOrEmpty(mainid) && string.IsNullOrEmpty(sysid) && string.IsNullOrEmpty(moduleid)))
            {
                mainid = "F0EC4C5F384E2973E043E0C4380A7471";
                sName = "SCH_" + UserService.Pernr + "_" + mainid;

                httpContext.Session[sName] = true;
                return true;
            }
            sysid = repo.SYSID;
            moduleid = repo.MODULEID;

            List<string> memids = sysModuleRelService.GetOwnersBySysMod(sysid, moduleid);

            sName = (repo != null && !string.IsNullOrEmpty(repo.MAIN_ID)) ? "SCH_" + UserService.Pernr  + "_" + repo.MAIN_ID : "SCH_";

            httpContext.Session[sName] = memids.Contains(UserService.Pernr);

            if (this.Roles == "ALL")
            {
                return true;
            }
            else if (mainid == "F0EC4C5F384E2973E043E0C4380A7471")
            {
                return true;
            }
            else if (this.Roles == "ADM")
            {
                return memids.Contains(UserService.Pernr);
            }
            else
            {
                return false;
            }
        }
Ejemplo n.º 4
0
 public ActionResult SysMod(string sysid, string moduleid)
 {
     SchSysModuleRelRepository rep = new SchSysModuleRelService().GetSysModRel(sysid, moduleid);
     Models.ModelSchedule model = getModel(rep.MAIN_ID, DateTime.Now.ToString("yyyyMM"));
     model.Authority = (rep != null && rep.MAIN_ID != null && Session["SCH_" + UserService.Pernr + "_" + rep.MAIN_ID] != null && Convert.ToBoolean(Session["SCH_" + UserService.Pernr + "_" + rep.MAIN_ID]))
         ? Models.enumAuthority.Adm : Models.enumAuthority.Read;
     //model.Authority = Models.enumAuthority.Adm;
     return View("Index", model);
 }