/// <summary>
        /// 获取部门GridTree的json格式数据
        /// </summary>
        /// <returns></returns>
        public string GetDepartmentGridTree(EasyUIGridRequest gridData)
        {
            int total         = 0;
            var departAllList = base.GetPagedList(gridData.PageNumber, gridData.PageSize, ref total, d => d.isDel == false, d => d.createDate, true).ToList();// GetAllEntitiesByPaging(gridData, out total);
            //List<LigerUITree> listDepart = new List<LigerUITree>();
            //查找所有的一级部门
            var ParentDepart = departAllList.Where(con => con.depPid == 0);
            var listDepart   = ViewModelDeptment.ToListViewModel(departAllList);

            //foreach (var parent in ParentDepart)
            //{
            //    //实体转化
            //    LigerUITree parentItem = LigerUITree.ToEntity(parent);
            //    //获取子级
            //    GetDepartmentChildren(ref parentItem, (List<Sample_Department>)departAllList);
            //    listDepart.Add(parentItem);

            //}
            //grid数据输出
            EasyUIGrid grid = new EasyUIGrid();

            grid.rows  = listDepart;
            grid.total = total;
            return(JsonHelper.ToJson(grid, true));
        }
Exemple #2
0
        /// <summary>
        /// 根据条件获取所有菜单
        /// </summary>
        /// <param name="request">请求条件</param>
        /// <returns></returns>
        public EasyUIGrid GetAllUsers(EasyUIGridRequest request)
        {
            int total = 0;

            return(new EasyUIGrid()
            {
                rows = ViewModelUser.ToListViewModel(GetAllUsers(request, ref total)),
                total = total
            });
        }
        public EasyUIGrid GetPropertyByCategoryIdForGrid(int categoryid, EasyUIGridRequest request)
        {
            int total = 0;

            return(new EasyUIGrid()
            {
                rows = GetPropertyByCIdForGrid(request, categoryid, ref total),
                total = total
            });
        }
        /// <summary>
        /// 获取菜单的按钮信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="Count"></param>
        /// <returns></returns>
        //public IEnumerable<ViewModelMenuButtons> GetMenuButtons(EasyUIGridRequest request, int menuid, ref int Count)
        //{
        //    //string where = FilterHelper.GetFilterTanslate(request.Where);
        //    //string tableName = "mp";
        //    //string innerJoin = "left join fetch  mp.Permission p left join fetch mp.Module m";
        //    //string SortName = "";
        //    //if(!string.IsNullOrEmpty(request.SortName))
        //    //SortName= tableName + "." + request.SortName;
        //    return base.LoadListBy(mp => mp.moduleId == menuid && mp.isDel == false).Select(mb => new ViewModelMenuButtons() { });
        //    //return base.GetDataByPage(tableName, innerJoin, tableName, request.PageNumber, request.PageSize, SortName, request.SortOrder, where, out Count);
        //}
        /// <summary>
        /// 获取菜单的按钮信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public EasyUIGrid GetMenuButtons(EasyUIGridRequest request, int menuid)
        {
            int count = 0;
            var data  = base.LoadListBy(mp => mp.moduleId == menuid && mp.isDel == false).Select(mp => new ViewModelMenuButtons()
            {
                ModulePermissionID = mp.mpId, MenuUrl = mp.Sample_Module.moduleLinkUrl, MenuName = mp.Sample_Module.moduleName, MenuID = mp.Sample_Module.moduleId, MenuNo = mp.Sample_Module.moduleId, IsDeleted = mp.isDel.Value, ButtonName = mp.Sample_Permission.pName, ButtonAction = mp.Sample_Permission.pActionName, ButtonID = mp.Sample_Permission.pId, ButtonIcon = mp.Sample_Permission.pIco, MenuController = mp.Sample_Permission.pControllerName, Description = mp.Sample_Permission.pRemark, ParentID = mp.Sample_Permission.pParentId.Value
            });

            return(new EasyUIGrid()
            {
                rows = data,
                total = count
            });
        }
Exemple #5
0
        public EasyUIGrid GetUserGridMenus(EasyUIGridRequest request, List <int> userMenuId, int parentid)
        {
            int        total = 0;
            EasyUIGrid grid  = new EasyUIGrid();

            if (OperateContext.Current.UserRole.Contains(1))
            {
                grid.rows = ViewModelMenu.ToListViewModel(ModuleManager.GetPagedList(request.PageNumber, request.PageSize, ref total, m => m.isDel == false && m.moduleParentId == parentid, m => m.sort));
            }
            else
            {
                grid.rows = ViewModelMenu.ToListViewModel(ModuleManager.GetPagedList(request.PageNumber, request.PageSize, ref total, m => m.isDel == false && m.moduleParentId == parentid && userMenuId.Contains(m.moduleId), m => m.sort));
            }
            //记录总数
            grid.total = total;
            //返回ui层的菜单
            return(grid);
        }
