public CustomJsonResult GetPosMachineList(Models.Biz.PosMachine.SearchCondition condition) { string[] arrNoInDeviceId = condition.NoInDeviceIds == null ? new string[1] { "" } : condition.NoInDeviceIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); string deviceId = condition.DeviceId.ToSearchString(); string userName = condition.UserName.ToSearchString(); var list = (from p in CurrentDb.PosMachine where (deviceId.Length == 0 || p.DeviceId.Contains(deviceId)) && p.SalesmanId == null && !arrNoInDeviceId.Contains(p.DeviceId) && p.AgentId == condition.AgentId select new { p.Id, p.FuselageNumber, p.TerminalNumber, p.CreateTime, p.Version, p.DeviceId, p.AgentId }); 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 GetPosMachineList(Models.Biz.PosMachine.SearchCondition condition) { string fuselageNumber = condition.FuselageNumber.ToSearchString(); string terminalNumber = condition.TerminalNumber.ToSearchString(); var list = (from p in CurrentDb.PosMachine where (fuselageNumber.Length == 0 || p.FuselageNumber.Contains(fuselageNumber)) && (terminalNumber.Length == 0 || p.TerminalNumber.Contains(terminalNumber)) && p.IsUse == false select new { p.Id, p.FuselageNumber, p.TerminalNumber, p.CreateTime, p.Version, p.DeviceId }); 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, "")); }