Beispiel #1
0
        public ActionResult GetPageListJson(Pagination pagination, string queryJson)
        {
            var watch    = CommonHelper.TimerStart();
            var data     = new DemoBll().GetEmpList(pagination, queryJson);
            var jsonData = new
            {
                rows     = data,
                total    = pagination.total,
                page     = pagination.page,
                records  = pagination.records,
                costtime = CommonHelper.TimerEnd(watch)
            };

            return(ToJsonResult(jsonData));
        }
Beispiel #2
0
        public ActionResult GetAutocomplete(string query)
        {
            AutocompleteResult tResult = new AutocompleteResult();
            var tempresult             = new DemoBll().GetDepartmentList();
            var temp = (from a in tempresult
                        where a.DepartpmentName.Contains(query)
                        select new AutocompleteEntity
            {
                value = a.DepartpmentName,
                data = a.DepartpmentId
            }).ToList();

            tResult.suggestions = temp;
            tResult.query       = query;
            return(ToJsonResult(tResult));
        }
Beispiel #3
0
        /// <summary>
        /// 获取部门树形列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetDepartmentTreeJson()
        {
            var treeList = new List <TreeEntity>();
            var data     = new DemoBll().GetDepartmentList();

            foreach (var item in data)
            {
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = data.Count(t => t.ParentId == item.DepartpmentId) == 0 ? false : true;
                tree.id          = item.DepartpmentId;
                tree.text        = item.DepartpmentName;
                tree.value       = item.DepartpmentId;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.parentId    = item.ParentId;
                treeList.Add(tree);
            }
            return(Content(treeList.TreeToJson()));
        }
Beispiel #4
0
        /// <summary>
        /// 获取角色列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetRoleJson()
        {
            var data = new DemoBll().GetRoleList();

            return(Content(data.ToJson()));
        }