Beispiel #1
0
        public ActionResult PostList(PosEndPointRequest request)
        {
            var    createRole = _unityContainer.Resolve <ListPosEndPoints>();
            string pageHtml   = string.Empty;
            var    datas      = createRole.AjaxGet(request, out pageHtml);

            return(Json(new { tables = datas, html = pageHtml }));
        }
Beispiel #2
0
        public List <ListPosEndPoint> AjaxGet(PosEndPointRequest request, out string pageHtml)
        {
            pageHtml = string.Empty;
            if (request.PageIndex == null || request.PageIndex <= 0)
            {
                request.PageIndex = 1;
            }
            if (request.PageSize == null || request.PageSize <= 0)
            {
                request.PageSize = 10;
            }
            var      currentUser = SecurityHelper.GetCurrentUser();
            ShopUser shopUser    = currentUser.CurrentUser as ShopUser;

            if (shopUser != null)
            {
                request.ShopId = shopUser.ShopId;
            }
            var _tables = PosEndPointService.New_Query(request);
            var datas   = _tables.ModelList.Select(x => new ListPosEndPoint(x)).ToList();


            var shops = ShopService.Query(new ShopRequest()
            {
                ShopIds = datas.Select(x => x.InnerObject.ShopId).ToArray()
            }).ToList();

            datas.Merge(shops,
                        (p, s) => p.InnerObject.ShopId == s.ShopId,
                        (p, ss) => p.Shop = ss.FirstOrDefault()
                        );



            foreach (var item in datas)
            {
                item.boor += "<a href='#' onclick=OperatorThis('Edit','/PosEndPoint/Edit/" + item.PosEndPointId + "') class='tablelink'>编辑 </a> ";
                if (item.InnerObject.State == UserStates.Normal)
                {
                    item.boor += "<a href='#' onclick=OperatorThis('Suspend','/PosEndPoint/Suspend/" + item.PosEndPointId + "') class='tablelink'>停用 </a> ";
                }
                if (item.InnerObject.State == UserStates.Invalid)
                {
                    item.boor += "<a href='#' onclick=OperatorThis('Resume','/PosEndPoint/Resume/" + item.PosEndPointId + "') class='tablelink'>启用 </a> ";
                }
                item.boor += "<a href='#' onclick=OperatorThis('Delete','/PosEndPoint/Delete/" + item.PosEndPointId + "') class='tablelink'>删除 </a> ";
            }
            if (_tables != null)
            {
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, _tables.TotalCount);
            }
            return(datas);
        }
Beispiel #3
0
        public void Query(out string pageHtml)
        {
            PosEndPointRequest request = new PosEndPointRequest();

            pageHtml         = string.Empty;
            request.NameWith = Name;
            if (State != PosEndPointStates.All)
            {
                request.State = State;
            }
            if (Shop != Globals.All)
            {
                request.ShopId = Shop;
            }
            if (request.PageIndex == null || request.PageIndex <= 0)
            {
                request.PageIndex = 1;
            }
            if (request.PageSize == null || request.PageSize <= 0)
            {
                request.PageSize = 10;
            }
            var      currentUser = SecurityHelper.GetCurrentUser();
            ShopUser shopUser    = currentUser.CurrentUser as ShopUser;

            if (shopUser != null)
            {
                request.ShopId = shopUser.ShopId;
            }

            var _tables = PosEndPointService.New_Query(request);

            List = _tables.ModelList.ToList(this, x => new ListPosEndPoint(x));

            var shops = ShopService.Query(new ShopRequest()
            {
                ShopIds = List.Select(x => x.InnerObject.ShopId).ToArray()
            }).ToList();

            List.Merge(shops,
                       (p, s) => p.InnerObject.ShopId == s.ShopId,
                       (p, ss) => p.Shop = ss.FirstOrDefault()
                       );
            if (_tables != null)
            {
                pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, _tables.TotalCount);
            }
        }