示例#1
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);
        }
    }
示例#2
0
    protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var chbox = ((HtmlInputCheckBox)e.Row.FindControl("chkSelect"));
            chbox.Attributes.Add("onclick", SelectedPanel.ClientID + ".style.display = 'block';hideIfUnchecked('" + SelectedPanel.ClientID + "');");

            //Expires[4]
            DateTime expires  = Convert.ToDateTime(e.Row.Cells[4].Text);
            int      daysLeft = expires.Subtract(DateTime.Now).Days;
            e.Row.Cells[4].Text = daysLeft.ToString() + " " + L1.DAYS;

            //Last click[5]
            string output;
            if (string.IsNullOrEmpty(e.Row.Cells[5].Text) || e.Row.Cells[5].Text == " ")
            {
                output = "<i>" + L1.NEVER + "</i>";
            }
            else
            {
                DateTime lastActivity = Convert.ToDateTime(e.Row.Cells[5].Text);
                int      days         = (int)Math.Ceiling(DateTime.Now.Subtract(lastActivity).TotalDays);
                switch (days)
                {
                case 1:
                    output = L1.TODAY;
                    break;

                case 2:
                    output = L1.YESTERDAY;
                    break;

                default:
                    output = days.ToString() + " " + L1.DAYSAGO;
                    break;
                }
            }
            e.Row.Cells[5].Text = output;

            //6 AutoPay check image
            var check = (CheckBox)e.Row.Cells[7].Controls[0];
            if (check.Checked)
            {
                e.Row.Cells[7].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[7].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }
        }
    }
示例#3
0
    protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            FacebookAdvert Ad = new FacebookAdvert(Convert.ToInt32(e.Row.Cells[1].Text));

            //[5] ProfilePic
            var check = (CheckBox)e.Row.Cells[5].Controls[0];
            if (check.Checked)
            {
                e.Row.Cells[5].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[5].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }

            //Progress [13]
            e.Row.Cells[13].Text = HtmlCreator.GenerateAdProgressHTML(Ad).Replace("clicks", L1.LIKESSMALL);

            // % [14]
            e.Row.Cells[14].Text = Ad.ProgressInPercent + "%";

            // Likes (Clicks) [15]
            e.Row.Cells[15].Text = Ad.Clicks.ToString();

            //Status [16]
            e.Row.Cells[16].Text = HtmlCreator.GetColoredStatus(Ad.Status);

            //start [19] stop [20] remove[21]
            if (Ad.Status != AdvertStatus.Paused)
            {
                e.Row.Cells[19].Text = "&nbsp;";
            }

            if (Ad.Status != AdvertStatus.Active)
            {
                e.Row.Cells[20].Text = "&nbsp;";
            }

            if (!Ad.Status.CanBeRemoved())
            {
                e.Row.Cells[21].Text = "&nbsp;";
            }
        }
    }
示例#4
0
    protected void FacebookLikesGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            FacebookAdvert Ad = new FacebookAdvert(Convert.ToInt32(e.Row.Cells[0].Text));

            //[2] Profile picture
            var check = (CheckBox)e.Row.Cells[2].Controls[0];
            if (check.Checked)
            {
                e.Row.Cells[2].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[2].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }

            //[3] Facebook like button
            e.Row.Cells[3].Text = FacebookMember.GetLikeButtonCode(Ad);

            if (FbUser != null && !User.AdsLiked.Contains(Ad.Id))
            {
                e.Row.Cells[1].Text += String.Format(" ({0} {1})", L1.YOUHAVE, FbUser.Friends);

                if (FbUser.Friends >= Ad.MinFriends)
                {
                    e.Row.Cells[1].ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    e.Row.Cells[1].ForeColor = System.Drawing.Color.DarkRed;
                }

                if (Ad.HasProfilePicRestrictions && !FbUser.HasProfilePicture)
                {
                    e.Row.Cells[2].Text      = L1.NEEDED.ToUpper();
                    e.Row.Cells[2].ForeColor = System.Drawing.Color.DarkRed;
                }
                else
                {
                    e.Row.Cells[2].Text      = "OK";
                    e.Row.Cells[2].ForeColor = System.Drawing.Color.Green;
                }
            }

            if (AppSettings.Facebook.CustomFacebookLikesEnabled)
            {
                //[4] Titan like button
                LinkButton btn = e.Row.FindControl("LikeButton") as LinkButton;
                if (FbUser != null && !User.AdsLiked.Contains(Ad.Id) && FbUser.Friends >= Ad.MinFriends && (!Ad.HasProfilePicRestrictions || Ad.HasProfilePicRestrictions && FbUser.HasProfilePicture))
                {
                    btn.ToolTip     = "Like";
                    btn.CommandName = "like";
                    btn.Text        = "<span class=\"fa fa-plus fa-lg text-success\"></span>";
                }
                else
                {
                    btn.ToolTip = "Forbidden";
                    btn.Text    = "<span class=\"fa fa-times fa-lg text-danger\"></span>";
                    btn.Enabled = false;
                }
            }
        }
    }
