示例#1
0
文件: RoleList.ashx.cs 项目: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            StringBuilder sbWhere   = new StringBuilder();
            int           pageIndex = Convert.ToInt32(context.Request["page"]);
            int           pageSize  = Convert.ToInt32(context.Request["rows"]);
            string        keyWord   = context.Request["searchReq"];

            List <BLLPermission.Model.PermissionGroupInfo> list = bllPms.GetGroupList(pageSize, pageIndex, keyWord, bllPms.WebsiteOwner, null, 2);

            list.AddRange(bllPms.GetGroupList(pageSize, pageIndex, keyWord, "common", null, 3));
            list.AddRange(bllPms.GetGroupList(pageSize, pageIndex, keyWord, "common", null, 4));
            List <BLLPermission.Model.PermissionGroupInfo> dataList = new List <BLLPermission.Model.PermissionGroupInfo>();

            if (currentUserInfo.UserType != 1 && currentUserInfo.UserID != bllPms.WebsiteOwner)
            {
                List <BLLPermission.Model.PermissionGroupInfo> groupList = bllPms.GetUserGroupList(currentUserInfo.UserID, bllPms.WebsiteOwner, 2);
                if (groupList.Count > 0)
                {
                    foreach (BLLPermission.Model.PermissionGroupInfo item in groupList)
                    {
                        if (dataList.FirstOrDefault(p => p.GroupID == item.GroupID) != null)
                        {
                            continue;
                        }
                        bllPms.GetDataList(ref dataList, list, item.GroupID, 1, 9);
                    }
                }
            }
            else
            {
                bllPms.GetDataList(ref dataList, list, 0, 1, 9);
            }
            int total = dataList.Count;

            if (dataList.Count > pageSize)
            {
                dataList = dataList.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList();
            }
            var data = new
            {
                total = total,
                rows  = dataList//列表
            };

            bllPms.ContextResponse(context, data);
        }