Esempio n. 1
0
        protected void dlVersionCategoryList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            CSBusiness.VersionCategory versionItem = e.Item.DataItem as CSBusiness.VersionCategory;
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblCategory = e.Item.FindControl("lblCategory") as Label;

                lblCategory.Text = versionItem.Title;
                DataList dlVersionItemList       = (DataList)e.Item.FindControl("dlVersionItemList");
                List <VersionFieldsReport> items = dtCollectionList[1].FindAll(y => y.CatgoryId == versionItem.CategoryId);
                CategoryId = versionItem.CategoryId;
                if (items.Count > 0)
                {
                    dlVersionItemList.DataSource = items;
                    dlVersionItemList.DataBind();
                }
            }
        }
Esempio n. 2
0
        public static List <VersionCategory> GetAllVersionCateogry()
        {
            List <VersionCategory> cateogryList = new List <VersionCategory>();

            using (SqlDataReader reader = AdminDAL.GetAllVersionCateogry())
            {
                while (reader.Read())
                {
                    VersionCategory item = new VersionCategory();
                    item.CategoryId = Convert.ToInt32(reader["CategoryId"]);
                    item.Title      = reader["Title"].ToString();
                    item.Visible    = Convert.ToBoolean(reader["Visible"]);
                    item.HideRemove = Convert.ToBoolean(reader["flag"]);

                    cateogryList.Add(item);
                }
            }

            return(cateogryList);
        }
Esempio n. 3
0
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            CSBusiness.VersionCategory versionItem = e.Item.DataItem as CSBusiness.VersionCategory;
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ITextControl lblTitle   = e.Item.FindControl("lblTitle") as ITextControl;
                ITextControl lblStatus  = e.Item.FindControl("lblStatus") as ITextControl;
                ITextControl lblCategoy = e.Item.FindControl("lblCategoy") as ITextControl;

                LinkButton lbRemove = e.Item.FindControl("lbRemove") as LinkButton;
                lblTitle.Text = versionItem.Title;

                //Make sure admin mistakenly remove category
                if (versionItem.Title.ToLower() == "default")
                {
                    lbRemove.Visible = false;
                }

                if (versionItem.HideRemove)
                {
                    lbRemove.Visible = false;
                }
            }
        }
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            CSBusiness.VersionCategory versionItem = e.Item.DataItem as CSBusiness.VersionCategory;
            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;

                ReportFields item = e.Item.DataItem as ReportFields;

                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;


                DataList            dlUrlList = (DataList)e.Item.FindControl("dlUrlList");
                List <ReportFields> items     = dtCollectionList[2].FindAll(y => y.VersionId == item.VersionId);
                if (items.Count > 0)
                {
                    dlUrlList.DataSource = items;
                    dlUrlList.DataBind();
                }
            }

            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;
                ReportFields         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;
                }
            }
        }
        protected void dlVersionCategoryList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            CSBusiness.VersionCategory versionItem = e.Item.DataItem as CSBusiness.VersionCategory;
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Label lblCategory = e.Item.FindControl("lblCategory") as Label;
                HtmlContainerControl CategoryHeaderRow = e.Item.FindControl("CategoryHeaderRow") as HtmlContainerControl;

                lblCategory.Text = versionItem.Title;
                if (dtCollectionList[0].Count == 1)
                {
                    CategoryHeaderRow.Visible = false;
                }
                else
                {
                    CategoryHeaderRow.Visible = true;
                }


                DataList            dlVersionItemList = (DataList)e.Item.FindControl("dlVersionItemList");
                List <ReportFields> items             = dtCollectionList[1].FindAll(y => y.CatgoryId == versionItem.CategoryId);
                CategoryId = versionItem.CategoryId;
                if (items.Count > 0)
                {
                    CategoryUniqueVistiors       = 0;
                    dlVersionItemList.DataSource = items;
                    dlVersionItemList.DataBind();
                }
            }

            if (e.Item.ItemType == ListItemType.Footer)
            {
                Label lblTotalSumHitLinkVisitor  = e.Item.FindControl("lblTotalSumHitLinkVisitor") as Label;
                Label lblTotalSumTotalOrder      = e.Item.FindControl("lblTotalSumTotalOrder") as Label;
                Label lblTotalSumAvgOrder        = e.Item.FindControl("lblTotalSumAvgOrder") as Label;
                Label lblTotalSumTotalRev        = e.Item.FindControl("lblTotalSumTotalRev") as Label;
                Label lblTotalSumTotalConversion = e.Item.FindControl("lblTotalSumTotalConversion") as Label;
                Label lblTotalSumRevenuePerClick = e.Item.FindControl("lblTotalSumRevenuePerClick") as Label;


                if (TotalCategoryUniqueVistiors > 0)
                {
                    lblTotalSumHitLinkVisitor.Text = string.Format("{0:##,##}", TotalCategoryUniqueVistiors);
                }
                else
                {
                    lblTotalSumHitLinkVisitor.Text = "0";
                }


                if (TotalOrders > 0)
                {
                    lblTotalSumTotalOrder.Text = string.Format("{0:##,##}", TotalOrders);
                    lblTotalSumAvgOrder.Text   = String.Format("{0:C}", Math.Round(TotalRevenue / TotalOrders, 2));
                }
                else
                {
                    lblTotalSumTotalOrder.Text = "0";
                    lblTotalSumAvgOrder.Text   = "0";
                }

                lblTotalSumTotalRev.Text = String.Format("{0:C}", TotalRevenue);

                if (TotalCategoryUniqueVistiors > 0)
                {
                    lblTotalSumTotalConversion.Text = String.Format("{0}%", Math.Round((TotalOrders * 100) / TotalCategoryUniqueVistiors, 1));
                    lblTotalSumRevenuePerClick.Text = String.Format("{0:C}", Math.Round(TotalRevenue / TotalCategoryUniqueVistiors, 2));
                }
                else
                {
                    lblTotalSumTotalConversion.Text = "0";
                    lblTotalSumRevenuePerClick.Text = "0";
                }
            }
        }