示例#5
0
    protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //The ad id [1]
            TrafficExchangeAdvert Ad = new TrafficExchangeAdvert(Convert.ToInt32(e.Row.Cells[1].Text));

            //Description [22]
            if (string.IsNullOrEmpty(e.Row.Cells[22].Text))
            {
                e.Row.Cells[22].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }
            else
            {
                e.Row.Cells[22].Text = HtmlCreator.GetCheckboxCheckedImage();
            }

            //End mode [16]
            End.Mode Mode = (End.Mode)Convert.ToInt32(e.Row.Cells[16].Text);

            //Status [24]
            AdvertStatus Status = (AdvertStatus)Convert.ToInt32(e.Row.Cells[24].Text);
            e.Row.Cells[24].Text = HtmlCreator.GetColoredStatus(Status);

            //Subpages [25]
            e.Row.Cells[25].Text = "0";
            var splist = TableHelper.SelectRows <TrafficExchangeSubpage>(TableHelper.MakeDictionary("PtcAdId", Ad.Id));
            if (splist.Count > 0)
            {
                e.Row.Cells[25].Text = splist.Count + " (hover)";
                foreach (var elem in splist)
                {
                    e.Row.Cells[25].ToolTip += Ad.TargetUrl + elem.SubPage + "\n";
                }
            }

            //Pack [3]
            AdvertPack Pack = new TrafficExchangeAdvertPack(Convert.ToInt32(e.Row.Cells[3].Text));

            //Displaytime [17]
            e.Row.Cells[17].Text += "s";

            //Shorten url [4]
            if (e.Row.Cells[4].Text.Length > 18)
            {
                e.Row.Cells[4].Text = e.Row.Cells[4].Text.Substring(0, 15) + "...";
            }

            //TItle [5]
            e.Row.Cells[5].Text = e.Row.Cells[5].Text.Replace("&lt;", "<");
            e.Row.Cells[5].Text = e.Row.Cells[5].Text.Replace("&gt;", ">");

            //Progress [11]
            e.Row.Cells[11].Text = HtmlCreator.GenerateAdProgressHTML(Ad).Replace("clicks", L1.CLICKSSMALL).Replace("days", L1.DAYS);

            //Geolocation check [23]
            if (Ad.IsGeolocated)
            {
                e.Row.Cells[23].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[23].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }

            //Add % progress [12]
            e.Row.Cells[12].Text = Ad.ProgressInPercent.ToString() + "%";

            //Add total views [13]
            e.Row.Cells[13].Text = e.Row.Cells[14].Text;

            // Start[27] Pause[28] Add [29] Remove[31]
            if (Status != AdvertStatus.Paused)
            {
                e.Row.Cells[27].Text = "&nbsp;";
            }

            if (Status != AdvertStatus.Active)
            {
                e.Row.Cells[28].Text = "&nbsp;";
            }

            if (Status != AdvertStatus.Finished)
            {
                e.Row.Cells[29].Text = "&nbsp;";
            }

            if (!Status.CanBeRemoved())
            {
                e.Row.Cells[31].Text = "&nbsp;";
            }
        }
    }
