Example #1
0
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblTitle      = e.Item.FindControl("lblTitle") as Label;
                Label lblTotalOrder = e.Item.FindControl("lblTotalOrder") as Label;
                Label lblAvgOrder   = e.Item.FindControl("lblAvgOrder") as Label;
                Label lblTotalRev   = e.Item.FindControl("lblTotalRev") as Label;

                VersionFieldsReport item = e.Item.DataItem as VersionFieldsReport;
                lblTitle.Text      = item.ShortName;
                lblTotalOrder.Text = item.TotalOrders.ToString();
                lblAvgOrder.Text   = String.Format("${0:0.##}", item.AverageOrder);
                lblTotalRev.Text   = String.Format("${0:0.##}", item.TotalRevenue);
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Label lblSumTotalOrder        = e.Item.FindControl("lblSumTotalOrder") as Label;
                Label lblSumAvgOrder          = e.Item.FindControl("lblSumAvgOrder") as Label;
                Label lblSumTotalRev          = e.Item.FindControl("lblSumTotalRev") as Label;
                VersionFieldsReport foundItem = dtCollectionList[0].Find(y => y.CatgoryId == CategoryId);
                if (foundItem != null)
                {
                    lblSumTotalOrder.Text = foundItem.TotalOrders.ToString();
                    lblSumAvgOrder.Text   = String.Format("${0:0.##}", foundItem.AverageOrder);
                    lblSumTotalRev.Text   = String.Format("${0:0.##}", foundItem.TotalRevenue);
                }
            }
        }
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblTitle         = e.Item.FindControl("lblTitle") as Label;
                Label lblTotalOrder    = e.Item.FindControl("lblTotalOrder") as Label;
                Label lblTotalRev      = e.Item.FindControl("lblTotalRev") as Label;
                Label lbHitLinkVisitor = e.Item.FindControl("lbHitLinkVisitor") as Label;
                Label lblConversion    = e.Item.FindControl("lblConversion") as Label;

                VersionFieldsReport item = e.Item.DataItem as VersionFieldsReport;

                lblTitle.Text      = item.Title;
                lblTotalOrder.Text = item.TotalOrders.ToString();
                if (item.UniqueVisitors > 0)
                {
                    lbHitLinkVisitor.Text = string.Format("{0:##,##}", item.UniqueVisitors);
                }
                else
                {
                    lbHitLinkVisitor.Text = "0";
                }

                lblConversion.Text = String.Format("{0}", item.Conversion);

                lblTotalRev.Text = String.Format("{0:0.##}", Math.Round(item.TotalRevenue, 2).ToString("n2"));

                CategoryUniqueVistiors += item.UniqueVisitors;
                totalOrders            += item.TotalOrders;
                totalRevenue           += item.TotalRevenue;
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Label lblSumTotalOrder      = e.Item.FindControl("lblSumTotalOrder") as Label;
                Label lblSumTotalRev        = e.Item.FindControl("lblSumTotalRev") as Label;
                Label lblSumHitLinkVisitor  = e.Item.FindControl("lblSumHitLinkVisitor") as Label;
                Label lblSumTotalConversion = e.Item.FindControl("lblSumTotalConversion") as Label;


                if (CategoryUniqueVistiors > 0)
                {
                    lblSumTotalConversion.Text = String.Format("{0}", Math.Round((totalOrders * 100) / CategoryUniqueVistiors, 2));
                    lblSumHitLinkVisitor.Text  = string.Format("{0:##,##}", CategoryUniqueVistiors);
                }
                else
                {
                    lblSumTotalConversion.Text = "0";
                    lblSumHitLinkVisitor.Text  = "0";
                }

                lblSumTotalOrder.Text = totalOrders.ToString();
                lblSumTotalRev.Text   = String.Format("{0:C}", totalRevenue);
            }
        }
