public ActionsForListRequest(IListId list, ISince since, Paging paging, IEnumerable<ActionType> filter) : base(list, "actions") { this.AddTypeFilter(filter); this.AddSince(since); this.AddPaging(paging); }
public ActionsForMemberRequest(IMemberId member, ISince since, Paging paging, IEnumerable<ActionType> filter) : base(member, "actions") { this.AddTypeFilter(filter); this.AddSince(since); this.AddPaging(paging); }
public ActionsForOrganizationRequest(IOrganizationId organization, ISince since, Paging paging, IEnumerable<ActionType> filter) : base(organization, "actions") { this.AddTypeFilter(filter); this.AddSince(since); this.AddPaging(paging); }
public IEnumerable<Activity> Get(Feed feed, Paging paging) { SortedSet<Activity> activities = new SortedSet<Activity>(Activity.Comparer); foreach (var streamId in feed.Streams) { var streamIdQuery = Convert.ToBase64String(streamId); var prepared = session .Prepare(LoadActivityStreamQueryTemplate) .Bind(streamIdQuery, paging.Timestamp) .SetAutoPage(false) .SetPageSize(paging.Take); var rowSet = session.Execute(prepared); foreach (var row in rowSet.GetRows()) { using (var stream = new MemoryStream(row.GetValue<byte[]>("data"))) { var storedActivity = (Activity)serializer.Deserialize(stream); activities.Add(storedActivity); } } } return activities.Take(paging.Take); }
public DataSelectParameter(string fullName, ICondition condition, string scope, Paging paging, Sorting[] sortings) : base(fullName) { _condition = condition; _scope = scope; _paging = paging; _sortings = sortings; }
/// <summary> /// 分頁 /// </summary> /// <param name="total">總數量</param> /// <param name="current_page">目前頁數</param> /// <param name="page_count">單頁數量</param> /// <returns>分頁</returns> public static Paging Get_Page(int total, int current_page = 1, int page_count = 10, int pages = 5) { Paging page = new Paging(); int count = pages; int count_com = Convert.ToInt32(Math.Floor((double)count / 2)); page.First = 1; int last = Convert.ToInt32(Math.Ceiling((double)total / (double)page_count)); page.Last = last <= 0 ? 1 : last; page.Total = total; page.Now = current_page; page.Back = (current_page > 1) ? current_page - 1 : current_page; page.Next = (current_page < last) ? current_page + 1 : current_page; int start = current_page - count_com; page.Start = (start < 1) ? 1 : start; int end = page.Start + count - 1; end = (end >= last) ? last : end; page.End = (end == 0) ? 1 : end; return page; }
public ActionsForCardRequest(ICardId card, ISince since, Paging paging, IEnumerable<ActionType> filter) : base(card, "actions") { this.AddTypeFilter(filter); this.AddSince(since); this.AddPaging(paging); }
public ActionsForBoardRequest(IBoardId board, ISince since, Paging paging, IEnumerable<ActionType> types) : base(board, "actions") { this.AddTypeFilter(types); this.AddSince(since); this.AddPaging(paging); }
public NotificationsForMeRequest(IMemberId member, IEnumerable<NotificationType> filter, ReadFilter readFilter, Paging paging) : base(member, "notifications") { AddTypeFilter(filter); this.AddFilter(readFilter, "read_filter"); this.AddPaging(paging); }
public void ProcessRequest(HttpContext context) { this.context = context; context.Response.ContentType = "text/json"; int count; List<Employee> result = Employee.GetEmployeesFilter(this.Start, this.Limit, this.Sort, out count); Paging<Employee> pagingEmployees = new Paging<Employee>(result, count); StoreResponseData sr = new StoreResponseData(); sr.Total = pagingEmployees.TotalRecords; sr.Data = JSON.Serialize(from e in pagingEmployees.Data select new { e.Address, e.BirthDate, e.City, e.Country, e.EmployeeID, e.Extension, e.FirstName, e.HireDate, e.HomePhone, e.LastName, e.Notes, e.PhotoPath, e.PostalCode, e.Region, e.ReportsTo, e.Title, e.TitleOfCourtesy }); sr.Return(); }
public static void AddPaging(this RestRequest request, Paging paging) { if (paging == null) return; request.AddParameter("limit", paging.Limit, ParameterType.GetOrPost); request.AddParameter("page", paging.Page, ParameterType.GetOrPost); }
[Test] public void TokenEqualsToString() { Paging p = new Paging(5,25); string value = string.Format("{0},{1}",25,5); Assert.AreEqual(value,p.Token); Assert.AreEqual(value,p.ToString()); }
[Test] public void ConstructorToken() { Paging p = new Paging(); Assert.AreEqual(string.Format("{0},{1}",int.MaxValue,0),p.Token); p = new Paging(7,55); Assert.AreEqual(string.Format("{0},{1}",55,7),p.Token); }
public static Paging GetPages(int itemCount, int itemsPerPage) { int page; int.TryParse(HttpContext.Current.Request.QueryString["page"], out page); if (page == 0) page = 1; var pages = new Paging { ItemsPerPage = itemsPerPage, CurrentPage = page, PreviousPage = page - 1, NextPage = page + 1, TotalPages = Math.Ceiling(itemCount / (Double)itemsPerPage), Skip = (page*itemsPerPage) - itemsPerPage, Take = itemsPerPage }; return pages; }
public virtual Paging<CommandLog> Select(Search search, int page, int size) { if (search == null) throw new ArgumentNullException("search"); var query = this.GetQuery(search); query = query.OrderByDescending(l => l.CreateTime); var metas = new Paging<CommandLogMeta>(query, page, size); var logs = Mapper.Map<CommandLogMeta[], CommandLog[]>(metas.Data); return new Paging<CommandLog>(logs, metas.PageCount, metas.TotalCount); }
public SqlSentenceBuilder() { Select = new List<Part>(); From = new List<FromPart>(); Where = new List<WherePart>(); GroupBy = new List<Part>(); Having = new List<Part>(); OrderBy = new List<Part>(); Paging = new Paging(); }
public virtual Paging<Screen> Select(Search search, int page, int size) { if (search == null) throw new ArgumentNullException("search"); var query = this.GetQuery(search); query = query.OrderByDescending(s => s.CreateTime); var metas = new Paging<ScreenMeta>(query, page, size); var screens = Mapper.Map<ScreenMeta[], Screen[]>(metas.Data); return new Paging<Screen>(screens, metas.PageCount, metas.TotalCount); }
[Test] public void ChangeToken() { Paging p = new Paging(); p.PageSize = 12; Assert.AreEqual(string.Format("{0},{1}",12,0),p.Token); p.Start = 38; Assert.AreEqual(string.Format("{0},{1}",12,38),p.Token); p.PageSize = 16; p.Start = 3; Assert.AreEqual(string.Format("{0},{1}",16,3),p.Token); }
public string All(FornecedorPesquisa parametros, int totalPerPage, int page) { var fornecedorRules = new FornecedorRules(); var paging = new Paging() { page = page, totalPerPage = totalPerPage }; return Success(fornecedorRules.All(parametros, paging), paging); }
public void PagingShouldEmpty() { const int currentPage = 1; var paging = new Paging<string>(new System.Collections.Generic.List<string>(), currentPage, _pageSize); Assert.AreEqual(currentPage, paging.CurrentPage); Assert.AreEqual(0, paging.Count); Assert.AreEqual(0, paging.PageCount); Assert.AreEqual(_pageSize, paging.PageSize); Assert.AreEqual(0, paging.Skip); }
public void PagingShouldNullSource() { const int currentPage = 1; var paging = new Paging<string>(null, currentPage, _pageSize); Assert.AreEqual(currentPage, paging.CurrentPage); Assert.AreEqual(0, paging.Count); Assert.AreEqual(0, paging.PageCount); Assert.AreEqual(_pageSize, paging.PageSize); Assert.AreEqual(0, paging.Skip); }
public string All(int? totalPerPage, int? page) { int tp = totalPerPage == null ? 10 : (int)totalPerPage; int pg = page == null ? 1 : (int)page; var notificacaoRules = new NotificacaoRules(); var paging = new Paging() { totalPerPage = tp, page = pg }; return Success(notificacaoRules.All(paging)); }
/// <summary> /// Gets the projects. /// </summary> /// <param name="paging">The paging.</param> /// <returns> /// A list of projects. /// </returns> public IList<Model.Project> GetProjects(Paging paging) { var result = DB.Projects .OrderBy(p => p.ProjectName) .Skip(paging.Skip) .Take(paging.PageSize) .Select (p => new Model.Project { ProjectId = p.ProjectId, ProjectName = p.ProjectName }); return result.ToList(); }
public void PagingShouldWithQueryableList() { const int currentPage = 0; const int records = 30; var paging = new Paging<string>(_persons.AsQueryable(), currentPage, _pageSize); Assert.AreEqual(currentPage, paging.CurrentPage); Assert.AreEqual(8, paging.Count); Assert.AreEqual(4, paging.PageCount); Assert.AreEqual(_pageSize, paging.PageSize); Assert.AreEqual(records, (int) paging.Records); Assert.AreEqual(0, paging.Skip); }
public ActionResult Index(string id, int size = 100) { using (var service = new PhotosService()) { var model = new Paging<Tag> { Items = service.RecentTags(size) .Select(t => new Tag(t)), Total = -1 }; return View(model); } }
private void ZiyaretciKayitSayisi() { try { paging = new Paging(); paging.CurentPage = QueryString.Value<int>("Sayfa"); paging.TotolItem = ZiyaretciDefteriDB.ItemCount("web"); paging.QueryString = Request.QueryString; ltlSayfalama.Text = PagingLinkWeb.GetHtmlCode(paging); } catch (Exception ex) { LogManager.SqlDB.Write("Ziyaretçi Defteri Kayıt Toplam", ex); } }
private void UrunKayitSayisi() { try { paging = new Paging(); paging.CurentPage = QueryString.Value<int>("Sayfa"); paging.TotolItem = UrunDB.UrunToplamKayit("", "markaTek", markaId); paging.QueryString = Request.QueryString; ucProductList.PagingLinkToDisplay = PagingLinkWeb.GetHtmlCode(paging); lbllistelemeBilgisi.Text = paging.Mesaj; } catch (Exception ex) { LogManager.SqlDB.Write("Marka Ürün Listeleme Sayfa No Hatası", ex); } }
private void KayitSayisi(string keyword, int markaId) { try { paging = new Paging(); paging.CurentPage = QueryString.Value<int>("Sayfa"); paging.TotolItem = UrunDB.UrunToplamKayit("arama", keyword, markaId); paging.QueryString = Request.QueryString; lbllistelemeBilgisi.Text = paging.Mesaj; ucProductList.PagingLinkToDisplay = PagingLinkWeb.GetHtmlCode(paging); } catch (Exception hata) { LogManager.SqlDB.Write("Arama Sonucu Sayfa No Hatası:", hata); } }
public void PagingShouldWithEnumerableList() { const int currentPage = 0; const int records = 30; var paging = new Paging<string>(_persons, currentPage, _pageSize); Assert.AreEqual(currentPage, paging.CurrentPage); Assert.AreEqual(8, paging.Count); Assert.AreEqual(4, paging.PageCount); Assert.AreEqual(_pageSize, paging.PageSize); Assert.AreEqual(records, (int) paging.Records); Assert.AreEqual(0, paging.Skip); Assert.IsTrue(paging.HasNextPage); Assert.IsFalse(paging.HasPreviousPage); Assert.IsTrue(paging.IsFirstPage); Assert.IsFalse(paging.IsLastPage); }
public List<Notificacao> Fetch(int usuarioId, Paging paging) { var sql = PetaPoco.Sql.Builder.Append("SELECT Notificacao.*, De.*, Para.*, Unidade.*") .Append("FROM Notificacao") .Append("INNER JOIN Usuario AS De ON De.Id = Notificacao.DeId") .Append("INNER JOIN Usuario AS Para ON Para.Id = Notificacao.ParaId") .Append("INNER JOIN Unidade ON Unidade.Id = De.UnidadeId") .Append("WHERE Notificacao.ParaId = @0", usuarioId) .Append("ORDER BY Notificacao.Data DESC") .Append("LIMIT @0, @1", paging.LimitDown, paging.LimitUp); return this.Db.Fetch<Notificacao, Usuario, Usuario, Unidade, Notificacao>((n, d, p, u) => { n.De = d; n.Para = p; n.De.Unidade = u; return n; }, sql).ToList(); }
internal static void Start(uint magic, uint address, uint KernelDirectory, uint InitialHeap) { /* Kernel Logger init */ Debug.Init(); /* Initalize Heap */ Heap.Init(InitialHeap); /* Multiboot Info Parsing */ Multiboot.Setup(magic, address); /* Setup Paging */ Paging.Setup(KernelDirectory); /* Setup GDT */ GDT.Setup(); /* Remap PIC */ PIC.Setup(); /* Setup IDT */ IDT.Setup(); /* Enable Interrupt */ Native.Sti(); /* Setup Scheduler */ Scheduler.Init(KernelDirectory); /* Setup System Timer */ Timer.Setup(); /* Install SHM */ SHM.Install(); /* Initialise VBE 2.0 Driver */ VBE.Init(); /* Initialise Virtual File system */ VirtualFileSystem.Setup(); /* Setup Syscall */ Syscall.Setup(); /* Initialise C library */ Libc.Init(); try { Boot.Init(); } catch (Exception e) { Debug.Write("[@SystemThread] => [EXIT]: %s\n", e.Message); } while (true) { ; } }
//void BindArea() //{ // IList<ProjectArea> list = new List<ProjectArea>(); // if (!AspNetCache.CheckCache(Constants.Cache_Project_Area_All)) // { // list = new ProjectAreaService().FindAll(); // AspNetCache.SetCache(Constants.Cache_Project_Area_All, list); // } // else // list = (IList<ProjectArea>)AspNetCache.GetCache(Constants.Cache_Project_Area_All); // ddlArea.DataSource = list; // ddlArea.DataTextField = "AreaName"; // ddlArea.DataValueField = "Id"; // ddlArea.DataBind(); // ddlArea.Items.Insert(0, new ListItem("---Chọn lĩnh vực---")); //} //void BindSubArea() //{ // IList<ProjectArea> list = new List<ProjectArea>(); // if (!AspNetCache.CheckCache(Constants.Cache_Project_Area_All)) // { // list = new ProjectAreaService().FindAll(); // AspNetCache.SetCache(Constants.Cache_Project_Area_All, list); // } // else // list = (IList<ProjectArea>)AspNetCache.GetCache(Constants.Cache_Project_Area_All); // ddlSubArea.DataSource = list; // ddlSubArea.DataTextField = "AreaName"; // ddlSubArea.DataValueField = "Id"; // ddlSubArea.DataBind(); // ddlSubArea.Items.Insert(0, new ListItem("---Chọn phân ngành---")); //} //void BindProvince() //{ // IList<Province> list = new List<Province>(); // if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Provice_All)) // { // list = new ProvinceService().FindAll(); // AspNetCache.SetCache(Constants.Cache_ReportFuel_Provice_All, list); // } // else // list = (IList<Province>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Provice_All); // ddlProvince.DataSource = list; // ddlProvince.DataTextField = "ProvinceName"; // ddlProvince.DataValueField = "Id"; // ddlProvince.DataBind(); // ddlProvince.Items.Insert(0, new ListItem("---Chọn Tỉnh/TP---")); // ddlProvinceReporter.DataSource = list; // ddlProvinceReporter.DataTextField = "ProvinceName"; // ddlProvinceReporter.DataValueField = "Id"; // ddlProvinceReporter.DataBind(); // ddlProvinceReporter.Items.Insert(0, new ListItem("---Chọn Tỉnh/TP---")); //} //void BindDistrict() //{ // IList<District> list = new List<District>(); // if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_District_All)) // { // list = new DistrictService().FindAll(); // AspNetCache.SetCache(Constants.Cache_ReportFuel_District_All, list); // } // else // list = (IList<District>)AspNetCache.GetCache(Constants.Cache_ReportFuel_District_All); // ddlDistrict.DataSource = list; // ddlDistrict.DataTextField = "DistrictName"; // ddlDistrict.DataValueField = "Id"; // ddlDistrict.DataBind(); // ddlDistrict.Items.Insert(0, new ListItem("---Chọn Quận/Huyện---")); // ddlDistrictReporter.DataSource = list; // ddlDistrictReporter.DataTextField = "DistrictName"; // ddlDistrictReporter.DataValueField = "Id"; // ddlDistrictReporter.DataBind(); // ddlDistrictReporter.Items.Insert(0, new ListItem("---Chọn Quận/Huyện---")); //} //void BindEnterprise() //{ // int EnterpriseId = 1; // Enterprise enter = new Enterprise(); // enter = new EnterpriseService().FindByKey(EnterpriseId); // if (enter != null) // { // txtEnterpriseName.Text = enter.Title; // if (enter.SubAreaId > 0) // ddlSubArea.SelectedValue = enter.SubAreaId.ToString(); // if (enter.AreaId > 0) // ddlArea.SelectedValue = enter.AreaId.ToString(); // if (enter.ProvinceId > 0) // ddlProvince.SelectedValue = enter.ProvinceId.ToString(); // if (enter.DistrictId > 0) // ddlDistrict.SelectedValue = enter.DistrictId.ToString(); // txtAddress.Text = enter.Address; // txtEmail.Text = enter.Email; // txtFax.Text = enter.Fax; // txtPhone.Text = enter.Phone; // txtReportName.Text = enter.ManPerson; // if (enter.ManProvinceId > 0) // ddlProvinceReporter.SelectedValue = enter.ManProvinceId.ToString(); // if (enter.ManDistrictId > 0) // ddlDistrictReporter.SelectedValue = enter.ManDistrictId.ToString(); // txtAddressReporter.Text = enter.ManAddress; // txtEmail.Text = enter.ManEmail; // txtFaxReporter.Text = enter.ManFax; // txtPhoneReporter.Text = enter.ManPhone; // } //} //void BindOrganization() //{ // IList<Organization> list = new List<Organization>(); // if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Organization_All)) // { // list = new OrganizationService().FindAll(); // AspNetCache.SetCache(Constants.Cache_ReportFuel_Organization_All, list); // } // else // list = (IList<Organization>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Organization_All); // ddlOrg.DataSource = list; // ddlOrg.DataTextField = "Title"; // ddlOrg.DataValueField = "Id"; // ddlOrg.DataBind(); // ddlOrg.Items.Insert(0, new ListItem("---Tất cả---", "")); //} private void BindData() { ltData.Text = ""; IList <GroupFuel> listGroupFuel = new List <GroupFuel>(); if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_GroupFuel_All)) { listGroupFuel = new GroupFuelService().FindAll(); AspNetCache.SetCache(Constants.Cache_ReportFuel_GroupFuel_All, listGroupFuel); } else { listGroupFuel = (IList <GroupFuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_GroupFuel_All); } ReportFuelService comBSO = new ReportFuelService(); DataTable list = new DataTable(); int AreaId = 0; int SubAreaId = 0; int Year = 0; if (ddlYear.SelectedIndex > 0) { Year = Convert.ToInt32(ddlYear.SelectedValue); } int OrgId = 0; //if (ddlOrg.SelectedIndex > 0) // OrgId = Convert.ToInt32(ddlOrg.SelectedValue); ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage); list = comBSO.FindList(false, AreaId, SubAreaId, m_UserValidation.OrgId, 0, 0, 0, 1, true, Year, null, null, "", paging); ltHeader.Text = ""; foreach (GroupFuel group in listGroupFuel) { ltHeader.Text = ltHeader.Text + "<th>" + group.Title + " (" + group.MeasurementName + ")</th>"; } if (list != null && list.Rows.Count > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < list.Rows.Count; i++) { sb.Append("<tr><td>" + (i + 1) + "</td>"); sb.Append("<td>" + list.Rows[i]["Title"] + "</td>"); sb.Append("<td>" + list.Rows[i]["Address"] + "</td>"); //sb.Append("<td>" + list.Rows[i]["ProvinceName"] + "</td>"); //sb.Append("<td></td>");//Vung //sb.Append("<td>" + list.Rows[i]["RegionName"] + "</td>");//Vung sb.Append("<td>" + list.Rows[i]["ParentAreaName"] + "</td>"); sb.Append("<td>" + list.Rows[i]["AreaName"] + "</td>"); if (list.Rows[i]["Id"] != null && list.Rows[i]["Id"].ToString() != "") { int ReportId = Convert.ToInt32(list.Rows[i]["Id"]); if (ReportId > 0) { DataTable listDetail = new ReportFuelDetailService().GetNoFuelDetailGroupByReport(ReportId, false); int SumTOE = 0; if (listDetail != null && listDetail.Rows.Count > 0) { foreach (GroupFuel group in listGroupFuel) { DataRow[] dr = listDetail.Select("GroupFuelId=" + group.Id); if (dr != null && dr.Count() > 0) { sb.Append("<td>" + dr[0]["NoFuel"]); SumTOE = SumTOE + Convert.ToInt32(dr[0]["NoFuel_TOE"]); } else { sb.Append("<td>0</td>"); } } sb.Append("<td>" + SumTOE + "</td>"); } else { for (int j = 0; j < listGroupFuel.Count; j++) { sb.Append("<td>0</td>"); } sb.Append("<td>0</td>"); } } sb.Append("</tr>"); } } ltData.Text = sb.ToString(); paging.RowsCount = Convert.ToInt32(list.Rows[0]["Total"]); Paging.PageSize = PageSize; Paging.CurrentPage = CurrentPage; Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]); Paging.DataLoad(); if (paging.PagesCount <= 1) { ltNotice.Text = "Có tổng số " + paging.RowsCount + " báo cáo"; Paging.Visible = false; } else { ltNotice.Text = "Có" + list.Rows.Count + " trong tổng số " + paging.RowsCount + " báo cáo"; Paging.Visible = true; } } else { ltNotice.Text = ""; Paging.Visible = false; } }
/// <summary> /// 查找分页数据 /// </summary> /// <param name="paging">分页数据</param> /// <returns>分页数据</returns> public Paging <T> FindPageList(Paging <T> paging) { paging.Items = Repository.FindPageList(paging.PageSize, paging.PageIndex, out paging.TotalNumber).ToList(); return(paging); }
public IEnumerable <Manufacturer> PagedListByMenu(SortingPagingBuilder sortBuider, Paging page) { return(_manufacturerRepository.PagedSearchListByMenu(sortBuider, page)); }
public IEnumerable <AttributeValue> PagedList(Paging page) { return(GetAllPagedList(page).ToList()); }
public IEnumerable <AttributeValue> PagedSearchList(SortingPagingBuilder sortBuider, Paging page) { var expression = PredicateBuilder.True <AttributeValue>(); if (!string.IsNullOrEmpty(sortBuider.Keywords)) { expression = expression.And(x => x.ValueName.ToLower().Contains(sortBuider.Keywords.ToLower()) || x.Description.ToLower().Contains(sortBuider.Keywords.ToLower()) || x.Attribute.AttributeName.ToLower().Contains(sortBuider.Keywords.ToLower())); } return(FindAndSort(expression, sortBuider.Sorts, page)); }
public async Task <PagedResult <IEnumerable <RichListItem> > > GetRichList(Paging paging) { var richList = await _richListRepository.GetRichList(_mapper.Map <DataAccess.Entities.Read.Paging>(paging)); return(_mapper.Map <PagedResult <IEnumerable <RichListItem> > >(richList)); }
/// <summary> /// Runs the code example. /// </summary> /// <param name="user">The AdWords user.</param> public void Run(AdWordsUser user) { // Get the TargetingIdeaService. TargetingIdeaService targetingIdeaService = (TargetingIdeaService)user.GetService(AdWordsService.v201509.TargetingIdeaService); string keywordText = "mars cruise"; // Create selector. TargetingIdeaSelector selector = new TargetingIdeaSelector(); selector.requestType = RequestType.IDEAS; selector.ideaType = IdeaType.KEYWORD; selector.requestedAttributeTypes = new AttributeType[] { AttributeType.KEYWORD_TEXT, AttributeType.SEARCH_VOLUME, AttributeType.CATEGORY_PRODUCTS_AND_SERVICES }; // Language setting (optional). // The ID can be found in the documentation: // https://developers.google.com/adwords/api/docs/appendix/languagecodes // Note: As of v201302, only a single language parameter is allowed. LanguageSearchParameter languageParameter = new LanguageSearchParameter(); Language english = new Language(); english.id = 1000; languageParameter.languages = new Language[] { english }; // Create related to query search parameter. RelatedToQuerySearchParameter relatedToQuerySearchParameter = new RelatedToQuerySearchParameter(); relatedToQuerySearchParameter.queries = new String[] { keywordText }; selector.searchParameters = new SearchParameter[] { relatedToQuerySearchParameter, languageParameter }; // Set selector paging (required for targeting idea service). Paging paging = Paging.Default; TargetingIdeaPage page = new TargetingIdeaPage(); try { int i = 0; do { // Get related keywords. page = targetingIdeaService.get(selector); // Display related keywords. if (page.entries != null && page.entries.Length > 0) { foreach (TargetingIdea targetingIdea in page.entries) { string keyword = null; string categories = null; long averageMonthlySearches = 0; foreach (Type_AttributeMapEntry entry in targetingIdea.data) { if (entry.key == AttributeType.KEYWORD_TEXT) { keyword = (entry.value as StringAttribute).value; } if (entry.key == AttributeType.CATEGORY_PRODUCTS_AND_SERVICES) { IntegerSetAttribute categorySet = entry.value as IntegerSetAttribute; StringBuilder builder = new StringBuilder(); if (categorySet.value != null) { foreach (int value in categorySet.value) { builder.AppendFormat("{0}, ", value); } categories = builder.ToString().Trim(new char[] { ',', ' ' }); } } if (entry.key == AttributeType.SEARCH_VOLUME) { averageMonthlySearches = (entry.value as LongAttribute).value; } } Console.WriteLine("Keyword with text '{0}', and average monthly search volume " + "'{1}' was found with categories: {2}", keyword, averageMonthlySearches, categories); i++; } } selector.paging.IncreaseOffset(); } while (selector.paging.startIndex < page.totalNumEntries); Console.WriteLine("Number of related keywords found: {0}", page.totalNumEntries); } catch (Exception e) { throw new System.ApplicationException("Failed to retrieve related keywords.", e); } }
public ActionResult List(Paging paging, List <OrderBy> orderBy) { return(this.JsonNet(NidanBusinessService.RetrieveMobilizations(UserOrganisationId, orderBy, paging))); }
public ActionResult EnquiryList(Paging paging, List <OrderBy> orderBy) { bool isSuperAdmin = User.IsInAnyRoles("SuperAdmin"); return(this.JsonNet(NidanBusinessService.RetrieveEnquiries(UserOrganisationId, p => (isSuperAdmin || p.CentreId == UserCentreId) && p.IsRegistrationDone == "NO", orderBy, paging))); }
/// <summary> /// Gets keyword ideas for the list of Seed keywords. /// </summary> /// <param name="user">The user for which keyword ideas are generated. /// </param> /// <param name="seedKeywords">The seed keywords for generating ideas. /// </param> /// <param name="searchParameters">The search parameters to be used when /// generating keyword ideas.</param> /// <returns>A list of keyword ideas.</returns> private List <KeywordIdea> GetKeywordIdeas(AdWordsUser user, List <string> seedKeywords, SeedKeyword[] negativeTerms) { // Get the TargetingIdeaService. TargetingIdeaService targetingIdeaService = (TargetingIdeaService)user.GetService(AdWordsService.v201509.TargetingIdeaService); IdeaTextFilterSearchParameter excludedTerms = null; if (negativeTerms.Length > 0) { excludedTerms = GetExcludedKeywordSearchParams(negativeTerms); } LanguageSearchParameter languageParams = GetLanguageSearchParams(); LocationSearchParameter locationParams = GetLocationSearchParams(); List <KeywordIdea> retval = new List <KeywordIdea>(); for (int i = 0; i < seedKeywords.Count; i += Settings.TIS_KEYWORDS_LIST_SIZE) { List <string> keywordsToSearch = new List <string>(); for (int j = i; j < i + Settings.TIS_KEYWORDS_LIST_SIZE && j < seedKeywords.Count; j++) { keywordsToSearch.Add(seedKeywords[j]); } // Create selector. TargetingIdeaSelector selector = new TargetingIdeaSelector(); selector.requestType = RequestType.IDEAS; selector.ideaType = IdeaType.KEYWORD; selector.requestedAttributeTypes = new AttributeType[] { AttributeType.KEYWORD_TEXT, AttributeType.SEARCH_VOLUME, AttributeType.AVERAGE_CPC, AttributeType.COMPETITION }; List <SearchParameter> paramList = new List <SearchParameter>(); paramList.Add(new RelatedToQuerySearchParameter() { queries = keywordsToSearch.ToArray(), }); if (excludedTerms != null) { paramList.Add(excludedTerms); } paramList.Add(locationParams); paramList.Add(languageParams); selector.searchParameters = paramList.ToArray(); // Set selector paging (required for targeting idea service). Paging paging = new Paging(); paging.startIndex = 0; paging.numberResults = Settings.PAGE_SIZE; selector.paging = paging; int offset = 0; int pageSize = 500; TargetingIdeaPage page = new TargetingIdeaPage(); try { do { selector.paging.startIndex = offset; selector.paging.numberResults = pageSize; // Get related keywords. page = targetingIdeaService.get(selector); // Display related keywords. if (page.entries != null && page.entries.Length > 0) { foreach (TargetingIdea targetingIdea in page.entries) { string keyword = null; long averageMonthlySearches = 0; long averageCpc = 0; double competition = 0f; foreach (Type_AttributeMapEntry entry in targetingIdea.data) { if (entry.key == AttributeType.KEYWORD_TEXT) { StringAttribute temp = (entry.value as StringAttribute); if (temp != null) { keyword = temp.value; } } if (entry.key == AttributeType.SEARCH_VOLUME) { LongAttribute temp = (entry.value as LongAttribute); if (temp != null) { averageMonthlySearches = temp.value; } } if (entry.key == AttributeType.AVERAGE_CPC) { MoneyAttribute temp = (entry.value as MoneyAttribute); if (temp != null && temp.value != null) { averageCpc = temp.value.microAmount; } } if (entry.key == AttributeType.COMPETITION) { DoubleAttribute temp = (entry.value as DoubleAttribute); if (temp != null) { competition = temp.value; } } } KeywordIdea keywordIdea = new KeywordIdea() { KeywordText = keyword, AverageSearches = averageMonthlySearches, AverageCpc = averageCpc, Competition = Math.Round(competition, Settings.ACCURACY, MidpointRounding.AwayFromZero) }; retval.Add(keywordIdea); } } offset += pageSize; } while (offset < page.totalNumEntries); } catch (Exception e) { throw new System.ApplicationException("Failed to retrieve related keywords.", e); } } return(retval); }
public async Task <ActionResult> List(Paging paging, List <OrderBy> orderBy) { var data = await _sellerOrderBusinessService.RetrieveSellerOrders(e => true, orderBy, paging); return(this.JsonNet(data)); }
/// <summary> /// 分页查询 /// </summary> /// <param name="where">查询条件</param> /// <param name="paging">分页参数</param> /// <returns></returns> public Tuple <int, int, IEnumerable <Tentity> > GetMany(Expression <Func <Tentity, bool> > where, Paging paging) { var dbSet = Dbset; if (paging == null) { paging = new Paging { PageIndex = 1, PageSize = int.MaxValue }; } if (where != null) { dbSet.Where(where); } paging.RecordCount = dbSet.Count(); var result = dbSet.Skip(paging.SkipCount).Take(paging.PageSize).AsNoTracking().ToList(); return(new Tuple <int, int, IEnumerable <Tentity> >(paging.PageCount, paging.RecordCount, result)); }
public SearchResult Search(BLLContext context, Paging paging, EntityBase queryEntity) { return(dal.Search(context, paging, queryEntity)); }
public ActionResult GetPersonnel(int centreId, int activityAssigneeGroupId, Paging paging, List <OrderBy> orderBy) { var assignTos = NidanBusinessService.RetrieveActivityAssignPersonnels(UserOrganisationId, centreId, activityAssigneeGroupId).Items.ToList(); return(this.JsonNet(assignTos)); }
public new Task <IList <TEntity> > PaginationAsync(Paging paging = null) { return(PaginationAsync <TEntity>(paging)); }
public IEnumerable <Process> GetMultiPaging(Paging paging, out int total, string[] includes = null) { IEnumerable <Process> query = null; if (paging.Filters == null) { query = processRepository.GetAll(includes); } else { var first = paging.Filters.First(); switch (first.Property) { case "name": { query = processRepository.GetMulti(x => x.Name.ToUpper().Contains(first.Value.ToUpper()), includes); break; } case "description": { query = processRepository.GetMulti(x => x.Description.ToUpper().Contains(first.Value.ToUpper()), includes); break; } case "createdBy": { query = processRepository.GetMulti(x => x.CreatedBy.ToUpper().Contains(first.Value.ToUpper()), includes); break; } case "updatedBy": { query = processRepository.GetMulti(x => x.UpdatedBy.ToUpper().Contains(first.Value.ToUpper()), includes); break; } default: { break; } } if (query == null) { total = 0; return(query); } foreach (var filter in paging.Filters.Skip(1)) { if (!String.IsNullOrEmpty(filter.Value)) { switch (filter.Property) { case "name": { query = query.Where(x => x.Name.ToUpper().Contains(filter.Value.ToUpper())); break; } case "description": { query = query.Where(x => x.Description.ToUpper().Contains(filter.Value.ToUpper())); break; } case "createdBy": { query = query.Where(x => x.CreatedBy.ToUpper().Contains(filter.Value.ToUpper())); break; } case "updatedBy": { query = query.Where(x => x.UpdatedBy.ToUpper().Contains(filter.Value.ToUpper())); break; } default: { break; } } } else { query = processRepository.GetAll(includes); } } } if (!String.IsNullOrEmpty(paging.SortBy)) { var q = query.AsQueryable(); if (paging.Sort.Equals("DESC") || paging.Sort.Equals(null)) { query = q.OrderBy(paging.SortBy + " descending"); } else { query = q.OrderBy(paging.SortBy + " ascending"); } } total = query.Count(); return(query.Skip((paging.CurrentPage - 1) * paging.PageSize).Take(paging.PageSize)); }
public IEnumerable <LocalizedProperty> PagedSearchList(SortingPagingBuilder sortBuider, Paging page) { var expression = PredicateBuilder.True <LocalizedProperty>(); if (!string.IsNullOrEmpty(sortBuider.Keywords)) { expression = expression.And(x => x.LocaleKey.ToLower().Contains(sortBuider.Keywords.ToLower()) || x.LocaleKey.ToLower().Contains(sortBuider.Keywords.ToLower())); } return(FindAndSort(expression, sortBuider.Sorts, page)); }
public ActionResult GetPlants(int start, int limit, int page, string query) { Paging <Plant> plants = Plant.PlantsPaging(start, limit, "", "", query); return(this.Store(plants.Data, plants.TotalRecords)); }
public IEnumerable <LocalizedProperty> PagedList(Paging page) { return(GetAllPagedList(page).ToList()); }
public IEnumerable <OrderItem> PagedList(SortingPagingBuilder sortbuBuilder, Paging page) { return(_orderItemRepository.PagedSearchList(sortbuBuilder, page)); }
public IQueryable <Account> GetAllData(Paging obj) { var result = _repository.GetAll().OrderByDescending(p => p.UserName).Skip(obj.PageIndex != 0? obj.PageIndex:0).Take(obj.PageCount != 0 ? obj.PageCount :10); return(result); }
//private int oneLevelClassID = 0; //产品列表 private void List() { string sqlSelect, sqlFrom, sqlWhere = string.Empty, sqlOrder, pkName; if (t == 1) { sqlSelect = "select ProSN,ProName,PicS,Price,PriceMarket,Item,Number,UnitNum,StockN,Unit"; } else { sqlSelect = "select ProSN,ProName,PicS,Price,PriceMarket,Item"; } sqlFrom = " from vgPro_Info"; string aw = ""; if (keyword.Length > 0) { aw = sqlWhere.Length > 0 ? " and " : " where "; sqlWhere += aw + "ProName like '%'+@ProName+'%'"; } aw = sqlWhere.Length > 0 ? " and " : " where "; switch (joinType) { case 0: break; case 1: sqlWhere += aw + "JoinType=0"; this.curPath.Text += " (菜蓝子)"; break; case 2: sqlWhere += aw + "JoinType=1"; this.curPath.Text += " (商家)"; break; } switch (ord) { case 1: sqlOrder = " order by Price asc"; break; case 2: sqlOrder = " order by Price desc"; break; default: sqlOrder = " order by EditDate desc"; break; } pkName = "ProSN"; PagingVar pv = new PagingVar(); pv.SQLCount = "select count(0)" + sqlFrom + sqlWhere; pv.SQLRead = "select " + pkName + sqlFrom + sqlWhere + sqlOrder; pv.SQL = sqlSelect + sqlFrom + " where " + pkName + " in({0})" + sqlOrder; IDataParameter[] dp = { DbHelp.Def.AddParam("@ProName", keyword) }; pv.DataParm = dp; Paging pg = new Paging(pv, new PagingUrlVar(32, pageIndex));//页记录 pg.load(); if (t == 1) { stypeModel = "2"; this.showPic.Visible = false; this.rpList.dt = pg.GetDataTable(); this.rpList.listEvent = ProLay.f_1; } else { this.showList.Visible = false; this.rpPic.dt = pg.GetDataTable(); this.rpPic.listEvent = new CycleEvent(ProLay.d_list1); } this.ucPS1.f = pg; this.ucPS1.cs = Request.Url.AbsolutePath + "?s=" + id + "-{0}-" + t + "-" + ord + "--" + keywordEncode; }
public Task SyncFeed() { return(Task.Run(() => { try { scheduler.Clear(); if (RuiJiConfiguration.Standalone) { var page = 1; var paging = new Paging(); paging.CurrentPage = page; paging.PageSize = 5000; var feeds = FeedLiteDb.GetAvailableFeeds(paging); while (feeds.Count != 0) { foreach (var feed in feeds) { AddJob(feed); } Logger.GetLogger(baseUrl).Info(baseUrl + " sync feed and add feed jobs:" + feeds.Count); paging.CurrentPage = ++page; feeds = FeedLiteDb.GetAvailableFeeds(paging); } } else { var data = feedNode.GetData("/config/feed/" + baseUrl); var config = JsonConvert.DeserializeObject <NodeConfig>(data.Data); if (config.Pages == null || config.Pages.Length == 0) { return; } feedPages = config.Pages; var feedsResponse = NodeVisitor.Feeder.GetFeedJobs(string.Join(",", config.Pages)); if (string.IsNullOrEmpty(feedsResponse)) { throw new Exception("feedproxy can't connect"); } var feeds = JsonConvert.DeserializeObject <List <FeedModel> >(feedsResponse); foreach (var feed in feeds) { AddJob(feed); } Logger.GetLogger(baseUrl).Info(baseUrl + " sync feed and add feed jobs:" + feeds.Count); } } catch (Exception ex) { Logger.GetLogger(baseUrl).Error(baseUrl + " sync feed error " + ex.Message); } })); }
public IEnumerable <App.Domain.Entities.Data.GenericAttribute> PagedList(SortingPagingBuilder sortbuBuilder, Paging page) { return(this._genericAttributeRepository.PagedSearchList(sortbuBuilder, page)); }
/// <summary> /// 违停事件 /// </summary> /// <param name="filters"></param> /// <param name="start"></param> /// <param name="limit"></param> /// <returns></returns> public Paging <List <Case_WtajsModel> > GetCaseWtajsList(List <Filter> filters, int start, int limit, string processstatus) { List <Case_WtajsModel> list = new List <Case_WtajsModel>(); Paging <List <Case_WtajsModel> > paging = new Paging <List <Case_WtajsModel> >(); using (Entities db = new Entities()) { IQueryable <Case_WtajsModel> queryable = from a in db.case_wtajs join b_join in db.base_zds on a.car_type equals b_join.zd_id into bTmp from b in bTmp.DefaultIfEmpty() where (processstatus == "0" ? a.processstatus == processstatus : (a.processstatus == "1" || a.processstatus == "2")) && b.zd_type == "case_type_car" select new Case_WtajsModel { wtid = a.wtid, car_num = a.car_num, car_type = a.car_type, wt_time = a.wt_time, wt_address = a.wt_address, cfjdsh = a.cfjdsh, reporttime = a.reporttime, car_typename = b == null ? "" : b.zd_name, unitid = a.unitid }; if (filters != null && filters.Count > 0) { foreach (Filter filter in filters) { string value = filter.value; switch (filter.property) { case "carnum": if (!string.IsNullOrEmpty(value)) { queryable = queryable.Where(t => t.car_num.Contains(value)); } break; case "wtaddress": if (!string.IsNullOrEmpty(value)) { queryable = queryable.Where(t => t.wt_address.Contains(value)); } break; case "cartype": if (!string.IsNullOrEmpty(value)) { queryable = queryable.Where(t => t.car_type == value); } break; case "cfjdsh": if (!string.IsNullOrEmpty(value)) { queryable = queryable.Where(t => t.cfjdsh == value); } break; case "stime": if (!string.IsNullOrEmpty(value)) { DateTime Stime = DateTime.Parse(value).Date; queryable = queryable.Where(t => t.wt_time >= Stime); } break; case "etime": if (!string.IsNullOrEmpty(value)) { DateTime Etime = DateTime.Parse(value).Date.AddDays(1); queryable = queryable.Where(t => t.wt_time <= Etime); } break; case "unitid": if (!string.IsNullOrEmpty(value)) { int unitid = Convert.ToInt32(value); queryable = queryable.Where(t => t.unitid == unitid); } break; } } } list = queryable.OrderByDescending(a => a.reporttime).Skip(start).Take(limit).ToList(); //获取列表 paging.Items = list; //获取列表总数量 paging.Total = queryable.Count(); } return(paging); }
public async Task <List <IEmployee> > QueryAllAsync() { Connection = new SqlConnection("Data Source=DESKTOP-0NGMPOG;Initial Catalog=CompanyDB;Trusted_Connection=True;"); using (Connection) { bool error = false; SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM Employees " + Filtering.GenerateString() + " " + Sorting.GenerateString() + " " + Paging.GenerateString() + ";", Connection); Connection.Open(); DataSet dataSet = new DataSet(); await Task.Run(() => { try { adapter.Fill(dataSet, "Employees"); } catch { error = true; } } ); if (error) { return new List <IEmployee> { } } ; List <IEmployee> retVal = new List <IEmployee>(); foreach (DataRow pRow in dataSet.Tables[0].Rows) { retVal.Add(new Employee() { Id = Guid.Parse(pRow.ItemArray.GetValue(0).ToString()), FirstName = pRow.ItemArray.GetValue(1).ToString(), LastName = pRow.ItemArray.GetValue(2).ToString(), Department = pRow.ItemArray.GetValue(3).ToString() }); } return(retVal); } }
public ActionResult ActivityTaskStatesByActivityTaskId(int activityTaskId, Paging paging, List <OrderBy> orderBy) { var data = NidanBusinessService.RetrieveActivityTaskStates(UserOrganisationId, e => e.ActivityTaskId == activityTaskId, orderBy, paging); return(this.JsonNet(data)); }
public new IList <TEntity> Pagination(Paging paging = null) { return(Pagination <TEntity>(paging)); }
public async Task <IEnumerable <VehicleMake> > GetVehicleMakesAsync(Filtering filters, Sorting sorting, Paging paging) { return(await _vehicleMakeRepository.GetVehicleMakes(filters, sorting, paging)); }