Ejemplo n.º 1
0
        /// <summary>
        /// 功能:加载模块树
        /// 时间:add by 2015-10-1
        /// key:322123aaabbbcc
        /// </summary>
        /// <returns></returns>
        public ActionResult GetGroupTree(string roleid)
        {
            IList <SysGroupEntity>       orgEntity = groupLogic.LoadAll("", 10000, 1, "GroupID");
            List <JsonTreeCheckBoxModel> nodes     = new List <JsonTreeCheckBoxModel>();

            foreach (var item in orgEntity)
            {
                JsonTreeCheckBoxModel cnode = new JsonTreeCheckBoxModel();
                cnode.id   = item.GroupID;
                cnode.text = item.GroupName;
                if (!string.IsNullOrEmpty(item.ParentID))
                {
                    cnode.pid = item.ParentID;
                }
                else
                {
                    cnode.pid = "";
                }

                int count = rolegroupLogic.Count(" and roleid='" + roleid + "' and groupid='" + item.GroupID + "'");
                if (count > 0)
                {
                    cnode.@checked = true;
                }
                nodes.Add(cnode);
            }
            return(Json(nodes));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取数据
        /// </summary>
        /// <returns></returns>
        public ActionResult GetList(string name, int pageIndex, int pageSize, string sortField, string sortOrder)
        {
            pageIndex = pageIndex + 1;
            string Condition = "";

            if (!string.IsNullOrEmpty(name))
            {
                Condition = " and groupname like '%" + name + "%'";
            }
            if (string.IsNullOrEmpty(sortOrder))
            {
                sortOrder = " GroupId";
            }

            IList <SysGroupEntity>       orgEntity = groupLogic.LoadAll(Condition, pageSize, pageIndex, "");
            IDictionary <string, object> dic       = new Dictionary <string, object>();
            int total = groupLogic.Count(Condition);

            dic.Add("total", total);
            dic.Add("data", orgEntity);
            return(Json(dic));
        }