示例#6
0
    protected void AdvertsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //[0] Id - hidden
            var ptpAd = new PaidToPromoteAdvert(Convert.ToInt32(e.Row.Cells[0].Text));

            //[1] PackId - hidden
            var ptpPack = new PaidToPromotePack(Convert.ToInt32(e.Row.Cells[1].Text));

            //[2] TargetUrl
            var link = e.Row.Cells[2].Text;
            e.Row.Cells[2].Text = string.Format("<a href='{0}' target='_blank'>{0}</a>", link);

            //[3] CreationDate
            //OK

            //[4] FinishDate - can be null
            //OK

            //[5] Creation Date - change it to progress
            e.Row.Cells[5].Text = HtmlCreator.GenerateProgressHTML(0m, ptpAd.EndValue, (decimal)ptpPack.Ends.Value);

            //[6] EndValue - change to End Mode
            var Mode = ptpPack.Ends.EndMode;
            e.Row.Cells[6].Text = Mode.ToString();

            //[7] EndValue(title: Click/Days) - Depend on Pack change it to click/days
            if (Mode == End.Mode.Clicks)
            {
                e.Row.Cells[7].Text += string.Format(" {0}", L1.CLICKS);
            }
            else
            {
                e.Row.Cells[7].Text += string.Format(" {0}", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(L1.DAYS.ToLower()));
            }

            //[8] GeolocatedCC - check all geo and add checkBox
            if (ptpAd.IsGeo())
            {
                e.Row.Cells[8].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[8].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }

            //[9] Status
            var status = (AdvertStatus)Convert.ToInt32(e.Row.Cells[9].Text);
            e.Row.Cells[9].Text = HtmlCreator.GetColoredStatus(status);

            //[10] Remove button
            //OK
        }
        else if (e.Row.RowType == DataControlRowType.Header)
        {
            AdvertsGridView.Columns[2].HeaderText = U6008.TARGETURL;
            AdvertsGridView.Columns[3].HeaderText = L1.CREATED;
            AdvertsGridView.Columns[4].HeaderText = L1.FINISHED;
            AdvertsGridView.Columns[5].HeaderText = L1.PROGRESS;
            AdvertsGridView.Columns[7].HeaderText = string.Format("{0}/{1}", L1.CLICKS, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(L1.DAYS.ToLower()));
            AdvertsGridView.Columns[9].HeaderText = L1.STATUS;
        }
    }
示例#7
0
    protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //The ad id [1]
            TrafficGridAdvert Ad = new TrafficGridAdvert(Convert.ToInt32(e.Row.Cells[1].Text));

            //Description [22]
            if (string.IsNullOrEmpty(e.Row.Cells[22].Text))
            {
                e.Row.Cells[22].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }
            else
            {
                e.Row.Cells[22].Text = HtmlCreator.GetCheckboxCheckedImage();
            }

            //End mode [16]
            End.Mode Mode = (End.Mode)Convert.ToInt32(e.Row.Cells[16].Text);

            //Status [24]
            AdvertStatus Status = (AdvertStatus)Convert.ToInt32(e.Row.Cells[24].Text);
            e.Row.Cells[24].Text = HtmlCreator.GetColoredStatus(Status);

            //Pack [3]
            AdvertPack Pack = new TrafficGridAdvertPack(Convert.ToInt32(e.Row.Cells[3].Text));

            //Displaytime [17]
            e.Row.Cells[17].Text += "s";

            //Shorten url [4]
            if (e.Row.Cells[4].Text.Length > 18)
            {
                e.Row.Cells[4].Text = e.Row.Cells[4].Text.Substring(0, 15) + "...";
            }

            //TItle [5]
            e.Row.Cells[5].Text = e.Row.Cells[5].Text.Replace("&lt;", "<");
            e.Row.Cells[5].Text = e.Row.Cells[5].Text.Replace("&gt;", ">");

            //Progress [11]
            string ProgressBarStatus = "";
            if (Status == AdvertStatus.Active)
            {
                ProgressBarStatus = "active";
            }
            e.Row.Cells[11].Text = HtmlCreator.GenerateAdProgressHTML(Ad, ProgressBarStatus).Replace("clicks", L1.CLICKSSMALL).Replace("days", L1.DAYS);

            //Geolocation check [23]
            var check = (CheckBox)e.Row.Cells[23].Controls[0];
            if (check.Checked)
            {
                e.Row.Cells[23].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[23].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }

            //Add % progress [12]
            e.Row.Cells[12].Text = Ad.ProgressInPercent.ToString() + "%";

            //Add total views [13]
            e.Row.Cells[13].Text = e.Row.Cells[14].Text;

            // Start[27] Pause[28] Add [29] Remove[30]
            if (Status != AdvertStatus.Paused)
            {
                e.Row.Cells[27].Text = "&nbsp;";
            }

            if (Status != AdvertStatus.Active)
            {
                e.Row.Cells[28].Text = "&nbsp;";
            }

            e.Row.Cells[29].Text = "&nbsp;";

            if (!Status.CanBeRemoved())
            {
                e.Row.Cells[30].Text = "&nbsp;";
            }
        }
    }
