コード例 #1
0
        /// <summary>
        /// 获取角色列表数据
        /// </summary>
        /// <returns></returns>
        public JsonResult GetRoleManageList(DataTableParameter para, string searchValue)
        {
            int total = 0;
            List <RoleManageModel> list = new List <RoleManageModel>();
            var dataList = IdentityDA.GetRoleManageList(out total, para, searchValue);

            if (dataList.Count() > 0)
            {
                for (int index = 0; index < dataList.Count(); index++)
                {
                    RoleManageModel model   = new RoleManageModel();
                    IDENTITY        item    = dataList[index];
                    string          strHtml = "<div class='row'><div class='col-md-8'>{0}</div><div class='col-md-4' style='text-align:right'>{1}</div></div>";

                    string linkAList = "<a class='glyphicon glyphicon-cog configRole' title='配置'  RoleId='" + item.ID + "'></a>";
                    if (Userinfo.LoginName == "admin")
                    {
                        linkAList += "&nbsp;&nbsp;&nbsp;&nbsp;<a class='glyphicon glyphicon-trash deleteRole' title='删除' RoleId='" + item.ID + "'></a>";
                    }
                    strHtml          = string.Format(strHtml, item.KEYED_NAME, linkAList);
                    model.KEYED_NAME = strHtml;
                    model.Id         = item.ID;
                    if (item.DESCRIPTION.Contains(";"))
                    {
                        List <string> listStr = item.DESCRIPTION.Split(';').ToList();
                        if (listStr.Count >= 2)
                        {
                            model.Region = listStr[1];
                        }
                    }
                    //获取成员列表
                    List <IDENTITY> memberList = IdentityDA.GetMemberById(model.Id);
                    foreach (var member in memberList)
                    {
                        model.PersonList = model.PersonList + member.NAME + ";";
                    }
                    list.Add(model);
                }
            }
            return(Json(new
            {
                sEcho = para.sEcho,
                iTotalRecords = total,
                iTotalDisplayRecords = total,
                aaData = list
            }, JsonRequestBehavior.AllowGet));
        }