using System;
using System.Collections.Generic;
namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks>By ： Juju 2011-10-28</remarks>
    public partial class SSystem : 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.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 = Stat.Items.OperatingSystem.Get(BLL.ViewSystem.Get(statModel));
            ShowReport(list);
            ShowHtml(list);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        protected void ShowHtml(List<Model.StatItem> list)
        {
            //待处理
            this.LtrSystemList.Text = Stat.Html.ItemList.Get(list, statModel.WebID, "操作系统", "sys", 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.ToShortDateString() + "--" + statModel.EndTime.ToShortDateString() + ")", 0, "PV");
            this.LtrRp_System.Text = BLL.StatCharts.RenderChart("../StatCharts/Pie3D.swf", "", strXML, "chartSystem", "99", "300", false, false);
            Response.Flush();
        }
    }
}
