protected void BindData(DateTime?startDate, DateTime?endDate)
        {
            DateTime?timezoneStartDate = DateTimeUtil.GetEastCoastStartDate(rangeDateControlCriteria.StartDateValueLocal);
            DateTime?timezoneEndDate   = DateTimeUtil.GetEastCoastDate(rangeDateControlCriteria.EndDateValueLocal);

            dtCollectionList = new OrderManager().GetVersionSummary(timezoneStartDate, timezoneEndDate, false);

            Data rptData = new ReportWSSoapClient().GetDataFromTimeframe(hitsLinkUserName, hitsLinkPassword, ReportsEnum.MultiVariate, TimeFrameEnum.Daily, Convert.ToDateTime(startDate), Convert.ToDateTime(endDate), 100000000, 0, 0);

            for (int i = 0; i <= rptData.Rows.GetUpperBound(0); i++)
            {
                HitLinkVisitor.Add(rptData.Rows[i].Columns[0].Value.ToLower(), rptData.Rows[i].Columns[9].Value);
            }

            //Update Version List information
            foreach (ReportFields item in dtCollectionList[1])
            {
                decimal visitor = 0;
                if (item.Title.ToLower().Equals(item.ShortName.ToLower()))
                {
                    if (HitLinkVisitor.ContainsKey(item.Title))
                    {
                        visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString());
                        visitor  = Math.Abs(visitor);
                    }
                }
                else
                {
                    //Added this to fix bug of orderhelper.getversionname()
                    if (HitLinkVisitor.ContainsKey(item.Title))
                    {
                        visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString());
                    }
                    if (HitLinkVisitor.ContainsKey(item.ShortName.ToLower()))
                    {
                        visitor += Convert.ToDecimal(HitLinkVisitor[item.ShortName.ToLower()].ToString());
                    }
                    visitor = Math.Abs(visitor);
                }
                item.UniqueVisitors = visitor;

                if (visitor > 0)
                {
                    item.Conversion      = Math.Round((Convert.ToDecimal(item.TotalOrders) * 100) / visitor, 1);
                    item.RevenuePerVisit = Convert.ToDecimal(item.TotalRevenue) / visitor;
                }
                else
                {
                    item.Conversion      = 0;
                    item.RevenuePerVisit = 0;
                }
            }


            dlVersionCategoryList.DataSource = CSFactory.GetAllVersionCateogry();
            dlVersionCategoryList.DataBind();

            //FCLiteral.Text = CreateCharts(dtCollectionList[1dtCollectionList
        }
 private void BindVersionCategory()
 {
     ddlCategory.DataSource     = CSFactory.GetAllVersionCateogry();
     ddlCategory.DataTextField  = "Title";
     ddlCategory.DataValueField = "CategoryId";
     ddlCategory.DataBind();
     ddlCategory.Items.Insert(0, new ListItem("Select", ""));
 }
Exemplo n.º 3
0
        protected void BindData(DateTime?startDate, DateTime?endDate)
        {
            dtCollectionList = new OrderManager().GetVersionSummary(startDate, endDate, cbArchive.Checked);
            dlVersionCategoryList.DataSource = CSFactory.GetAllVersionCateogry();
            dlVersionCategoryList.DataBind();

            FCLiteral.Text = CreateCharts(dtCollectionList[1]);
        }
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            CSBusiness.Version versionItem = e.Item.DataItem as CSBusiness.Version;
            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 lblShortName = e.Item.FindControl("lblShortName") as ITextControl;
                ITextControl lblCategoy   = e.Item.FindControl("lblCategoy") as ITextControl;

                LinkButton lbRemove = e.Item.FindControl("lbRemove") as LinkButton;
                lblTitle.Text     = versionItem.Title;
                lblShortName.Text = versionItem.ShortName;
                lblCategoy.Text   = versionItem.CategoryTitle;
                lblStatus.Text    = versionItem.Visible ? "Active" : "Inactive";

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

                if (versionItem.HideRemove)
                {
                    lbRemove.Visible = false;
                }
            }

            if (e.Item.ItemType == ListItemType.EditItem)
            {
                DropDownList ddlEditCategory = (DropDownList)e.Item.FindControl("ddlEditCategory");
                ddlEditCategory.DataSource     = CSFactory.GetAllVersionCateogry();
                ddlEditCategory.DataTextField  = "Title";
                ddlEditCategory.DataValueField = "CategoryId";
                ddlEditCategory.DataBind();
                ddlEditCategory.Items.Insert(0, new ListItem("Select", ""));
                if (versionItem.CategoryId > 0)
                {
                    ddlEditCategory.Items.FindByValue(versionItem.CategoryId.ToString()).Selected = true;
                }
            }
        }