Exemple #6
0
        /// <summary>
        /// 获取树形的Grid的json数据
        /// </summary>
        /// <param name="gridData"></param>
        /// <returns></returns>
        public EasyUIGrid GetAllLogsToGrid(EasyUIGridRequest gridData)
        {
            string alias = "o";

            string where = FilterHelper.GetFilterTanslate(gridData.Where, "o");
            string sortName = alias + "." + gridData.SortName;
            int    total    = 0;
            IEnumerable <Sample_OperateLog> list     = base.GetPagedList(gridData.PageNumber, gridData.PageSize, ref total, so => true, so => so.createDate, false).ToList();
            List <ViewModelOperateLog>      listLogs = new List <ViewModelOperateLog>();

            foreach (Sample_OperateLog log in list)
            {
                listLogs.Add(ViewModelOperateLog.ToViewModel(log));
            }
            EasyUIGrid grid = new EasyUIGrid();

            grid.rows  = listLogs;
            grid.total = total;
            return(grid);
        }
Exemple #7
0
        public IEnumerable <supplier> GetAllSuppliers(EasyUIGridRequest request, ref int Count)
        {
            var      predicate = PredicateBuilder.True <supplier>();
            DateTime time      = TypeParser.ToDateTime("1975-1-1");

            if (!string.IsNullOrEmpty(request.Where) && request.Where.Contains("searchmsg"))
            {
                var i = FilterHelper.GetParaValue("searchmsg", request.Where, "&*&");
                predicate = predicate.And(s => s.suppliername.Contains(i) || s.supplier_user.Contains(s.supplier_user.Where(su => su.username.Contains(i)).FirstOrDefault()) || s.supplier_user.Contains(s.supplier_user.Where(su => su.email.Contains(i)).FirstOrDefault()));
            }
            else if (!string.IsNullOrEmpty(request.Search))
            {
                var i = request.Search;
                if (i.ToLower().Contains("#region#"))
                {
                    var regionids = new List <int>();
                    var region    = SampleUI.Helper.OperateContext.Current.BLLSession.IRegionManager.Get(r => r.regionname == i.ToLower().Replace("#region#", "").Trim());
                    if (region != null && region.parentid == 0)
                    {
                        regionids = SampleUI.Helper.OperateContext.Current.BLLSession.IRegionManager.LoadListBy(r => r.parentid == region.regionid).Select(r => r.regionid).ToList();
                    }
                    else if (region != null && region.parentid != 0)
                    {
                        regionids.Add(region.regionid);
                    }

                    predicate = predicate.And(s => regionids.Contains(s.city));
                }
                else
                {
                    predicate = predicate.And(s => s.suppliername.Contains(i) || s.supplier_user.Contains(s.supplier_user.Where(su => su.username.Contains(i)).FirstOrDefault()) || s.supplier_user.Contains(s.supplier_user.Where(su => su.email.Contains(i)).FirstOrDefault()));
                }
            }

            if (!string.IsNullOrEmpty(request.Where) && request.Where.Contains("check"))
            {
                var i = TypeParser.ToInt32(FilterHelper.GetParaValue("check", request.Where, "&*&"));
                predicate = predicate.And(s => s.ischeck == i);
            }
            return(base.GetPagedList(request.PageNumber, request.PageSize, ref Count, predicate, s => s.createdate, false));
        }
Exemple #8
0
 /// <summary>
 /// 根据条件获取所有用户
 /// </summary>
 /// <param name="request">请求条件</param>
 /// <param name="Count">记录总数</param>
 /// <returns></returns>
 public IEnumerable <Sample_UserInfo> GetAllUsers(EasyUIGridRequest request, ref int Count)
 {
     return(base.GetPagedList(request.PageNumber, request.PageSize, ref Count, u => true, u => u.createDate, false).ToList());
 }
Exemple #9
0
 public IEnumerable <Sample_Role> GetAllRoles(EasyUIGridRequest request, ref int Count)
 {
     return(base.GetPagedList(request.PageNumber, request.PageSize, ref Count, r => true, r => r.sort, true));
     // throw new NotImplementedException();
 }
 public IEnumerable <ProductPropertySetup> GetPropertyByCIdForGrid(EasyUIGridRequest request, int categoryid, ref int Count)
 {
     return(base.GetPagedList(request.PageNumber, request.PageSize, ref Count, r => r.forderId == categoryid, r => r.orderNum));
 }
 public IEnumerable <supplier_user> GetAllSupplierUsers(EasyUIGridRequest request, ref int Count)
 {
     return(base.GetPagedList(request.PageNumber, request.PageSize, ref Count, su => su.sid == request.ParentId, su => su.createdate, false));
 }