Esempio n. 1
0
    protected void MyBannersGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var advert = new ExternalBannerAdvert(Convert.ToInt32(e.Row.Cells[0].Text));

            try
            {
                var bannerImage     = advert.Image;
                var imageWebControl = new Image
                {
                    ImageUrl = bannerImage.Path,
                    Width    = Unit.Pixel(bannerImage.Width / 10),
                    Height   = Unit.Pixel(bannerImage.Height / 10)
                };

                e.Row.Cells[2].Text = string.Empty;
                e.Row.Cells[2].Controls.Add(imageWebControl);

                e.Row.Cells[4].Text = bannerImage.Width + " x " + bannerImage.Height;
                e.Row.Cells[5].Text = HtmlCreator.GenerateCPAAdProgressHTML(advert.ClicksReceived, advert.ClicksBought);
            }
            catch (Exception ex)
            {
                e.Row.Cells[2].Text = string.Empty;
            }
        }
    }
Esempio n. 2
0
    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);
        }
    }
Esempio n. 3
0
    protected void ClosedGroupsGridView2_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int userId            = Convert.ToInt32(e.Row.Cells[0].Text);
            int userCustomGroupId = Convert.ToInt32(e.Row.Cells[7].Text);

            //userId
            e.Row.Cells[0].Text = new Member(userId).Name;

            //Name
            e.Row.Cells[1].BackColor = System.Drawing.Color.FromName(e.Row.Cells[2].Text);

            //insert link
            e.Row.Cells[1].Text = string.Format("<span style='font-weight:bold'><a style='color:white;' href='{0}user/advert/groups/customgroup.aspx?g={1}'>{2}<a/><span/>", AppSettings.Site.Url, userCustomGroupId, e.Row.Cells[1].Text);

            //Color
            e.Row.Cells[2].Visible = false;

            //AdPacksAdded
            e.Row.Cells[3].Text = HtmlCreator.GenerateCPAAdProgressHTML(Convert.ToInt32(e.Row.Cells[3].Text), Convert.ToInt32(e.Row.Cells[4].Text),
                                                                        AppSettings.RevShare.AdPack.AdPackNamePlural);

            //AdPacksLimit
            e.Row.Cells[4].Visible = false;

            //Percentage
            e.Row.Cells[5].Visible = false;

            //Daily profit
            if (AppSettings.RevShare.AdPack.CustomReturnOption == CustomReturnOption.Increase)
            {
                e.Row.Cells[6].Text = "+" + Convert.ToInt32(e.Row.Cells[6].Text).ToString();
            }

            e.Row.Cells[6].Text += "%";

            //UserGroupId - > Number of participants
            e.Row.Cells[7].Text = AdPackManager.GetNumberOfParticipantsInGroup(userCustomGroupId).ToString();
            // e.Row.Cells[8].Visible = false;
        }
        else if (e.Row.RowType == DataControlRowType.Header)
        {
            e.Row.Cells[2].Visible = false;

            e.Row.Cells[4].Visible = false;
            e.Row.Cells[5].Visible = false;

            if (AppSettings.RevShare.AdPack.CustomReturnOption == CustomReturnOption.Accelerate)
            {
                ClosedGroupsGridView2.Columns[6].HeaderText = U4200.DAILYPROFITRAISEDBY;
            }
            else if (AppSettings.RevShare.AdPack.CustomReturnOption == CustomReturnOption.Increase)
            {
                ClosedGroupsGridView2.Columns[6].HeaderText = U5001.PROFITRAISEDBY;
            }
        }
    }
Esempio n. 4
0
    protected void SurfAdsStatsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            if (!AppSettings.RevShare.AdPack.EnableAdvertChange)
            {
                e.Row.Cells[0].ControlStyle.CssClass = "displaynone";
            }

            if (!AppSettings.RevShare.AdPack.IsStartPageEnabled)
            {
                e.Row.Cells[4].ControlStyle.CssClass = "displaynone";
            }

            AdPack adPack = new AdPack(Convert.ToInt32(e.Row.Cells[1].Text));

            e.Row.Cells[2].Text = HtmlCreator.GenerateCPAAdProgressHTML(Convert.ToInt32(e.Row.Cells[2].Text), Convert.ToInt32(adPack.ClicksBought), L1.CLICKS.ToLower());

            if ((e.Row.Cells[4].Text.ToLower() == "&nbsp;"))
            {
                e.Row.Cells[4].Text = "-";
            }
            else
            {
                try
                {
                    DateTime StartPageDate = Convert.ToDateTime(e.Row.Cells[4].Text);
                    if (StartPageDate < DateTime.Now.AddDays(-3))
                    {
                        //We do not show older then 3 days
                        e.Row.Cells[4].Text = "-";
                    }
                    else
                    {
                        e.Row.Cells[4].Text = StartPageDate.ToShortDateString();
                    }
                }
                catch { }
            }
        }
        else if (e.Row.RowType == DataControlRowType.Header)
        {
            if (!AppSettings.RevShare.AdPack.EnableAdvertChange)
            {
                SurfAdsStatsGridView.Columns[0].HeaderStyle.CssClass = "displaynone";
            }

            if (!AppSettings.RevShare.AdPack.IsStartPageEnabled)
            {
                SurfAdsStatsGridView.Columns[4].HeaderStyle.CssClass = "displaynone";
            }

            SurfAdsStatsGridView.Columns[4].HeaderText = U5001.STARTPAGE;
        }
    }
