using System;
using System.Collections.Generic;
namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks> By： Juju 2011-10-27</remarks>
    public partial class STReferer : Html.ReportPage
    {
        /// <summary>
        /// 
        /// </summary>
        protected Model.StatInfo statModel = new Stat.Model.StatInfo();
        Model.PageInfo pageModel = new Stat.Model.PageInfo();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            statModel.WebID = base.Webid;
            //
            Model.WebSites websiteModel = base.Website;
            if (websiteModel.WebId > 0)
            {
                this.Page.Title = "来路分类分析 " + websiteModel.WebName;
                statModel.GatherID = websiteModel.GatherServerID;
                //
                statModel.StartTime = base.StartTime;
                statModel.EndTime = base.EndTime;
                //
                Show();
            }
            else
            {
                Response.Write("该站点不存在！");
                Response.End();
            }
        }
        /// <summary>
        /// 分析数据
        /// </summary>
        protected void Show()
        {
            List<Model.StatItem> list = BLL.ViewRclass.Get(statModel);

            ShowReport(list);
            ShowHtml(list);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        protected void ShowHtml(List<Model.StatItem> list)
        {
            this.LtrTRefererList.Text = Stat.Html.ItemList.Get(list, statModel.WebID, "来路分类", "rc", statModel.StartTime.ToShortDateString(), statModel.EndTime.ToShortDateString());
            Response.Flush();
        }
        /// <summary>
        /// 获取数据
        /// </summary>
        protected void ShowReport(List<Model.StatItem> list)
        {
            if (list != null)
            {
                string strXML = Stat.Report.Rp_3_Pie3D.GetXML(list, "来路分类", "(" + statModel.StartTime.ToShortDateString() + "--" + statModel.EndTime.ToShortDateString() + ")", 0, "PV");
                this.LtrRp_TReferer.Text = BLL.StatCharts.RenderChart("../StatCharts/Pie3D.swf", "", strXML, "chartDomain1", "99", "300", false, false);

                Response.Flush();
            }
        }
    }
}