Example #3
0
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblTitle           = e.Item.FindControl("lblTitle") as Label;
                Label lblTotalOrder      = e.Item.FindControl("lblTotalOrder") as Label;
                Label lblAvgOrder        = e.Item.FindControl("lblAvgOrder") as Label;
                Label lblTotalRev        = e.Item.FindControl("lblTotalRev") as Label;
                Label lbHitLinkVisitor   = e.Item.FindControl("lbHitLinkVisitor") as Label;
                Label lblConversion      = e.Item.FindControl("lblConversion") as Label;
                Label lblRevenuePerVisit = e.Item.FindControl("lblRevenuePerVisit") as Label;

                VersionFieldsReport item = e.Item.DataItem as VersionFieldsReport;

                lblTitle.Text = item.ShortName;
                if (item.TotalOrders > 0)
                {
                    lblTotalOrder.Text = string.Format("{0:##,##}", item.TotalOrders);
                }
                else
                {
                    lblTotalOrder.Text = "0";
                }

                if (item.UniqueVisitors > 0)
                {
                    lbHitLinkVisitor.Text = string.Format("{0:##,##}", item.UniqueVisitors);
                }
                else
                {
                    lbHitLinkVisitor.Text = "0";
                }


                lblConversion.Text      = String.Format("{0}%", item.Conversion);
                lblRevenuePerVisit.Text = String.Format("{0:C}", item.RevenuePerVisit);
                lblAvgOrder.Text        = String.Format("{0:C}", item.AverageOrder);
                lblTotalRev.Text        = String.Format("{0:C}", item.TotalRevenue);

                CategoryUniqueVistiors += item.UniqueVisitors;
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Label lblSumTotalOrder      = e.Item.FindControl("lblSumTotalOrder") as Label;
                Label lblSumAvgOrder        = e.Item.FindControl("lblSumAvgOrder") as Label;
                Label lblSumTotalRev        = e.Item.FindControl("lblSumTotalRev") as Label;
                Label lblSumHitLinkVisitor  = e.Item.FindControl("lblSumHitLinkVisitor") as Label;
                Label lblSumTotalConversion = e.Item.FindControl("lblSumTotalConversion") as Label;
                Label lblSumRevenuePerClick = e.Item.FindControl("lblSumRevenuePerClick") as Label;

                HtmlContainerControl versionFooter = e.Item.FindControl("versionFooter") as HtmlContainerControl;
                VersionFieldsReport  foundItem     = dtCollectionList[0].Find(y => y.CatgoryId == CategoryId);
                if (dtCollectionList[0].Count == 1)
                {
                    versionFooter.Visible = false;
                }
                else
                {
                    versionFooter.Visible = true;
                }
                if (foundItem != null)
                {
                    if (CategoryUniqueVistiors > 0)
                    {
                        lblSumHitLinkVisitor.Text = string.Format("{0:##,##}", CategoryUniqueVistiors);

                        lblSumTotalConversion.Text = String.Format("{0}%", Math.Round((foundItem.TotalOrders * 100) / CategoryUniqueVistiors, 1));
                        lblSumRevenuePerClick.Text = String.Format("{0:C}", Math.Round(foundItem.TotalRevenue / CategoryUniqueVistiors, 2));
                    }
                    else
                    {
                        lblSumHitLinkVisitor.Text  = "0";
                        lblSumTotalConversion.Text = "0";
                        lblSumRevenuePerClick.Text = "0";
                    }

                    if (foundItem.TotalOrders > 0)
                    {
                        lblSumTotalOrder.Text = string.Format("{0:##,##}", foundItem.TotalOrders);
                    }
                    else
                    {
                        lblSumTotalOrder.Text = "0";
                    }


                    lblSumAvgOrder.Text = String.Format("{0:C}", foundItem.AverageOrder);
                    lblSumTotalRev.Text = String.Format("{0:C}", foundItem.TotalRevenue);

                    TotalCategoryUniqueVistiors += CategoryUniqueVistiors;
                    TotalOrders  += foundItem.TotalOrders;
                    TotalRevenue += foundItem.TotalRevenue;
                }
            }
        }