protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int rowIndex = e.Row.RowIndex % DirectRefsGridView.PageSize; int ObjectId = (int)DirectRefsGridView.DataKeys[rowIndex].Value; CPAOffer BannerAd = new CPAOffer(ObjectId); //Title [0] e.Row.Cells[0].Text = (new HtmlString(BannerAd.Title)).ToHtmlString(); //Progress [4] e.Row.Cells[3].Text = HtmlCreator.GenerateCPAAdProgressHTML(BannerAd.CompletedClicks, BannerAd.CreditsBought); //category [2] e.Row.Cells[1].Text = CPAType.GetText(BannerAd.Category); // daily [5] if (BannerAd.IsDaily) { e.Row.Cells[4].Text = HtmlCreator.GetCheckboxCheckedImage(); } else { e.Row.Cells[4].Text = HtmlCreator.GetCheckboxUncheckedImage(); } //geo [7] if (BannerAd.IsGeolocated) { e.Row.Cells[5].Text = HtmlCreator.GetCheckboxCheckedImage(); } else { e.Row.Cells[5].Text = HtmlCreator.GetCheckboxUncheckedImage(); } //start[7] stop[8] Remove[9] if (BannerAd.Status != AdvertStatus.Paused) { e.Row.Cells[7].Text = " "; } if (BannerAd.Status != AdvertStatus.Active) { e.Row.Cells[8].Text = " "; } if (!BannerAd.Status.CanBeRemoved()) { e.Row.Cells[9].Text = " "; } //[7] status e.Row.Cells[6].Text = HtmlCreator.GetColoredStatus(BannerAd.Status); } }
public void MakeCategoriesList() { var list = new Dictionary <string, string>(); var values = CPACategory.AllCategories; foreach (var elem in values) { list.Add((elem.Id).ToString(), CPAType.GetText(elem)); } CategoriesList.DataSource = list; CategoriesList.DataTextField = "Value"; CategoriesList.DataValueField = "Key"; CategoriesList.DataBind(); }
public void MakeCategoriesList() { var list = new Dictionary <string, string>(); var values = AccountStatusesNetwork; int howmanyall = 0; //Add 'All' at the beginning list.Add("ALL", "text"); foreach (var elem in values) { int offersCount = CategoriesCount.ContainsKey(elem.Id) ? CategoriesCount[elem.Id] : 0; howmanyall += offersCount; list.Add((elem.Id).ToString(), CPAType.GetText(elem) + " [" + offersCount + "]"); } list["ALL"] = "All [" + howmanyall + "]"; CategoriesList.DataSource = list; CategoriesList.DataTextField = "Value"; CategoriesList.DataValueField = "Key"; CategoriesList.DataBind(); }