示例#8
0
    protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            BannerAdvert BannerAd = new BannerAdvert(Convert.ToInt32(e.Row.Cells[1].Text));

            //Image [4]
            var Imag = new Image();
            Imag.ImageUrl = e.Row.Cells[4].Text;
            Imag.Height   = Unit.Percentage(33);

            e.Row.Cells[4].Text = "";
            e.Row.Cells[4].Controls.Add(Imag);

            //Shorten url [3]
            if (e.Row.Cells[3].Text.Length > 19)
            {
                e.Row.Cells[3].Text = e.Row.Cells[3].Text.Substring(0, 16) + "...";
            }

            //End mode [15]
            End.Mode Mode = (End.Mode)Convert.ToInt32(e.Row.Cells[15].Text);

            //Pack [2]
            BannerAdvertPack Pack = new BannerAdvertPack(Convert.ToInt32(e.Row.Cells[2].Text));

            //Status [16]
            AdvertStatus Status = (AdvertStatus)Convert.ToInt32(e.Row.Cells[16].Text);
            e.Row.Cells[16].Text = HtmlCreator.GetColoredStatus(Status);

            //Progress [10]
            e.Row.Cells[10].Text =
                HtmlCreator.GenerateAdProgressHTML(BannerAd).Replace("Clicks", L1.CLICKSSMALL).Replace("days", L1.DAYS);

            if (AppSettings.BannerAdverts.ImpressionsEnabled)
            {
                e.Row.Cells[10].Text = e.Row.Cells[10].Text.Replace(L1.CLICKSSMALL, L1.IMPRESSIONSSMALL);
            }

            //% [11]
            e.Row.Cells[11].Text = BannerAd.ProgressInPercent.ToString() + "%";

            //start [20] stop [21] remove[22]
            if (Status != AdvertStatus.Paused)
            {
                e.Row.Cells[20].Text = "&nbsp;";
            }

            if (Status != AdvertStatus.Active)
            {
                e.Row.Cells[21].Text = "&nbsp;";
            }

            if (!Status.CanBeRemoved())
            {
                e.Row.Cells[22].Text = "&nbsp;";
            }

            //geo [19]

            if (BannerAd.IsGeolocated)
            {
                e.Row.Cells[19].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[19].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }
        }
        else if (e.Row.RowType == DataControlRowType.Header)
        {
            e.Row.Cells[13].Text = AppSettings.BannerAdverts.ImpressionsEnabled ? L1.IMPRESSIONS : L1.CLICKS;
        }
    }
