private void LoadContests(ContestType Type, PlaceHolder ContestLiteral, Member User, Button button, View view) { var list = ContestManager.GetActiveContestsForMember(Type, User); foreach (var contest in list) { ContestLiteral.Controls.Add(GetContestCode(contest, User)); } if (list.Count == 0) { button.Visible = false; } else if (noContestsAvailable) { //First of that kind, set the active view MenuMultiView.SetActiveView(view); noContestsAvailable = false; } }
private void BindEditWindow() { MenuMultiView.SetActiveView(AddNewArticleView); int articleId = Convert.ToInt32(ViewState["editid"]); Article article = new Article(articleId); if (article.CreatorUserId != Member.CurrentId || article.Status == AdvertStatus.Deleted) { Response.Redirect("~/default.aspx"); } TitleTextBox.Text = Server.HtmlDecode(article.Title); DescriptionTextBox.Text = Server.HtmlDecode(article.ShortDescription); CategoriesList.SelectedValue = article.CategoryId.ToString(); CountriesList.SelectedValue = article.Geolocation.ToString(); TextCKEditor.Text = Server.HtmlDecode(article.Text); KeywordsTextBox.Text = Server.HtmlDecode(article.Keywords); VideoImage.ImageUrl = article.ImageURL; VideoLabel.Text = article.VideoURL; }
private void BindEditWindow() { if (!Member.IsLogged) { return; } MenuMultiView.SetActiveView(View1); int adId = Convert.ToInt32(ViewState["editid"]); EditId = "?editid=" + adId.ToString(); PtcAdvert ad = new PtcAdvert(adId); if (ad.AdvertiserUserId != Member.CurrentId || ad.Status == AdvertStatus.Rejected) { Response.Redirect("~/default.aspx"); } Title.Text = ad.Title; URL.Text = ad.TargetUrl; if (AppSettings.PtcAdverts.PTCCategoryPolicy == AppSettings.PTCCategoryPolicy.Custom) { if (PtcAdvertCategory.GetActiveCategories().Any(x => x.Id == ad.CategoryId)) { CategoriesDDL.SelectedValue = ad.CategoryId.ToString(); } } var where = TableHelper.MakeDictionary("IsVisibleByMembers", true); if (AppSettings.PtcAdverts.PTCCreditsEnabled) { where["EndMode"] = (int)End.Mode.Clicks; } var listPacks = TableHelper.SelectRows <PtcAdvertPack>(where); if (listPacks.Any(x => x.Id == ad.Pack.Id)) { ddlOptions.SelectedValue = ad.Pack.Id.ToString(); } chbDescription.Checked = !string.IsNullOrEmpty(ad.Description); Description.Visible = chbDescription.Checked; if (chbDescription.Checked) { Description.Text = ad.Description; } else { Description.Text = string.Empty; } chbGeolocation.Checked = ad.IsGeolocated; if (ad.IsGeolocatedByAge) { GeoAgeMin.Text = ad.GeolocatedAgeMin.ToString(); GeoAgeMax.Text = ad.GeolocatedAgeMax.ToString(); } if (ad.IsGeolocatedByGender) { GeoGenderList.SelectedValue = ((int)ad.GeolocatedGender).ToString(); } chbBold.Checked = ad.HasBoldTitle; StarredAdCheckBox.Checked = ad.IsStarredAd; var activeColors = PtcAdvertBgColor.GetActiveBgColors(); if (activeColors.Any(x => x.BgColor == ad.BackgroundColor)) { BgColorsDDL.SelectedValue = activeColors.Where(x => x.BgColor == ad.BackgroundColor).ToList()[0].Id.ToString(); } var freeBgColors = activeColors.Where(x => x.Price == Money.Zero); BackgroundColorCheckBox.Checked = !freeBgColors.Any(x => x.BgColor == ad.BackgroundColor); CaptchaQuestionCheckBox.Checked = ad.CaptchaQuestion != AppSettings.PtcAdverts.PTCDefaultCaptchaQuestion; CaptchaQuestionTexbox.Visible = CaptchaQuestionCheckBox.Checked; CaptchaQuestionTexbox.Text = ad.CaptchaQuestion; if (ad.ExtraViews != -1) { BuyWithPTCCreditsPlaceHolder2.Visible = UseExtraViewsCheckBox.Checked = true; PTCCreditsTextBox.Text = ad.ExtraViews.ToString(); } if (ad.ImagePath != null) { PTCImage_Image.ImageUrl = ad.ImagePath; } }