Пример #1
0
 protected Panel GetCustomCategoryPanel(int categoryId, bool isFromFilter = false)
 {
     if (CreatedCustomCategories.Contains(categoryId))
     {
         return((Panel)CustomCategoriesPlaceHolder.FindControl("CustomCategoriesAdsPlanel" + categoryId));
     }
     else if (!isFromFilter)
     {
         CreatedCustomCategories.Add(categoryId);
         PtcAdvertCategory category = new PtcAdvertCategory(categoryId);
         Panel             panel    = new Panel();
         panel.ID           = "CustomCategoriesAdsPlanel" + categoryId;
         panel.CssClass     = "gallery row";
         panel.ClientIDMode = ClientIDMode.Static;
         Literal     literal        = new Literal();
         PlaceHolder adsplaceholder = new PlaceHolder();
         adsplaceholder.ID = "CustomCategoriesAdsPlaceHolder" + categoryId;
         literal.Text      = "<h3>" + category.Name + "</h3><br/>";
         panel.Attributes.Add("style", "overflow:auto");
         panel.Controls.Add(literal);
         panel.Controls.Add(adsplaceholder);
         CustomCategoriesPlaceHolder.Controls.Add(panel);
         return(panel);
     }
     return(null);
 }
Пример #2
0
    private void LoadCustomCategoryButton(int categoryId)
    {
        PtcAdvertCategory category = new PtcAdvertCategory(categoryId);
        LinkButton        btn      = new LinkButton();

        btn.ID       = "CustomCategoryButton" + categoryId;
        btn.CssClass = "btn btn-default btn-xs";
        btn.Attributes.Add("data-option-value", ".gallery-group-" + categoryId);
        btn.Text          = category.Name;
        btn.ClientIDMode  = ClientIDMode.Static;
        btn.OnClientClick = "return false;";
        CategoryButtonsPlaceHolder.Controls.Add(btn);
    }
Пример #3
0
    private void BindDataCategoriesToDDL()
    {
        var activeCategories = PtcAdvertCategory.GetActiveCategories();
        var dictlist         = new Dictionary <string, string>();

        foreach (var category in activeCategories)
        {
            dictlist[category.Id.ToString()] = category.Name;
        }
        CategoriesDDL.DataSource     = dictlist;
        CategoriesDDL.DataTextField  = "Value";
        CategoriesDDL.DataValueField = "Key";
        CategoriesDDL.DataBind();
    }
Пример #4
0
    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;
        }
    }