using System;
using System.Collections.Generic;
namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks>By ： Juju 2011-09-20</remarks>
    public partial class SBrows : Html.ReportPage
    {
        /// <summary>
        /// 
        /// </summary>
        protected Model.StatInfo statModel = new Stat.Model.StatInfo();
        /// <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 != null)
            {
                this.Page.Title = "浏览器类型 " + websiteModel.WebName;
                statModel.GatherID = websiteModel.GatherServerID;
                //
                GetDateTime();//
                Show();
            }
            else
            {
                Response.Write("该站点不存在！");
                Response.End();
            }
        }
        /// <summary>
        /// 获取时间参数
        /// </summary>
        private void GetDateTime()
        {
            statModel.StartTime = base.StartTime;
            statModel.EndTime = base.EndTime;
        }
        /// <summary>
        /// 
        /// </summary>
        protected void Show()
        {
            List<Model.StatItem> list = Stat.Items.Browser.Get(BLL.ViewBrowser.Get(statModel));
            ShowReport(list);
            ShowHtml(list);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        protected void ShowHtml(List<Model.StatItem> list)
        {
            //显示
            this.LtrBrowsList.Text = Html.ItemList.Get(list, statModel.WebID, "浏览器类型", "bs", statModel.StartTime.ToShortDateString(), statModel.EndTime.ToShortDateString());
            Response.Flush();
        }
        /// <summary>
        /// 
        /// </summary>
        protected void ShowReport(List<Model.StatItem> list)
        {
            //生成报表
            string strXML = Stat.Report.Rp_3_Pie3D.GetXML(list, "浏览器", "(" + statModel.StartTime.ToLongDateString() + "--" + statModel.EndTime.ToLongDateString() + ")", 0, "PV");
            this.LtrRp_Brows.Text = BLL.StatCharts.RenderChart("../StatCharts/Pie3D.swf", "", strXML, "chartBrows", "99", "300", false, false);
            Response.Flush();
        }
    }
}