示例#9
0
    protected void DirectRefsGridView_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            //The ad id [1]
            PtcAdvert Ad = new PtcAdvert(Convert.ToInt32(e.Row.Cells[1].Text));

            //Description [23]
            if (string.IsNullOrEmpty(e.Row.Cells[23].Text))
            {
                e.Row.Cells[23].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }
            else
            {
                e.Row.Cells[23].Text = HtmlCreator.GetCheckboxCheckedImage();
            }

            //End mode [17]
            End.Mode Mode = (End.Mode)Convert.ToInt32(e.Row.Cells[17].Text);

            //Status [25]
            AdvertStatus Status = (AdvertStatus)Convert.ToInt32(e.Row.Cells[25].Text);
            e.Row.Cells[25].Text = HtmlCreator.GetColoredStatus(Status);

            //Pack [3]
            AdvertPack Pack = new PtcAdvertPack(Convert.ToInt32(e.Row.Cells[3].Text));

            //Displaytime [18]
            e.Row.Cells[18].Text += "s";

            //Shorten url [4]
            if (e.Row.Cells[4].Text.Length > 18)
            {
                e.Row.Cells[4].Text = e.Row.Cells[4].Text.Substring(0, 15) + "...";
            }

            //TItle [5]
            e.Row.Cells[5].Text = e.Row.Cells[5].Text.Replace("&lt;", "<");
            e.Row.Cells[5].Text = e.Row.Cells[5].Text.Replace("&gt;", ">");

            e.Row.Cells[5].Text = Ad.TargetUrl;

            string starredAd = Ad.IsStarredAd ? "<img src='Images/Misc/star.png' style='width:16px;height:16px;'> " : "";
            string targetUrl = Ad.TargetUrl.Length > 12 ? Ad.TargetUrl.Substring(0, 12) + "..." : Ad.TargetUrl;
            e.Row.Cells[5].Text = starredAd + Ad.Title + "<br/><i>" + targetUrl + "</i>";

            //Progress [11]
            e.Row.Cells[11].Text = HtmlCreator.GenerateAdProgressHTML(Ad).Replace("clicks", L1.CLICKSSMALL).Replace("days", L1.DAYS);

            //PointsEarnedFromViews [12]
            if (AppSettings.PtcAdverts.PTCCreditsEnabled)
            {
                e.Row.Cells[12].Text = string.Format("{0}/~{1}", Ad.PointsEarnedFromViews, Member.CurrentInCache.Membership.PointsYourPTCAdBeingViewed * Ad.Ends.Value);
            }
            else
            {
                e.Row.Cells[12].CssClass = "displaynone";
            }


            //Add % progress [13]
            e.Row.Cells[13].Text = Ad.ProgressInPercent.ToString() + "%";

            //Add total views [14]
            e.Row.Cells[14].Text = e.Row.Cells[15].Text;

            //Geolocation check [24]
            var check = (CheckBox)e.Row.Cells[24].Controls[0];
            if (check.Checked)
            {
                e.Row.Cells[24].Text = HtmlCreator.GetCheckboxCheckedImage();
            }
            else
            {
                e.Row.Cells[24].Text = HtmlCreator.GetCheckboxUncheckedImage();
            }

            // Start[31] Pause[32] Add [33] Remove [34]
            if (Status != AdvertStatus.Paused)
            {
                e.Row.Cells[31].Text = "&nbsp;";
            }

            if (Status != AdvertStatus.Active)
            {
                e.Row.Cells[32].Text = "&nbsp;";
            }

            if (Status != AdvertStatus.Finished)
            {
                e.Row.Cells[33].Text = "&nbsp;";
            }

            if (!Status.CanBeRemoved())
            {
                e.Row.Cells[34].Text = "&nbsp;";
            }

            //Edit button [35]
            ((LinkButton)e.Row.Cells[35].FindControl("ImageButton4")).ToolTip = U5007.EDIT;
            if (Ad.Status == AdvertStatus.Rejected)
            {
                e.Row.Cells[35].Controls.Clear();
            }
        }
        else if (e.Row.RowType == DataControlRowType.Header)
        {
            //PointsEarnedFromViews [12]
            DirectRefsGridView.Columns[12].HeaderText = string.Format(U5007.EARNED, AppSettings.PointsName);
        }

        if (!AppSettings.PtcAdverts.FeedbackCaptchaEnabled)
        {
            DirectRefsGridView.Columns[28].HeaderStyle.CssClass = "displaynone";
            DirectRefsGridView.Columns[29].HeaderStyle.CssClass = "displaynone";
            DirectRefsGridView.Columns[30].HeaderStyle.CssClass = "displaynone";
            DirectRefsGridView.Columns[28].ItemStyle.CssClass   = "displaynone";
            DirectRefsGridView.Columns[29].ItemStyle.CssClass   = "displaynone";
            DirectRefsGridView.Columns[30].ItemStyle.CssClass   = "displaynone";
        }


        if (!AppSettings.PtcAdverts.PTCCreditsEnabled)
        {
            DirectRefsGridView.Columns[12].HeaderStyle.CssClass = "displaynone";
        }
    }
示例#10
0
    public static string Format(int rowIndex, string value, bool formatCheckboxes = true)
    {
        //Add text "unlimited" for unlimited values
        if (unlimitedTextRows.Contains(rowIndex))
        {
            try
            {
                decimal limit = Convert.ToDecimal(value.Replace("%", ""));
                if (limit >= 1000000000)
                {
                    return(U5001.UNLIMITED);
                }
            }
            catch (FormatException ex) { }
        }

        //Parse to money
        if (moneyRows.Contains(rowIndex))
        {
            return(Money.Parse(value).ToString());
        }

        //Add percentage icon
        if (percentageRows.Contains(rowIndex))
        {
            return(NumberUtils.FormatPercents(value));
        }

        //Add Points name
        if (pointsRows.Contains(rowIndex))
        {
            return(String.Format("{0} {1}", value, AppSettings.PointsName));
        }

        //True-False check
        if (trueFalseRows.Contains(rowIndex))
        {
            var boolValue = Boolean.Parse(value);
            if (boolValue)
            {
                return(formatCheckboxes ? HtmlCreator.GetCheckboxCheckedImage() : boolValue.ToString().ToLower());
            }
            else
            {
                return(formatCheckboxes ? HtmlCreator.GetCheckboxUncheckedImage() : boolValue.ToString().ToLower());
            }
        }

        //Add seconds
        if (secondsRows.Contains(rowIndex))
        {
            return(String.Format("{0} {1}", value, L1.SECONDS));
        }

        //Seconds to days
        if (secondsToDaysRows.Contains(rowIndex))
        {
            TimeSpan timeSpan = TimeSpan.FromSeconds(Convert.ToInt32(value));
            return(timeSpan.TotalDays.ToString() + " " + L1.DAYS);
        }

        //Add days
        if (daysRows.Contains(rowIndex))
        {
            return(string.Format("{0} day(s)", value));
        }

        return(value);
    }