Esempio n. 5
0
    protected void UserS4DSPacksGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            String Addon = Convert.ToDecimal(e.Row.Cells[1].Text) >= 120 ? "Finished: " : "Purchased: ";

            AdPack           adPack = new AdPack(Convert.ToInt32(e.Row.Cells[0].Text));
            AdPackTypesCache cache  = new AdPackTypesCache();
            var adPackTypes         = (Dictionary <int, AdPackType>)cache.Get();

            e.Row.Cells[1].Text = HtmlCreator.GenerateCPAAdProgressHTML(
                new Money(Convert.ToDecimal(e.Row.Cells[1].Text)).ToDecimal(), adPack.MoneyToReturn.ToDecimal(), AppSettings.Site.CurrencySign);
            e.Row.Cells[2].Text = Addon + e.Row.Cells[2].Text;
        }
    }
Esempio n. 6
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();
        }
    }
Esempio n. 7
0
    protected void MyOfferWallsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var offerWall = new PTCOfferWall(Convert.ToInt32(e.Row.Cells[0].Text));

            e.Row.Cells[3].Text = HtmlCreator.GenerateCPAAdProgressHTML(offerWall.CompletionTimes, offerWall.CompletionTimesBought, U6000.SUBMISSIONS);

            GridView urlsGridView = e.Row.FindControl("MyOfferWallsUrlsGridView") as GridView;

            using (var bridge = ParserPool.Acquire(Database.Client))
            {
                urlsGridView.DataSource = bridge.Instance.ExecuteRawCommandToDataTable(
                    @"SELECT urls.Url 
                    FROM PTCOfferWallsUserUrls mappings 
                    JOIN UserUrls urls 
                    ON mappings.UserUrlId = urls.Id 
                    WHERE mappings.PTCOfferWallId = " + offerWall.Id);
            }
            urlsGridView.DataBind();
        }
    }
Esempio n. 8
0
    public override void DataBind()
    {
        base.DataBind();

        CustomGroup customGroup = new CustomGroup(userCustomGroup.CustomGroupId);

        JoinGroupButton.Text  = U4200.JOINGROUP;
        LeaveGroupButton.Text = U4200.LEAVEGROUP;
        Button1.Text          = userCustomGroup.Name;
        Button2.Text          = U4200.JOINLEAVE;

        string groupURL = AppSettings.Site.Url + "user/advert/groups/customgroup.aspx?g=" + userCustomGroup.Id;

        GroupURL.Text = String.Format("<a href='{0}'>{0}</a>", groupURL);

        GroupNameLiteral.Text = userCustomGroup.Name;

        PacksLeftLiteral.Text = PacksLeftLiteral2.Text = HtmlCreator.GenerateCPAAdProgressHTML(userCustomGroup.AdPacksAdded, customGroup.AdPacksLimit,
                                                                                               AppSettings.RevShare.AdPack.AdPackNamePlural);

        if (userCustomGroup.AdPacksAdded < customGroup.AdPacksLimit)
        {
            OpenGroupPlaceholder.Visible   = true;
            ClosedGroupPlaceHolder.Visible = false;
        }
        else
        {
            OpenGroupPlaceholder.Visible   = false;
            ClosedGroupPlaceHolder.Visible = true;
        }



        GroupDescriptionLiteral.Text = userCustomGroup.Description;

        VideoImagePlaceholder.Style.Add("max-height", GroupStyles.maxPictureHeight.ToString() + "px");
        VideoImagePlaceholder.Style.Add("max-width", GroupStyles.maxPictureWidth.ToString() + "px");

        if (!string.IsNullOrWhiteSpace(userCustomGroup.PromoUrl))
        {
            VideoPanel.Visible = true;
            VideoLiteral.Text  = userCustomGroup.PromoUrl;


            ImagePanel.Visible = false;
        }
        if (!string.IsNullOrWhiteSpace(userCustomGroup.ImagePath))
        {
            ImagePanel.Visible = true;
            ImageLiteral.Text  = "<img src='" + Page.ResolveUrl(userCustomGroup.ImagePath) + "'></img>";

            VideoPanel.Visible = false;
        }

        if (!string.IsNullOrWhiteSpace(userCustomGroup.Email))
        {
            EmailPlaceHolder.Visible = true;
            EmailLiteral.Text        = userCustomGroup.Email;
        }

        if (!string.IsNullOrWhiteSpace(userCustomGroup.Skype))
        {
            SkypePlaceHolder.Visible = true;
            SkypeLiteral.Text        = userCustomGroup.Skype;
        }

        if (!string.IsNullOrWhiteSpace(userCustomGroup.PhoneNumber))
        {
            PhonePlaceHolder.Visible = true;
            PhoneLiteral.Text        = userCustomGroup.PhoneNumber;
        }

        if (!string.IsNullOrWhiteSpace(userCustomGroup.FacebookUrl))
        {
            FacebookPlaceHolder.Visible = true;
            FacebookLiteral.Text        = string.Format("<a href='{0}'>{1}</a>", userCustomGroup.FacebookUrl, userCustomGroup.Name);
        }

        if (AppSettings.RevShare.AdPack.RevShareCustomGroupRewardsEnabled &&
            (userCustomGroup.Status == CustomGroupStatus.Active || userCustomGroup.Status == CustomGroupStatus.Expired))
        {
            //Show rewards info
            RewardInfoPlaceHolder.Visible = true;
            RewardInfoLiteral.Text        = userCustomGroup.BonusExtraInformation;
        }

        NameLiteral.Text            = MemberManager.getUsersProfileURL(new Member(userCustomGroup.CreatorUserId).Name);
        ParticipantListLiteral.Text = GetParticipants();
    }