Exemplo n.º 1
0
    protected void MyInTextAdsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var inTextAd = new InTextAdvert(Convert.ToInt32(e.Row.Cells[0].Text));

            e.Row.Cells[4].Text = HtmlCreator.GenerateCPAAdProgressHTML(inTextAd.ClicksReceived, inTextAd.ClicksBought, L1.CLICKS);

            GridView tagsGridView = e.Row.FindControl("MyInTextAdsTagsGridView") as GridView;

            using (var bridge = ParserPool.Acquire(Database.Client))
            {
                tagsGridView.DataSource = bridge.Instance.ExecuteRawCommandToDataTable(
                    @"SELECT Tag 
                    FROM InTextAdvertsTags 
                    WHERE InTextAdvertId = " + inTextAd.Id);
            }
            tagsGridView.DataBind();
        }
    }
Exemplo n.º 2
0
    protected void CreateInTextAdButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                AppSettings.DemoCheck();

                ErrorMessagePanel.Visible = SuccessMessagePanel.Visible = false;
                var           pack        = new InTextAdvertPack(Convert.ToInt32(PacksDDL.SelectedValue));
                string        url         = UserUrlsRadioButtonList.SelectedItem.Text.Trim();
                string        title       = InputChecker.HtmlEncode(TitleTextBox.Text, TitleTextBox.MaxLength, L1.TITLE);
                string        description = InputChecker.HtmlEncode(DescriptionTextBox.Text, DescriptionTextBox.MaxLength, L1.DESCRIPTION);
                List <string> tags        = TagsTextBox.Text.Replace(" ", string.Empty)
                                            .Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)
                                            .Select(tag => InputChecker.HtmlEncode(tag, 20, U6002.TAG))
                                            .ToList();

                InTextAdvert.Buy(Member.Current, pack, title, description, url, TargetBalanceRadioButtonList.TargetBalance, tags);

                SuccessMessagePanel.Visible = true;
                SuccessMessage.Text         = U6003.CAMPAIGNCREATED;
            }
        }
        catch (Exception ex)
        {
            if (ex is MsgException)
            {
                ErrorMessagePanel.Visible = true;
                ErrorMessage.Text         = ex.Message;
            }
            else
            {
                ErrorLogger.Log(ex);
            }
        }
    }