Exemplo n.º 5
0
 private void BindVersion()
 {
     dlVersionList.DataSource   = CSFactory.GetAllVersionCateogry();
     dlVersionList.DataKeyField = "CategoryId";
     dlVersionList.DataBind();
 }
Exemplo n.º 6
0
        protected void dlVersionList_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            CSBusiness.Version versionItem = e.Item.DataItem as CSBusiness.Version;
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                HyperLink        hlTitle        = e.Item.FindControl("hlTitle") as HyperLink;
                ITextControl     lblStatus      = e.Item.FindControl("lblStatus") as ITextControl;
                ITextControl     lblShortName   = e.Item.FindControl("lblShortName") as ITextControl;
                ITextControl     lblCategoy     = e.Item.FindControl("lblCategoy") as ITextControl;
                ITextControl     lbModelVersion = e.Item.FindControl("lbModelVersion") as ITextControl;
                Label            imgIsDynamic   = e.Item.FindControl("imgIsDynamic") as Label;
                GroupRadioButton rbDesktop      = (GroupRadioButton)e.Item.FindControl("rbDesktop");
                GroupRadioButton rbTablet       = (GroupRadioButton)e.Item.FindControl("rbTablet");
                GroupRadioButton rbMobile       = (GroupRadioButton)e.Item.FindControl("rbMobile");

                LinkButton lbRemove = e.Item.FindControl("lbRemove") as LinkButton;
                if (!versionItem.IsDynamic)
                {
                    imgIsDynamic.Visible = false;
                }
                hlTitle.Text        = versionItem.Title;
                hlTitle.NavigateUrl = string.Format("~/{0}/", versionItem.Title);
                lblShortName.Text   = versionItem.ShortName;
                lbModelVersion.Text = versionItem.ModelVersion;
                lblCategoy.Text     = versionItem.CategoryTitle;
                lblStatus.Text      = versionItem.Visible ? "Active" : "Inactive";
                rbDesktop.Checked   = versionItem.IsDesktopDefault;
                rbTablet.Checked    = versionItem.IsTabletDefault;
                rbMobile.Checked    = versionItem.IsMobileDefault;

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

                if (versionItem.HideRemove)
                {
                    lbRemove.Visible = false;
                }
            }

            if (e.Item.ItemType == ListItemType.EditItem)
            {
                //Bind Categories
                DropDownList ddlEditCategory = (DropDownList)e.Item.FindControl("ddlEditCategory");
                ddlEditCategory.DataSource     = CSFactory.GetAllVersionCateogry();
                ddlEditCategory.DataTextField  = "Title";
                ddlEditCategory.DataValueField = "CategoryId";
                ddlEditCategory.DataBind();
                ddlEditCategory.Items.Insert(0, new ListItem("Select", ""));
                GroupRadioButton rbDesktop = (GroupRadioButton)e.Item.FindControl("rbDesktop");
                GroupRadioButton rbTablet  = (GroupRadioButton)e.Item.FindControl("rbTablet");
                GroupRadioButton rbMobile  = (GroupRadioButton)e.Item.FindControl("rbMobile");

                rbDesktop.Checked = versionItem.IsDesktopDefault;
                rbTablet.Checked  = versionItem.IsTabletDefault;
                rbMobile.Checked  = versionItem.IsMobileDefault;
                if (versionItem.CategoryId > 0)
                {
                    ddlEditCategory.Items.FindByValue(versionItem.CategoryId.ToString()).Selected = true;
                }
                BindModelVersions(versionItem.Title, e.Item);
                if (versionItem.ModelVersionId > 0)
                {
                    ListItem selectedItem = ddlModel.Items.FindByValue(versionItem.ModelVersionId.ToString());
                    if (selectedItem != null)
                    {
                        selectedItem.Selected = true;
                    }
                }
            }
        }
        //Garo:This function was written for Icon Media to pull unqiue visitors data per version for any range of dates , and store it in c:\ 
        //Not to be used unless requested
        //the call is in btn_submit , marked as comment
        protected void get_unique_visitors(DateTime?startDate, DateTime?endDate)
        {
            DateTime?timezoneStartDate = DateTimeUtil.GetEastCoastStartDate(rangeDateControlCriteria.StartDateValueLocal);
            DateTime?timezoneEndDate   = DateTimeUtil.GetEastCoastDate(rangeDateControlCriteria.EndDateValueLocal);
            DateTime date1             = Convert.ToDateTime(timezoneStartDate);
            DateTime date2             = Convert.ToDateTime(timezoneEndDate);

            string filename = "c:\\" + date1.AddDays(1).ToString("MM") + date1.AddDays(1).ToString("dd") + date1.AddDays(1).ToString("yy") + "-" + date2.ToString("MM") + date2.ToString("dd") + date2.ToString("yy") + ".txt";

            WriteHeaderCSVFile(filename);
            TimeSpan span = Convert.ToDateTime(date2) - Convert.ToDateTime(date1);

            for (int j = 0; j < Convert.ToInt16(span.TotalDays); j++)
            {
                HitLinkVisitor.Clear();
                DateTime zdate1 = date1.AddDays(j);
                DateTime zdate2 = date1.AddDays(j + 1);
                DateTime hdate1 = Convert.ToDateTime(startDate).AddDays(j);
                DateTime hdate2 = Convert.ToDateTime(startDate).AddDays(j + 1);
                if (dtCollectionList != null)
                {
                    dtCollectionList.Clear();
                }
                dtCollectionList = new OrderManager().GetVersionSummary(zdate1, zdate2, false);
                Data rptData = new ReportWSSoapClient().GetDataFromTimeframe(hitsLinkUserName, hitsLinkPassword, ReportsEnum.MultiVariate, TimeFrameEnum.Daily, hdate1, hdate1, 100000000, 0, 0);
                for (int i = 0; i <= rptData.Rows.GetUpperBound(0); i++)
                {
                    HitLinkVisitor.Add(rptData.Rows[i].Columns[0].Value.ToLower(), rptData.Rows[i].Columns[9].Value);

                    foreach (ReportFields item in dtCollectionList[1])
                    {
                        decimal visitor = 0;
                        if (item.Title.ToLower().Equals(item.ShortName.ToLower()))
                        {
                            if (HitLinkVisitor.ContainsKey(item.Title))
                            {
                                visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString());
                                visitor  = Math.Abs(visitor);
                            }
                        }
                        else
                        {
                            //Added this to fix bug of orderhelper.getversionname()
                            if (HitLinkVisitor.ContainsKey(item.Title))
                            {
                                visitor += Convert.ToDecimal(HitLinkVisitor[item.Title].ToString());
                            }
                            if (HitLinkVisitor.ContainsKey(item.ShortName.ToLower()))
                            {
                                visitor += Convert.ToDecimal(HitLinkVisitor[item.ShortName.ToLower()].ToString());
                            }
                            visitor = Math.Abs(visitor);
                        }
                        item.UniqueVisitors = visitor;

                        if (visitor > 0)
                        {
                            item.Conversion      = Math.Round((Convert.ToDecimal(item.TotalOrders) * 100) / visitor, 1);
                            item.RevenuePerVisit = Convert.ToDecimal(item.TotalRevenue) / visitor;
                        }
                        else
                        {
                            item.Conversion      = 0;
                            item.RevenuePerVisit = 0;
                        }
                    }
                }


                WritetoCSVFile(dtCollectionList[1], filename, Convert.ToDateTime(hdate1));
            }

            //Update Version List information



            dlVersionCategoryList.DataSource = CSFactory.GetAllVersionCateogry();
            dlVersionCategoryList.DataBind();

            //FCLiteral.Text = CreateCharts(dtCollectionList[1dtCollectionList
        }