public JsonResult GetList(ApplyPosSearchCondition condition) { string deviceId = condition.DeviceId.ToSearchString(); string userName = condition.UserName.ToSearchString(); var list = (from mp in CurrentDb.SalesmanApplyPosRecord join p in CurrentDb.PosMachine on mp.PosMachineId equals p.Id join m in CurrentDb.Merchant on mp.MerchantId equals m.Id join u in CurrentDb.SysSalesmanUser on mp.SalesmanId equals u.Id where (deviceId.Length == 0 || p.DeviceId.Contains(deviceId)) && (userName.Length == 0 || m.ClientCode.Contains(userName)) select new { m.ClientCode, m.YYZZ_Name, p.Id, p.DeviceId, u.FullName, mp.CreateTime }); int total = list.Count(); int pageIndex = condition.PageIndex; int pageSize = 10; list = list.OrderByDescending(r => r.CreateTime).Skip(pageSize * (pageIndex)).Take(pageSize); PageEntity pageEntity = new PageEntity { PageSize = pageSize, TotalRecord = total, Rows = list }; return(Json(ResultType.Success, pageEntity, "")); }
public CustomJsonResult GetList(ApplyPosSearchCondition condition) { string deviceId = condition.DeviceId.ToSearchString(); string userName = condition.UserName.ToSearchString(); var list = (from p in CurrentDb.SalesmanApplyPosRecord where (deviceId.Length == 0 || p.PosMachineDeviceId.Contains(deviceId)) select new { p.Id, p.PosMachineDeviceId, p.AgentName, p.SalesmanName, p.CreateTime }); int total = list.Count(); int pageIndex = condition.PageIndex; int pageSize = 10; list = list.OrderByDescending(r => r.CreateTime).Skip(pageSize * (pageIndex)).Take(pageSize); PageEntity pageEntity = new PageEntity { PageSize = pageSize, TotalRecord = total, Rows = list }; return(Json(ResultType.Success, pageEntity, "")); }