public ActionResult AddPrivilegeTemplate(long corptype)
        {
            var privileges = privilegeTemplateBll.GetSysPrivilegeTemplateByCorpType(corptype).Aggregate(string.Empty, (current, item) => current + (item.Privilege + ","));
            var treeList   = privilegeTemplateBll.GetPrivilegeTreeList(corptype, 0, privilegeTemplateBll.GetPrivileges(), privileges.TrimEnd(','));
            PrivilegeTemplateResult result = new PrivilegeTemplateResult()
            {
                Privileges = privileges,
                CorpType   = corptype
            };

            ViewBag.CorpTypeName = sysCorpTypeBll.GetModelById(corptype).Name;
            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = treeList
            };

            ViewData["CorpTypeList"] = dropDownListService.InitCorpTypeDropDownList();
            if (treeList.Count == 0)
            {
                ModelState.AddModelError("Privileges", "请先设置菜单模板!");
            }

            return(View(result));
        }
        public ActionResult AddPrivilegeTemplate(PrivilegeTemplateResult privilegeTemplate)
        {
            //处理其他请求
            var ac = Request["actionName"] ?? "";

            if (ac != "")
            {
                return(OtherAction(ac));
            }

            var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User;

            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = privilegeTemplateBll.GetPrivilegeTreeList(privilegeTemplate.CorpType, 0, privilegeTemplateBll.GetPrivileges())
            };

            if (privilegeTemplate.Privileges == null)
            {
                TempData["returnMsgType"] = "false";
                TempData["returnMsg"]     = "您未选择权限!";
                return(RedirectToAction("AddPrivilegeTemplate", "PrivilegeTemplate", new { area = "System", corpType = privilegeTemplate.CorpType }));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    var result = privilegeTemplateBll.SavePrivileges(privilegeTemplate.CorpType, privilegeTemplate.Privileges.TrimEnd(','), currentUser.SysOperator.ID);
                    if (!result.flag)
                    {
                        ModelState.AddModelError("Privileges", result.message);
                        return(View(privilegeTemplate));
                    }
                    else
                    {
                        TempData["returnMsgType"] = "success";
                        TempData["returnMsg"]     = "设置成功";
                        return(RedirectToAction("PrivilegeTemplates", "PrivilegeTemplate", new { area = "System", corptype = privilegeTemplate.CorpType }));
                    }
                }
                else
                {
                    TempData["returnMsgType"] = "false";
                    TempData["returnMsg"]     = "设置失败!";
                    return(RedirectToAction("AddPrivilegeTemplate", "PrivilegeTemplate", new { area = "System", corpType = privilegeTemplate.CorpType }));
                }
            }
        }
        public ActionResult AuditorPrivilegeTemplate(PrivilegeTemplateResult privilegeTemplate)
        {
            //处理其他请求
            var ac = Request["actionName"] ?? "";

            if (ac != "")
            {
                return(OtherAction(ac));
            }

            var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User;

            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = privilegeTemplateBll.GetPrivilegeTreeList(privilegeTemplate.CorpType, 0, privilegeTemplateBll.GetPrivileges())
            };
            ViewData["CorpTypeList"] = dropDownListService.InitCorpTypeDropDownList();

            if (ModelState.IsValid)
            {
                var result = privilegeTemplateBll.AuditorPrivileges(privilegeTemplate.CorpType, privilegeTemplate.Privileges.TrimEnd(','), currentUser.SysOperator.ID);
                if (!result.flag)
                {
                    ModelState.AddModelError("Privileges", result.message);
                    TempData["returnMsgType"] = "error";
                    TempData["returnMsg"]     = "审核通过失败";
                    return(View(privilegeTemplate));
                }
                else
                {
                    TempData["returnMsgType"] = "success";
                    TempData["returnMsg"]     = "审核通过成功";
                    return(RedirectToAction("PrivilegeTemplates", "PrivilegeTemplate", new { area = "System" }));
                }
            }
            TempData["CorpType"] = privilegeTemplate.CorpType;
            return(View("PrivilegeTemplates"));
        }
        public ActionResult AuditorPrivilegeTemplate(long corptype = 0)
        {
            var privileges = privilegeTemplateBll.GetSysPrivilegeTemplateByCorpType(corptype).Aggregate(string.Empty, (current, item) => current + (item.Privilege + ","));
            var treeList   = privilegeTemplateBll.GetPrivilegeTreeList(corptype, 0, privilegeTemplateBll.GetPrivileges(), privileges.TrimEnd(','));
            PrivilegeTemplateResult result = new PrivilegeTemplateResult()
            {
                Privileges = privileges,
                CorpType   = corptype
            };

            ViewBag.CorpTypeName = sysCorpTypeBll.GetModelById(corptype).Name;
            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = treeList
            };

            return(View(result));
        }