Ejemplo n.º 1
0
        protected void rptModuleGroup_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    ModuleGroup mg      = e.Item.DataItem as ModuleGroup;
                    Repeater    rp      = (Repeater)e.Item.FindControl("rptModule");
                    var         modules = new List <Module>();
                    if (new DZAFCPortal.Authorization.DAL.RoleService().GenericService.GetModel(roleID).Name != "超级管理员")
                    {
                        modules = new DZAFCPortal.Authorization.DAL.ModuleService().GenericService.GetAll(m => m.ModuleGroup_ID == mg.ID && m.Code != "mokuaiguanli" && m.Code != "caozuoguanli").OrderBy(m => m.OrderNum).ToList();
                    }
                    else
                    {
                        modules = new DZAFCPortal.Authorization.DAL.ModuleService().GenericService.GetAll(m => m.ModuleGroup_ID == mg.ID).OrderBy(m => m.OrderNum).ToList();
                    }

                    rp.DataSource = modules;
                    rp.DataBind();
                }
            }
            catch
            {
                throw new Exception("绑定moduleGroup出错");
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request["roleID"];

            roleID = id;


            lstAllOperation  = operationService.GetAllOperation().Distinct(new OperationCodeComparer()).ToList();
            lstRoleOperation = operationService.GetRoleOperation(roleID);

            var groups = from r in lstAllOperation
                         group r by r.ModuleID into g
                         select g.Key;

            List <ModuleGroup> moduleGroupLST = new List <ModuleGroup>();


            foreach (var moduleID in groups)
            {
                var module = new DZAFCPortal.Authorization.DAL.ModuleService().GenericService.GetModel(moduleID);
                if (module == null)
                {
                    continue;
                }
                var mg = moduleGroupService.GenericService.FirstOrDefault(m => m.ID == module.ModuleGroup_ID);
                if (mg == null)
                {
                    continue;
                }
                if (moduleGroupLST.Find(m => m.ID == mg.ID) == null)
                {
                    moduleGroupLST.Add(mg);
                }
            }

            if (!Page.IsPostBack)
            {
                //表示默认角色
                if (DZAFCPortal.Config.AppSettings.DefaultRoles.Contains(new DZAFCPortal.Authorization.DAL.RoleService().GenericService.GetModel(roleID).Name))
                {
                    panel_1.Enabled = false;
                }

                panel_2.Visible           = false;
                rptModuleGroup.DataSource = moduleGroupLST.OrderBy(p => p.OrderNum).ToList();
                rptModuleGroup.DataBind();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 生成后台顶部站点地图
        /// </summary>
        /// <param name="aburl"></param>
        /// <returns></returns>
        public static string GenerateTitle(string aburl)
        {
            var res = string.Empty;
            var arr = Regex.Split(aburl, "/_layouts/15", RegexOptions.IgnoreCase);

            if (arr.Length >= 2)
            {
                var url = arr[1];

                var module = new DZAFCPortal.Authorization.DAL.ModuleService().GenericService.FirstOrDefault(m => m.Url.Contains(url));

                if (module != null)
                {
                    res = module.Name;
                }
            }
            return(res);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 生成后台顶部站点地图
        /// </summary>
        /// <param name="aburl"></param>
        /// <returns></returns>
        public static string GenerateTitle(string aburl)
        {
            //var abpath = Request.Url.AbsolutePath;
            var res = string.Empty;
            var arr = Regex.Split(aburl, "/_layouts/15/NYAdmin", RegexOptions.IgnoreCase);
            var url = arr.Length >= 2 ? arr[1] : arr[0];

            var temp   = "{0} &gt; {1}";
            var module = new DZAFCPortal.Authorization.DAL.ModuleService().GenericService.FirstOrDefault(m => m.Url.Contains(url));

            if (module != null)
            {
                var mg = new DZAFCPortal.Authorization.DAL.ModuleGroupService().GenericService.GetModel(module.ModuleGroup_ID);
                res = string.Format(temp, mg.Name, module.Name);
            }

            return(res);
        }