public void Test() { var pageList = new PagedList <PageListObject>(30); pageList.Add(new PageListObject { Name = "AAA" }); pageList.Add(new PageListObject { Name = "BBB" }); pageList.Add(new PageListObject { Name = "CCC" }); var jsonResult = JsonConvert.SerializeObject(pageList); Console.WriteLine(jsonResult); var deserializeResult = JsonConvert.DeserializeObject <PagedList <PageListObject> >(jsonResult); var serializeAgainjsonResult = JsonConvert.SerializeObject(deserializeResult); Console.WriteLine(serializeAgainjsonResult); }
/// <summary> /// </summary> public PageResult <ViewBankCard> PageTable(object query, AutoBaseModel autoModel) { var userInput = ToQuery <ViewBankCardInput>(); var view = new PagedList <ViewBankCard>(); if (autoModel.Filter == FilterType.Admin) { var temp = new ExpressionQuery <BankCard> { EnablePaging = true, PageIndex = (int)userInput.PageIndex, PageSize = 15 }; if (!userInput.Name.IsNullOrEmpty()) { temp.And(u => u.Name.Contains(userInput.Name)); } if (!userInput.Number.IsNullOrEmpty()) { temp.And(u => u.Number.Contains(userInput.Number)); } var model = Resolve <IBankCardService>().GetPagedList(temp); foreach (var item in model) { var outPut = AutoMapping.SetValue <ViewBankCard>(item); outPut.BankCardTypeName = item.Type.GetDisplayName(); view.Add(outPut); } return(ToPageResult(view)); } if (autoModel.Filter == FilterType.User) { userInput.UserId = autoModel.BasicUser.Id; var model = Resolve <IBankCardService>().GetUserBankCardOutputs(userInput); foreach (var item in model) { var outPut = AutoMapping.SetValue <ViewBankCard>(item); outPut.BankCardTypeName = item.Type.GetDisplayName(); view.Add(outPut); } return(ToPageResult(view)); } throw new ValidException("类型权限不正确"); }
public IPagedList <API.Models.v1.Response.UserResponse> Convert( IPagedList <Domain.Models.User> source, IPagedList <API.Models.v1.Response.UserResponse> destination, ResolutionContext context) { if (source == null) { return(null); } var conversion = new PagedList <API.Models.v1.Response.UserResponse>(); foreach (var user in source) { var response = context.Mapper.Map <API.Models.v1.Response.UserResponse>(user); conversion.Add(response); } conversion.CurrentPage = source.CurrentPage; conversion.TotalPages = source.TotalPages; conversion.PageSize = source.PageSize; conversion.TotalCount = source.TotalCount; return(conversion); }
/// <summary> /// </summary> public PageResult <BankCardOutput> PageTable(object query, AutoBaseModel autoModel) { var List = Resolve <IBankCardService>().GetPageList(query); var result = new PagedList <BankCardOutput>(); if (List.Count > 0) { List.ForEach(p => { var model = new BankCardOutput(); model.Address = p.Address; model.Id = p.Id; model.Name = p.Name; model.BankCardTypeName = p.Type.ToString(); model.Number = p.Number; model.Type = p.Type; result.Add(model); }); result.RecordCount = List.Count; } return(ToPageResult(result)); }
/// <summary> /// 查询跟进信息,根据查询条件 /// </summary> /// <param name="queryDto">查询条件</param> /// <returns></returns> public PagedList <FollowUpInfoDto> Search(FollowUpQueryDto queryDto) { var query = from followUp in db.FollowUpQuery join user in db.UsersQuery on followUp.CreateUserID equals user.Id into a from user in a.DefaultIfEmpty() join userUpdate in db.UsersQuery on followUp.UpdateUserID equals userUpdate.Id into b from userUpdate in b.DefaultIfEmpty() orderby followUp.CreateTime descending select new { followUp, extInfo = new { CreateUserName = user.UserName, UpdateUserName = userUpdate.UserName } }; if (queryDto.FollowUpID > 0) { query = query.Where(x => x.followUp.FollowUpID == queryDto.FollowUpID); } if (app.User?.UserID > 0) { // 通过上下文获取当前用户信息 } var list = query.GetPagedList(queryDto.PageIndex, queryDto.PageSize); var data = new PagedList <FollowUpInfoDto>(list.CurrentPageIndex, list.PageSize, list.TotalItemCount); list.ForEach(item => data.Add(ToDto(item.followUp, item.extInfo))); return(data); }
public PageResult <UserCardSetting> PageTable(object query, AutoBaseModel autoModel) { var model = ToQuery <QueryWhere>(); var userGradeConfig = Resolve <IAutoConfigService>().GetList <UserGradeConfig>(); if (model.Name.IsNotNullOrEmpty()) { userGradeConfig = Resolve <IAutoConfigService>().GetList <UserGradeConfig>(l => l.Name == model.Name); } var result = new PagedList <UserCardSetting>(); var apiService = Resolve <IApiService>(); userGradeConfig.ForEach(u => { var view = AutoMapping.SetValue <UserCardSetting>(u); if (!string.IsNullOrEmpty(u.Icon)) { view.CardImage = apiService.ApiImageUrl(u.Icon); } result.Add(view); }); return(ToPageResult(result)); }
private PagedList <Log> MapLogs(Task <IPagedList <Data.Entities.Log> > logs) { var collection = new PagedList <Log>(); foreach (var log in logs.Result.ToList()) { var result = new Log { Id = log.Id, Message = log.Message, Action = log.Action, Application = log.Application, Callsite = log.Callsite, Controller = log.Controller, Exception = log.Exception, Identity = log.Identity, Level = log.Level, Logged = log.Logged, Logger = log.Logger, Referrer = log.Referrer, Url = log.Url, UserAgent = log.UserAgent }; collection.Add(result); } return(collection.Count == 0 ? null : collection); }
public void BindGrid(int paramPageIndex, int paramPageSize) { //项目名称 string ProjectName = this.txtProjectName.Text.Trim(); int ccSProjectTypeId = this.ccSProjectTypeId.SelectedValue; //是否在运营 int IsEnable = Convert.ToInt32(this.ddIsEnable.SelectedValue.Trim()); //根据 项目名称查询。 var xMProjectList = base.XMProjectService.GetXMProjectList(ProjectName, ccSProjectTypeId, IsEnable); //分页 var xMProjectPageList = new PagedList <XMProject>(xMProjectList, paramPageIndex, paramPageSize, this.Master.GridViewSortField, this.Master.GridViewSortDir.ToString()); if (this.RowEditIndex == -1) { //新增编码行 this.gvXMProjectList.EditIndex = xMProjectPageList.Count(); xMProjectPageList.Add(new XMProject()); } else { this.gvXMProjectList.EditIndex = this.RowEditIndex; } this.Master.BindData(this.gvXMProjectList, xMProjectPageList, paramPageSize + 1); }
/// <summary> /// Find Enties /// </summary> /// <param name="pageIndex">pageIndex</param> /// <param name="pageSize">pageSize</param> /// <returns>Enties</returns> public PagedList<EmployeePayHistoryDto> FindEnties(int? pageIndex, int pageSize) { var entities=entiesrepository.Repository.Find(p => p.EmployeeID!=null, p => p.EmployeeID, pageIndex, pageSize); var listDtos=new PagedList<EmployeePayHistoryDto>() { TotalCount = entities.TotalCount }; entities.ForEach(entity => { listDtos.Add(typeAdapter.ConvertEntitiesToDto(entity)); }); return listDtos; }
/// <summary> /// grid 数据绑定 /// </summary> /// <param name="paramPageIndex"></param> /// <param name="paramPageSize"></param> public void BindGrid(int paramPageIndex, int paramPageSize) { //开始时间 string logStartTime = txtLogStartTime.Value.ToString(); //结束时间 string logEndTime = txtLogEndTime.Value.ToString(); XMNick nick = XMNickService.GetXMNickByID(this.NickID); //平台类型 int PlatformTypeId = 0; List <XMNickAchieveValue> newList; if (nick != null) { PlatformTypeId = nick.PlatformTypeId.Value; var list = base.XMNickAchieveValueService.GetXMNickAchieveValueList(); newList = list.Where(p => p.NickId == this.NickID && (p.DateTime.Date >= DateTime.Parse(logStartTime) && p.DateTime.Date <= DateTime.Parse(logEndTime)) ).ToList(); var pageList = new PagedList <XMNickAchieveValue>(newList, paramPageIndex, paramPageSize, this.Master.GridViewSortField, this.Master.GridViewSortDir.ToString()); if (this.RowEditIndex == -1) { this.gvNickTitle.EditIndex = pageList.Count(); //添加新增行 pageList.Add(new XMNickAchieveValue()); } else { this.gvNickTitle.EditIndex = this.RowEditIndex; } this.Master.BindData(this.gvNickTitle, pageList, paramPageSize + 1); } }
/// <summary> /// Find Enties Async /// </summary> /// <param name="pageIndex">pageIndex</param> /// <param name="pageSize">pageSize</param> /// <returns>Enties</returns> public async Task<PagedList<EmployeePayHistoryDto>> FindEntiesAsync(int? pageIndex, int pageSize) { var entities = await entiesrepository.Repository.FindAsync(p => p.EmployeeID!=null, p => p.EmployeeID, pageIndex, pageSize); var listDtos = new PagedList<EmployeePayHistoryDto>() { TotalCount = entities.TotalCount, PageIndex=pageIndex.Value,PageSize=pageSize }; entities.ForEach(entity => { listDtos.Add(typeAdapter.ConvertEntitiesToDto(entity)); }); return listDtos; }
public PagedList <SPList> ListItemsToReindex(Guid typeId, int batchSize, string[] viewFields = null) { var lists = listDataService.ListsToReindex(typeId, batchSize); var spLists = new PagedList <SPList> { PageSize = lists.PageSize, PageIndex = lists.PageIndex, TotalCount = lists.TotalCount }; foreach (var list in lists) { try { var splist = Get(new ListGetQuery(list.Id, typeId)); if (splist != null) { spLists.Add(splist); } } catch (SPInternalException) { } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the InternalApi.SPListService.ListsToReindex() method for ApplicationTypeId: {1} BatchSize: {2}. The exception message is: {3}", ex.GetType(), typeId, batchSize, ex.Message); SPLog.RoleOperationUnavailable(ex, message); } } return(spLists); }
/// <summary> /// 获取录房、合作房源列表 /// </summary> /// <param name="queryDto"></param> /// <returns></returns> public PagedList <HouseListDto> Search(HouseQueryDto queryDto) { //var query = db.ChineseHouseNewQuery.Where(x => x.ShopId == app.User.ShopId && x.CreatedBy == queryDto.UserId && x.HouseSource > 0); var query = db.ChineseHouseNewQuery.Where(x => x.CreatedBy == queryDto.UserId && x.HouseSource > 0); if (queryDto.StatItemType == Dto.Report.StatItemTypeEnum.InputHouse) { query = query.Where(x => x.CreatedDate >= queryDto.DateS && x.CreatedDate <= queryDto.DateE); } else { query = query.Where(x => x.CreatedDate >= queryDto.DateS && x.CreatedDate <= queryDto.DateE); } var list = query.GetPagedList(queryDto.PageIndex, queryDto.PageSize); var data = new PagedList <HouseListDto>(list.CurrentPageIndex, list.PageSize, list.TotalItemCount); var userInfoList = db.CurrentCorpUserInfoList; list.ForEach(item => { var dto = ToDto(item, null); data.Add(dto); }); return(data); }
public virtual IList <LM> GetListModel <LM, QM>(QM model = null) where LM : BaseListModel, new() where QM : BaseQueryModel, new() { if (model == null) { model = new QM(); } model.IsNotTracking = true; var orgList = GetList(model) as PagedList <E>; if (orgList.Count > 0) { var list = new PagedList <LM>(new List <LM>(), model.PageIndex, model.PageSize, orgList.TotalItemCount); //Parallel.ForEach(orgList, (m, state) => //{ // list.Add(EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<E, LM>().Map(m)); //}); //foreach (var m in orgList) //{ // list.Add(EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper<E, LM>().Map(m)); //} orgList.ForEach(m => list.Add(EmitMapper.ObjectMapperManager.DefaultInstance.GetMapper <E, LM>().Map(m))); list.CurrentPageIndex = orgList.CurrentPageIndex; return(list as IList <LM>); } return(new PagedList <LM>(new List <LM>(), 0, 0) as IList <LM>); }
void dansearch_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e) { //有错误 if (e.Error != null) { MessageBox.Show(e.Error.Message); } else { //把数据转换成JSON JsonArray items = JsonValue.Parse(e.Result) as JsonArray; daninfos.ItemsSource = list; if (list.Size != 0) { list.Clear(); } foreach (JsonObject json in items) { GeneralObject go = new GeneralObject(); try { go.EntityType = "t_handplan"; string f_userid = (string)json["f_userid"]; //表具编号 go.SetPropertyValue("f_userid", f_userid, false); string f_userinfoid = (string)json["f_userinfoid"]; //用户编号 go.SetPropertyValue("f_userinfoid", f_userinfoid, false); string f_handid = (string)json["f_handid"]; //抄表编号 go.SetPropertyValue("f_handid", f_handid, false); string f_meternumber = (string)json["f_meternumber"]; //表钢印号 go.SetPropertyValue("f_meternumber", f_meternumber, false); int id = (int)json["id"]; //抄表记录id go.SetPropertyValue("id", id, false); string f_stairtype = (string)json["f_stairtype"]; //阶梯类型 go.SetPropertyValue("f_stairtype", f_stairtype, false); string f_extrawaterprice = (string)json["f_extrawaterprice"]; //混合用水差价 go.SetPropertyValue("f_extrawaterprice", f_extrawaterprice, false); string f_username = (string)json["f_username"]; //用户名 go.SetPropertyValue("f_username", f_username, false); string f_address = (string)json["f_address"]; //地址 go.SetPropertyValue("f_address", f_address, false); decimal lastinputgasnum = (decimal)json["lastinputgasnum"]; //上期指数 go.SetPropertyValue("lastinputgasnum", lastinputgasnum, false); list.Add(go); } catch (Exception ex) { ui_handBusy.IsBusy = false; MessageBox.Show("用户:" + go.GetPropertyValue("f_userid") + "抄表数据有问题,请核查!"); MessageBox.Show(ex.ToString() + "" + go.GetPropertyValue("f_userid")); return; } } } ui_handBusy.IsBusy = false; }
public virtual async Task <CustomerAddressListModel> PrepareCompanyCustomerAddressListModelAsync(CustomerAddressSearchModel searchModel, Company company) { if (searchModel == null) { throw new ArgumentNullException(nameof(searchModel)); } if (company == null) { throw new ArgumentNullException(nameof(company)); } var model = new CustomerAddressListModel(); var getCompanyCustomers = await _companyService.GetCompanyCustomersByCompanyIdAsync(company.Id); IPagedList <Address> addressesList = new PagedList <Address>(new List <Address>(), 0, 1); foreach (var getCompanyCustomer in getCompanyCustomers) { var customer = await _customerService.GetCustomerByIdAsync(getCompanyCustomer.CustomerId); //get customer addresses var addresses = (await _customerService.GetAddressesByCustomerIdAsync(customer.Id)) .OrderByDescending(address => address.CreatedOnUtc).ThenByDescending(address => address.Id).ToList() .ToPagedList(searchModel); foreach (var address in addresses) { if (!addressesList.Where(x => x.Id == address.Id).Any()) { addressesList.Add(address); } } searchModel.CustomerId = customer.Id; } //prepare list model model = await new CustomerAddressListModel().PrepareToGridAsync(searchModel, addressesList, () => { return(addressesList.SelectAwait(async address => { //fill in model values from the entity var addressModel = address.ToModel <AddressModel>(); var customerAddressMapping = await _customerService.GetCustomerAddressesByAddressIdAsync(address.Id); addressModel.CustomerId = customerAddressMapping.Any() ? customerAddressMapping.FirstOrDefault().CustomerId : 0; addressModel.CountryName = (await _countryService.GetCountryByAddressAsync(address))?.Name; addressModel.StateProvinceName = (await _stateProvinceService.GetStateProvinceByAddressAsync(address))?.Name; //fill in additional values (not existing in the entity) await PrepareModelAddressHtmlAsync(addressModel, address); return addressModel; })); }); return(model); }
public void BindGrid(int paramPageIndex, int paramPageSize) { var list = base.ProvinceWarehouseSpareService.GetProvinceWarehouseSpareByProvinceWarehouseID(Id); var pageList = new PagedList <ProvinceWarehouseSpare>(list, paramPageIndex, paramPageSize, this.Master.GridViewSortField, this.Master.GridViewSortDir.ToString()); this.grdvClients.EditIndex = pageList.Count(); pageList.Add(new ProvinceWarehouseSpare()); this.Master.BindData(this.grdvClients, pageList); }
public void BindGrid(int paramPageIndex, int paramPageSize) { var productionOrderDetails = base.XMProductionOrderDetailsService.GetXMProductionOrderDetailsListByProductionOrderID(this.XMProductionOrderID); var pageList = new PagedList <XMProductionOrderDetails>(productionOrderDetails, paramPageIndex, paramPageSize, this.Master.GridViewSortField, this.Master.GridViewSortDir.ToString()); ////新增编码行 this.grdvClients.EditIndex = pageList.Count(); pageList.Add(new XMProductionOrderDetails()); this.Master.BindData(this.grdvClients, pageList); }
public PageResult <WithdrawAutoForm> PageTable(object query, AutoBaseModel autoModel) { var userInput = ToQuery <WithDrawApiInput>(); if (autoModel.Filter == FilterType.Admin) { var dic = HttpWeb.HttpContext.ToDictionary(); dic = dic.RemoveKey("WithdrawAdminAutoForm"); // 移除该type否则无法正常lambda var model = Resolve <IWithdrawService>().GetAdminPageList(dic.ToJson()); var view = new PagedList <WithdrawAutoForm>(); foreach (var item in model) { var outPut = AutoMapping.SetValue <WithdrawAutoForm>(item); view.Add(outPut); } return(ToPageResult(view)); } if (autoModel.Filter == FilterType.User) { //userInput.UserId = autoModel.BasicUser.Id; //userInput.LoginUserId = autoModel.BasicUser.Id; //var model = Resolve<IWithdrawService>().GetUserList(userInput); //var money = Resolve<IAutoConfigService>().GetList<Domain.CallBacks.MoneyTypeConfig>(); //var view = new PagedList<WithdrawAutoForm>(); //foreach (var item in model) { // var outPut = new WithdrawAutoForm { // //提现单号 // //Serial = item.Serial, // //状态 // Status = item.Status, // Amount = item.Amount, // BankCardId = item.TradeExtension.WithDraw.BankCard.Id.ToString(), // MoneyTypeId = item.MoneyTypeId, // //MoneyTypeName = money.Find(s => s.Id == item.MoneyTypeId)?.Name, // UserRemark = item.TradeExtension.TradeRemark.UserRemark, // UserId = item.UserId, // //BankName = $"{item.TradeExtension.WithDraw.BankCard.Type.GetDisplayName()}({item.TradeExtension.WithDraw.BankCard.Address})", // //BankCardNumber = $"{item.TradeExtension.WithDraw.BankCard.Number}({item.TradeExtension.WithDraw.BankCard.Name})", // CreateTime = item.CreateTime // };// AutoMapping.SetValue<WithdrawAutoForm>(item); // view.Add(outPut); //} //return ToPageResult(view); } else { throw new ValidException("类型权限不正确"); } return(null); }
public async Task <IActionResult> SearchAccounts([FromQuery] AccountParams accountParams) { try { var accounts = await accountManager.SearchAccounts(accountParams); if (accounts == null) { return(NotFound("Not Found!")); } PagedList <AccountToReturnDTO> accountToReturns = new PagedList <AccountToReturnDTO>(); foreach (var acc in accounts) { var contacts = acc.Contacts; List <ContactReturnDTO> contactsToReturn = new List <ContactReturnDTO>(); foreach (var c in contacts) { ContactReturnDTO contact = new ContactReturnDTO() { ContactId = c.ContactId, FirstName = c.FirstName, MiddleName = c.MiddleName, LastName = c.LastName, NameTitle = c.NameTitle, SelectedAddressId = c.SelectedAddressId, AccountId = c.AccountId.Value, Notes = c.Notes }; contactsToReturn.Add(contact); } AccountToReturnDTO accountsToReturn = new AccountToReturnDTO { AccountId = acc.AccountId, OrganizationName = acc.OrganizationName, AccountType = acc.AccountType.Name, Description = acc.Description, CreatedAt = acc.CreatedAt, UpdatedAt = acc.UpdatedAt, Contacts = contactsToReturn }; accountToReturns.Add(accountsToReturn); } Response.AddPagination(accountToReturns.CurrentPage, accountToReturns.PageSize, accountToReturns.TotalCount, accountToReturns.TotalPages); return(Ok(accountToReturns)); } catch (Exception) { throw; } }
/// <summary> /// 从IDataReader读取所有数据 /// </summary> /// <param name="reader"></param> /// <returns>数据集合</returns> protected virtual IPagedList <T> GetListFromReader(IDataReader reader) { IPagedList <T> list = new PagedList <T>(); while (reader.Read()) { list.Add(GetFromReader(reader)); } reader.Close(); //调用了 close 才可以读出 output 或 returnvalue的值 return(list); }
private IPagedList <Model> GetData() { var res = new PagedList <Model>(); res.TotalPages = 50; res.TotalCount = 908945; res.Add(new Model { MyProperty = "Hello World" }); return(res); }
/// <summary> /// Find Enties /// </summary> /// <param name="pageIndex">pageIndex</param> /// <param name="pageSize">pageSize</param> /// <returns>Enties</returns> public PagedList <EmployeePayHistoryDto> FindEnties(int?pageIndex, int pageSize) { var entities = entiesrepository.Repository.Find(p => p.EmployeeID != null, p => p.EmployeeID, pageIndex, pageSize); var listDtos = new PagedList <EmployeePayHistoryDto>() { TotalCount = entities.TotalCount }; entities.ForEach(entity => { listDtos.Add(typeAdapter.ConvertEntitiesToDto(entity)); }); return(listDtos); }
/// <summary> /// Find Enties Async /// </summary> /// <param name="pageIndex">pageIndex</param> /// <param name="pageSize">pageSize</param> /// <returns>Enties</returns> public async Task <PagedList <EmployeePayHistoryDto> > FindEntiesAsync(int?pageIndex, int pageSize) { var entities = await entiesrepository.Repository.FindAsync(p => p.EmployeeID != null, p => p.EmployeeID, pageIndex, pageSize); var listDtos = new PagedList <EmployeePayHistoryDto>() { TotalCount = entities.TotalCount, PageIndex = pageIndex.Value, PageSize = pageSize }; entities.ForEach(entity => { listDtos.Add(typeAdapter.ConvertEntitiesToDto(entity)); }); return(listDtos); }
public void AddItemsAndClear_PageSize4096() { const int length = 64 * 1024; var list = new PagedList <int>(pageSize: 4096); for (int i = 0; i < length; i++) { list.Add(i); } Assert.Equal(length, list.Count); }
public PagedList <BankCardOutput> GetPageList(object query) { var model = Resolve <IBankCardService>().GetPagedList(query); var result = new PagedList <BankCardOutput>(); foreach (var item in model) { var temp = AutoMapping.SetValue <BankCardOutput>(item); result.Add(temp); } return(result); }
public void Test() { var pageList = new PagedList <PageListObject>(30); pageList.Add(new PageListObject { Name = "AAA" }); pageList.Add(new PageListObject { Name = "BBB" }); pageList.Add(new PageListObject { Name = "CCC" }); var pageList2 = new PagedList <PageListObject>(30); pageList2.Add(new PageListObject { Name = "DDD" }); pageList2.Add(new PageListObject { Name = "EEE" }); pageList2.Add(new PageListObject { Name = "FFF" }); pageList.CombinePageData(pageList2); var jsonResult = JsonConvert.SerializeObject(pageList); Console.WriteLine(jsonResult); }
public void AddItemsAndVerifyContains() { const int length = 4 * 1024; var list = new PagedList <int>(); for (int i = 0; i < length; i++) { list.Add(i); Assert.True(list.Contains(i)); } Assert.Equal(length, list.Count); }
/// <summary> /// 来电 /// </summary> /// <param name="queryDto"></param> /// <returns></returns> private PagedList <ContactListDto> SearchByInCall(ContactQueryDto queryDto) { var userQuery = db.GetUserQuery(); var query = from contact in db.MlsContactRecordLogQuery join housenew in db.ChineseHouseNewQuery on contact.ResourcesId equals housenew.Id into h from housenew in h.DefaultIfEmpty() join communities in db.ChineseCommunitiesQuery on housenew.CommunityId equals communities.Id into c from communities in c.DefaultIfEmpty() join user in userQuery on contact.UserId equals user.UserId into aa from user in aa.DefaultIfEmpty() where (contact.CreateTime >= queryDto.DateS && contact.CreateTime <= queryDto.DateE) //&& contact.HouseSourceType == 2 && user.ShopId > 0 orderby contact.CreateTime descending select new { contact, user, extInfo = new { housenew.HouseNewId, housenew.Areas, housenew.TotalPrice, housenew.CommissionPartner, housenew.CommissionPartnerType, housenew.CommissionPartnerPercent, housenew.BedRoomsCount, housenew.TingRoomsCount, housenew.BathRoomsCount, housenew.HouseSource, housenew.RentPrice, MainPhotoUrl = housenew.MainPhoto, IsMls = housenew.ShareToFdb == 2, CommunityName = communities.Name, communities.CityName, communities.AreaName } }; var phoneNumber = db.CurrentCorpUserList.FirstOrDefault(x => x.UserId == queryDto.UserId)?.PhoneNumber; query = query.Where(x => x.contact.Contacter == phoneNumber); var list = query.GetPagedList(queryDto.PageIndex, queryDto.PageSize); var data = new PagedList <ContactListDto>(list.CurrentPageIndex, list.PageSize, list.TotalItemCount); var userInfoList = db.CurrentCorpUserInfoList; list.ForEach(item => data.Add(ToDto(item.contact, item.user, item.extInfo))); return(data); }
public void BindGrid(int paramPageIndex, int paramPageSize) { List <XMOrderInfoProductDetails> list = new List <XMOrderInfoProductDetails>(); var OrderInfo = base.XMOrderInfoService.GetXMOrderInfoByOrderCode(OrderCode); if (OrderInfo != null) { var OrderProductDetails = base.XMOrderInfoProductDetailsService.GetXMOrderInfoProductDetailsList(OrderInfo.ID); //if (OrderInfo.PlatformTypeId == 259)//判断是否唯品会订单,排除非CM开头的产品 //{ // if (OrderProductDetails.Count > 0) // { // foreach (XMOrderInfoProductDetails item in OrderProductDetails) // { // if (item.PlatformMerchantCode.Length > 2) // { // var ddh = item.PlatformMerchantCode.Substring(0, 2); // if (ddh == "CM") // { // list.Add(item); // } // } // else // { // list.Add(item); // } // } // } // else // { // list = OrderProductDetails; // } //} //else //{ foreach (XMOrderInfoProductDetails item in OrderProductDetails) { list.Add(item); } //} } var pageList = new PagedList <XMOrderInfoProductDetails>(list, paramPageIndex, paramPageSize, this.Master.GridViewSortField, this.Master.GridViewSortDir.ToString()); //新增编码行 this.grdvClients.EditIndex = pageList.Count(); pageList.Add(new XMOrderInfoProductDetails()); this.Master.BindData(this.grdvClients, pageList); }
void dansearch_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { //有错误 if (e.Error != null) { MessageBox.Show(e.Error.Message); } else { //把数据转换成JSON JsonObject obj = JsonValue.Parse(e.Result) as JsonObject; JsonArray items = obj["rows"] as JsonArray; daninfos.ItemsSource = list; if (list.Size != 0) { list.Clear(); } foreach (JsonObject json in items) { GeneralObject go = new GeneralObject(); try { go.EntityType = "t_"; go.SetPropertyValue("id", json["id"], false); //用户编号 go.SetPropertyValue("remote_key", json["remote_key"], false); //用户编号 go.SetPropertyValue("terminal_code", json["terminal_code"], false); //用户编号 go.SetPropertyValue("meter_code", json["meter_code"], false); //用户编号 go.SetPropertyValue("operate_type", json["operate_type"], false); //用户编号 go.SetPropertyValue("send_data", json["send_data"], false); //用户编号 go.SetPropertyValue("receive_data", json["receive_data"], false); //用户编号 go.SetPropertyValue("state", json["state"], false); //用户编号 go.SetPropertyValue("result", json["result"], false); //用户编号 go.SetPropertyValue("operator1", json["operator"], false); //用户编号 go.SetPropertyValue("des", json["des"], false); //用户编号 go.SetPropertyValue("create_date", json["create_date"], false); //用户编号 go.SetPropertyValue("company_code", json["company_code"], false); //用户编号 go.SetPropertyValue("telecomm_address", json["telecomm_address"], false); //用户编号 go.SetPropertyValue("customer_code", json["customer_code"], false); //用户编号 list.Add(go); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } } } }
public void BindGrid(int paramPageIndex, int paramPageSize) { var logisticList = base.XMLogisticsInfoService.GetXMLogisticsInfoListByOrderInfoID(this.XMOrderInfoID); var logisticPageList = new PagedList <XMLogisticsInfo>(logisticList, paramPageIndex, paramPageSize, this.Master.GridViewSortField, this.Master.GridViewSortDir.ToString()); if (this.RowEditIndex == -1) { this.gvLogistic.EditIndex = logisticPageList.Count(); logisticPageList.Add(new XMLogisticsInfo()); } else { this.gvLogistic.EditIndex = this.RowEditIndex; } this.Master.BindData(this.gvLogistic, logisticPageList, paramPageSize + 1); }
/// <summary> /// Creates a new MangaViewModel /// </summary> /// <param name="manga">Manga</param> /// <param name="item_height"></param> /// <param name="speed"></param> public MangaViewModel(Manga manga, int item_height, decimal speed) { item_height_ = item_height; speed_ = speed; manga_ = manga; slides_ = new PagedList<SlideViewModel>(); int item = 0; foreach (var slide in manga_.Slides) { int page = item / kItemsPerPage; item++; slides_.Add(page, new SlideViewModel(slide, item_height_)); } slides_.Update(0); }
/// <summary> /// Fetch the list of products as configured on the backoffice. Note that this doesn't include any information /// about pricing and so on: the external store plugin is required to do so. /// Note that this call returns the catalog as configured on the CotC server, which may not be exhaustive if /// additional products are configured on iTunes Connect but not reported to the CotC servers. /// </summary> /// <param name="limit">The maximum number of results to return per page.</param> /// <param name="offset">Number of the first result.</param> /// <returns>Promise resolved when the operation has completed. The attached value describes a list of products, /// with pagination functionality.</returns> public Promise<PagedList<ConfiguredProduct>> ListConfiguredProducts(int limit = 30, int offset = 0) { UrlBuilder url = new UrlBuilder("/v1/gamer/store/products").QueryParam("limit", limit).QueryParam("skip", offset); return Common.RunInTask<PagedList<ConfiguredProduct>>(Gamer.MakeHttpRequest(url), (response, task) => { PagedList<ConfiguredProduct> products = new PagedList<ConfiguredProduct>(response.BodyJson, offset, response.BodyJson["count"]); foreach (Bundle b in response.BodyJson["products"].AsArray()) { products.Add(new ConfiguredProduct(b)); } // Handle pagination if (offset > 0) { products.Previous = () => ListConfiguredProducts(limit, offset - limit); } if (offset + products.Count < products.Total) { products.Next = () => ListConfiguredProducts(limit, offset + limit); } task.PostResult(products); }); }
/// <summary> /// Method used to check or retrieve users from Clan of the Cloud community. The domain is not taken /// in account for this search. /// </summary> /// <returns>Task returning the fetched list of users. The list is paginated (see /// #CotcSdk.PagedList<DataType> for more info).</returns> /// <param name="filter">May contain a nickname, a display name or e-mail address.</param> /// <param name="limit">The maximum number of results to return per page.</param> /// <param name="offset">Number of the first result.</param> public Promise<PagedList<UserInfo>> ListUsers(string filter, int limit = 30, int offset = 0) { UrlBuilder url = new UrlBuilder("/v1/gamer").QueryParam("q", filter).QueryParam("limit", limit).QueryParam("skip", offset); HttpRequest req = MakeUnauthenticatedHttpRequest(url); return Common.RunInTask<PagedList<UserInfo>>(req, (response, task) => { PagedList<UserInfo> result = new PagedList<UserInfo>(response.BodyJson, offset, response.BodyJson["count"]); foreach (Bundle u in response.BodyJson["result"].AsArray()) { result.Add(new UserInfo(u)); } // Handle pagination if (offset > 0) { result.Previous = () => ListUsers(filter, limit, offset - limit); } if (offset + result.Count < result.Total) { result.Next = () => ListUsers(filter, limit, offset + limit); } task.PostResult(result); }); }
/// <summary> /// Fetches the history of transactions run for this user. The current balance (resulting values) needs to be queried /// via a different call (Balance). /// </summary> /// <returns>Promise resolved when the operation has completed. The result is paginated, for more information see /// #CotcSdk.PagedList<DataType>.</returns> /// <param name="unit">If specified, retrieves only the transactions matching a given unit (e.g. "gold").</param> /// <param name="limit">For pagination, allows to set a greater or smaller page size than the default 30.</param> /// <param name="offset">For pagination, avoid using it explicitly.</param> public Promise<PagedList<Transaction>> History(string unit = null, int limit = 30, int offset = 0) { UrlBuilder url = new UrlBuilder("/v1/gamer/tx").Path(domain).QueryParam("skip", offset).QueryParam("limit", limit); if (unit != null) url.QueryParam("unit", unit); // Request for current results return Common.RunInTask<PagedList<Transaction>>(Gamer.MakeHttpRequest(url), (response, task) => { PagedList<Transaction> transactions = new PagedList<Transaction>(response.BodyJson, offset, response.BodyJson["count"]); foreach (Bundle b in response.BodyJson["history"].AsArray()) { transactions.Add(new Transaction(b)); } // Handle pagination if (offset > 0) { transactions.Previous = () => History(unit, limit, offset - limit); } if (offset + transactions.Count < transactions.Total) { transactions.Next = () => History(unit, limit, offset + limit); } task.PostResult(transactions); }); }
/// <summary> /// Can be used to list the active matches for this game. In general, it is not recommended to proceed this way /// if your goal is to display the games that may be joined. The indexing API is better suited to this use case /// (index the match along with properties and look for matches matching the desired properties). /// </summary> /// <returns>Promise resolved when the operation has completed. The list of matches filtered according to the /// following parameters is provided.</returns> /// <param name="participating">Set to true to only list matches to which this user is participating.</param> /// <param name="invited">Set to true to filter by matches you are invited to (only include them).</param> /// <param name="finished">Set to true to also include finished matchs (which are filtered out by default).</param> /// <param name="full">Set to true to also include games where the maximum number of players has been reached.</param> /// <param name="limit">For pagination, allows to set a greater or smaller page size than the default 30.</param> /// <param name="offset">For pagination, avoid using it explicitly.</param> public Promise<PagedList<MatchListResult>> List(bool participating = false, bool invited = false, bool finished = false, bool full = false, int limit = 30, int offset = 0) { UrlBuilder url = new UrlBuilder("/v1/gamer/matches"); url.QueryParam("domain", domain).QueryParam("offset", offset).QueryParam("limit", limit); if (participating) url.QueryParam("participating"); if (finished) url.QueryParam("finished"); if (invited) url.QueryParam("invited"); if (full) url.QueryParam("full"); // Request for current results return Common.RunInTask<PagedList<MatchListResult>>(Gamer.MakeHttpRequest(url), (response, task) => { PagedList<MatchListResult> matches = new PagedList<MatchListResult>(response.BodyJson, offset, response.BodyJson["count"]); foreach (Bundle b in response.BodyJson["matches"].AsArray()) { matches.Add(new MatchListResult(b)); } // Handle pagination if (offset > 0) { matches.Previous = () => List(participating, invited, finished, full, limit, offset - limit); } if (offset + matches.Count < matches.Total) { matches.Next = () => List(participating, invited, finished, full, limit, offset + limit); } task.PostResult(matches); }); }
/// <summary>Fetch the score list for a given board.</summary> /// <returns>Promise resolved when the operation has completed. The attached value describes a list of scores, and /// provides pagination functionality.</returns> /// <param name="board">The name of the board to fetch scores from.</param> /// <param name="limit">The maximum number of results to return per page.</param> /// <param name="offset">Number of the first result. Needs to be a multiple of `limit`. The special value of -1 can be used /// to auto-select the page where the current logged in user is located, including his score in the result. After /// that, you may use the paged result handler to fetch pages nearby.</param> public Promise<PagedList<Score>> List(string board, int limit = 30, int offset = 0) { UrlBuilder url = new UrlBuilder("/v2.6/gamer/scores").Path(domain).Path(board).QueryParam("count", limit); if (offset == -1) url.QueryParam("page", "me"); else url.QueryParam("page", offset / limit + 1); return Common.RunInTask<PagedList<Score>>(Gamer.MakeHttpRequest(url), (response, task) => { // Pagination computing Bundle boardData = response.BodyJson[board]; int currentItems = boardData["scores"].AsArray().Count; int total = Math.Min(boardData["maxpage"] * limit, offset + currentItems); // Fetch listed scores PagedList<Score> scores = new PagedList<Score>(response.BodyJson, offset, total); int rank = boardData["rankOfFirst"]; foreach (Bundle b in boardData["scores"].AsArray()) { scores.Add(new Score(b, rank++)); } // Handle pagination if (offset > 0) { scores.Previous = () => List(board, limit, offset - limit); } if (offset + scores.Count < scores.Total) { scores.Next = () => List(board, limit, offset + limit); } task.PostResult(scores); }); }
public void TestFind() { //arrange var mockobject = new Mock<IRepository<Customer>>(); mockobject.Setup(r => r.Add(It.IsAny<Customer>())); var customer = new Customer() { CustomerId = 1 }; mockobject.Setup<IEnumerable<Customer>>(r => r.Find(c => c.CustomerId == customer.CustomerId)) .Returns(new List<Customer>() { customer }); var mockPagedlist = new PagedList<Customer>() { PageSize = 10, PageIndex = 1, TotalCount = 50 }; for (int i = 0; i <= 10; i++) { mockPagedlist.Add(customer); } mockobject.Setup<IEnumerable<Customer>>(r => r.Find<int>(c => c.CustomerId == customer.CustomerId,c=>c.CustomerId,1,10)) .Returns(mockPagedlist); var mockRepository = mockobject.Object; //act var clist = mockRepository.Find(c => c.CustomerId == customer.CustomerId); var cPagedlist = mockRepository.Find<int>(c => c.CustomerId == customer.CustomerId,c=>c.CustomerId,1,10); //assert Assert.NotNull(clist); Assert.True(clist.Count() > 0); Assert.NotNull(cPagedlist); Assert.Equal(10, cPagedlist.PageSize); Assert.Equal(1, cPagedlist.PageIndex); Assert.Equal(50, cPagedlist.TotalCount); }
public IPagedList<ITrack> GetRecentTracks(string username, int? limit, int? page, Timestamp start, Timestamp end) { IApiMethod method = this.CreateApiMethod("user.getRecentTracks"); method.AddParameter("user", username); if (page.HasValue) { method.AddParameter("page", page.ToString()); } if (start != null) { method.AddParameter("from", start.GetUnixTimestamp()); } if (start != null) { method.AddParameter("to", end.GetUnixTimestamp()); } var response = method.Execute(); var tracks = (JArray)response["recenttracks"]["track"]; var attributes = response["recenttracks"]["@attr"]; IPagedList<ITrack> result = new PagedList<ITrack>(); result.Page = attributes.Value<int>("page"); result.PerPage = attributes.Value<int>("perPage"); result.TotalPages = attributes.Value<int>("totalPages"); result.Total = attributes.Value<int>("total"); foreach (var track in tracks) { result.Add(new Track { Url = track.Value<string>("url"), Name = track.Value<string>("name") }); } return result; }
public IPagedList<ProcessInfoDTO> FetchList(string filter, int pageNumber, int pageSize, string filterExpression) { var result = new PagedList<ProcessInfoDTO>(); using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var cn = ctx.Connection; var sql = @" DECLARE @p0 AS INT SET @p0 = {1} DECLARE @p1 AS INT SET @p1 = {2}; SELECT [t1].[Id], [t1].[Name], [t1].[Description], [t1].[Icon], CASE WHEN [t1].PublishedCopyId IS NULL THEN 0 ELSE 1 END AS IsPublished, [t1].[SystemName], [t1].[Guid], [t1].[Color], [t1].IsInactive, [t1].IsSystem, [t1].[Documentation] FROM ( SELECT ROW_NUMBER() OVER(ORDER BY [t0].[Name], [t0].[Id]) AS [ROW_NUMBER], [t0].[Name], [t0].SystemName, [t0].[Guid], [t0].Id, [t0].[Description], [t0].[Documentation], [t0].IsInactive, [t0].IsSystem, [i].Icon, [c].Color, ( SELECT id FROM Processes p WHERE p.Guid = [t0].Guid AND p.IsPublishedCopy = 1 AND p.IsRemoved = 0 ) AS PublishedCopyId FROM [dbo].[Processes] AS [t0] LEFT OUTER JOIN Icons i ON [t0].IconId = [i].Id LEFT OUTER JOIN Colors c ON [t0].ColorId = [c].Id {0} ) AS [t1] WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1 ORDER BY [t1].[ROW_NUMBER] "; var fieldFilterWhere = AdoHelper.BuildFilterStatement(FilterDescriptor.GetFilterList(filterExpression), "Processes", tableAlias: "[t0]"); var globalFilterWhere = AdoHelper.BuildFilterStatement(filter, new[] { "[t0].Name", "[t0].Description" }); var where = string.Format(CultureInfo.InvariantCulture, "WHERE IsRemoved = 0 AND IsPublishedCopy = 0 {0} {1}", globalFilterWhere, fieldFilterWhere); if (pageSize == 0) { pageSize = int.MaxValue; } var commandText = string.Format(CultureInfo.InvariantCulture, sql, where, pageNumber * pageSize, pageSize); using (var cmd = new SqlCommand(commandText, cn)) using (var reader = new SafeDataReader(cmd.ExecuteReader())) { while (reader.Read()) { result.Add( new ProcessInfoDTO { Id = reader.GetInt32(0), Name = reader.GetString(1), Description = reader.GetString(2), Icon = AdoHelper.ReadImage(reader, 3), IsPublished = reader.GetInt32(4) != 0, SystemName = reader.GetString(5), Guid = reader.GetGuid(6), ProcessColor = reader.GetInt64(7), IsInactive = reader.GetBool(8), IsSystem = reader.GetBool(9), ProcessDocumentation = reader.GetString(10), }); } } sql = string.Format(CultureInfo.InvariantCulture, "SELECT TotalRowCount = (SELECT COUNT(t0.Id) FROM Processes [t0] {0}), TotalActiveRowCount = (SELECT COUNT(t0.Id) FROM dbo.Processes t0 {0} AND t0.IsInactive = 0 AND t0.SimpleProcess = 0)", where); using (var cmd = new SqlCommand(sql, cn)) using (var reader = new SafeDataReader(cmd.ExecuteReader())) { if (reader.Read()) { result.TotalRowCount = reader.GetInt32(0); result.TotalActiveRowCount = reader.GetInt32(1); } } } return result; }
public IPagedList<PublishedProcessInfoDTO> FetchAvailablePublishedProcesses(string filter, int pageNumber, int pageSize, string filterExpression, bool isAdmin, IEnumerable<int> personRoles) { var result = new PagedList<PublishedProcessInfoDTO>(); var roles = new List<int> { Constants.AllRolesId }; if (personRoles != null) { roles.AddRange(personRoles); } var rolesString = string.Join(",", roles.Select(r => r.ToString(CultureInfo.InvariantCulture))); var adminFilter = string.Format( CultureInfo.InvariantCulture, @"WHERE ISNULL(p.[IsRemoved], 0) = 0 AND ISNULL(p.IsInactive, 0) = 0"); const string NonAdminFilterFormat = @" WHERE ( EXISTS ( SELECT nisc.[Id] FROM [dbo].[NavigationItemSecurityConfigurations] nisc WHERE nisc.[NavigationItemId] = ni.Id AND nisc.[CanView] = 1 AND nisc.[RoleId] IN ({0}) ) AND ISNULL(p.[IsRemoved], 0) = 0 AND ISNULL(p.IsInactive, 0) = 0 ) OR ng.[SystemName] = '{1}' "; var nonAdminFilter = string.Format( CultureInfo.InvariantCulture, NonAdminFilterFormat, rolesString, Constants.AdminMenu); var whereString = isAdmin ? adminFilter : nonAdminFilter; const string IdsQueryFormat = @" SELECT pp.[ProcessId] FROM [dbo].[NavigationGroups] ng INNER JOIN [dbo].[NavigationItems] ni ON ng.[Id] = ni.[NavigationGroupId] INNER JOIN [dbo].[PublishedProcesses] pp ON pp.[Id] = ni.[PublishedProcessId] INNER JOIN [dbo].[Processes] p ON p.[Id] = pp.[ProcessId] {0}"; var idsQuery = string.Format( CultureInfo.InvariantCulture, IdsQueryFormat, whereString); using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var cn = ctx.Connection; const string Sql = @" DECLARE @p0 AS INT SET @p0 = {1} DECLARE @p1 AS INT SET @p1 = {2}; SELECT [t1].[Id], [t1].[Name], [t1].[SystemName], [t1].[IconId], [t1].[Guid] FROM ( SELECT ROW_NUMBER() OVER(ORDER BY [t0].[Name], [t0].[Id]) AS [ROW_NUMBER], ISNULL(pl.ProcessName,[t0].[Name]) AS [Name], [t0].SystemName, [t0].[Guid], [t0].Id, [i].Id as IconId FROM [dbo].[Processes] AS [t0] JOIN [dbo].PublishedProcesses AS [t1] ON [t1].ProcessId = [t0].Id INNER JOIN Processes p2 ON [t0].Guid = p2.Guid AND p2.IsPublishedCopy = 0 LEFT OUTER JOIN Icons i ON [t0].IconId = [i].Id LEFT OUTER JOIN Colors c ON [t0].ColorId = [c].Id LEFT OUTER JOIN dbo.Localizations l ON l.CultureName = '{3}' LEFT OUTER JOIN dbo.ProcessLocalizations pl ON pl.LocalizationId = l.Id AND p2.Id = pl.ProcessId {0} ) AS [t1] WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1 ORDER BY [t1].[ROW_NUMBER] "; var fieldFilterWhere = AdoHelper.BuildFilterStatement(FilterDescriptor.GetFilterList(filterExpression), "Processes", tableAlias: "[t0]"); var globalFilterWhere = AdoHelper.BuildFilterStatement(filter, new[] { "[t0].Name" }); var where = string.Format(CultureInfo.InvariantCulture, "WHERE [t0].IsRemoved = 0 {0} {1} AND [t1].[ProcessId] IN ({2})", globalFilterWhere, fieldFilterWhere, idsQuery); if (pageSize == 0) { pageSize = int.MaxValue; } var commandText = string.Format(CultureInfo.InvariantCulture, Sql, where, pageNumber * pageSize, pageSize, System.Threading.Thread.CurrentThread.CurrentUICulture.Name); using (var cmd = new SqlCommand(commandText, cn)) { using (var reader = new SafeDataReader(cmd.ExecuteReader())) { while (reader.Read()) { result.Add( new PublishedProcessInfoDTO { ProcessId = reader.GetInt32(0), Name = reader.GetString(1), SystemName = reader.GetString(2), IconId = reader.GetInt32(3), ProcessGuid = reader.GetGuid(4), }); } } } commandText = string.Format( CultureInfo.InvariantCulture, "SELECT COUNT([t0].Id) FROM Processes [t0] JOIN [dbo].PublishedProcesses AS [t1] ON [t1].ProcessId = [t0].Id {0}", where); using (var cmdCount = new SqlCommand(commandText, cn)) { result.TotalRowCount = (int)cmdCount.ExecuteScalar(); } } return result; }
public IPagedList<PublishedProcessInfoDTO> FetchPublishedProcesses(string filter, int pageNumber, int pageSize, string filterExpression) { var result = new PagedList<PublishedProcessInfoDTO>(); using (var ctx = ConnectionManager<SqlConnection>.GetManager(Database.VeyronMeta, false)) { var cn = ctx.Connection; const string Sql = @" DECLARE @p0 AS INT SET @p0 = {1} DECLARE @p1 AS INT SET @p1 = {2}; SELECT [t1].[Id], [t1].[Name], [t1].[SystemName], [t1].[IconId], [t1].[Guid] FROM ( SELECT ROW_NUMBER() OVER(ORDER BY [t0].[Name], [t0].[Id]) AS [ROW_NUMBER], [t0].[Name], [t0].SystemName, [t0].[Guid], [t0].Id, [i].Id as IconId FROM [dbo].[Processes] AS [t0] JOIN [dbo].PublishedProcesses AS [t1] ON [t1].ProcessId = [t0].Id LEFT OUTER JOIN Icons i ON [t0].IconId = [i].Id LEFT OUTER JOIN Colors c ON [t0].ColorId = [c].Id {0} ) AS [t1] WHERE [t1].[ROW_NUMBER] BETWEEN @p0 + 1 AND @p0 + @p1 ORDER BY [t1].[ROW_NUMBER] "; var fieldFilterWhere = AdoHelper.BuildFilterStatement(FilterDescriptor.GetFilterList(filterExpression), "Processes", tableAlias: "[t0]"); var globalFilterWhere = AdoHelper.BuildFilterStatement(filter, new[] { "[t0].Name" }); var where = string.Format(CultureInfo.InvariantCulture, "WHERE IsRemoved = 0 {0} {1}", globalFilterWhere, fieldFilterWhere); if (pageSize == 0) { pageSize = int.MaxValue; } var commandText = string.Format(CultureInfo.InvariantCulture, Sql, where, pageNumber * pageSize, pageSize); using (var cmd = new SqlCommand(commandText, cn)) { using (var reader = new SafeDataReader(cmd.ExecuteReader())) { while (reader.Read()) { result.Add( new PublishedProcessInfoDTO { ProcessId = reader.GetInt32(0), Name = reader.GetString(1), SystemName = reader.GetString(2), IconId = reader.GetInt32(3), ProcessGuid = reader.GetGuid(4), }); } } } using ( var cmdCount = new SqlCommand( string.Format( CultureInfo.InvariantCulture, "SELECT COUNT([t0].Id) FROM Processes [t0] JOIN [dbo].PublishedProcesses AS [t1] ON [t1].ProcessId = [t0].Id {0}", where), cn)) { result.TotalRowCount = (int)cmdCount.ExecuteScalar(); } } return result; }