using System;
using System.Collections.Generic;
namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    public partial class Hour : Html.ReportPage
    {
        Stat.Cache.IConfig config = Stat.Cache.CacheFatory.CreateConfig();
        /// <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;
                statModel.StartTime = base.StartTime;
                statModel.EndTime = base.EndTime;
                //
                Show();
            }
            else
            {
                Response.Write("该站点不存在！");
                Response.End();
            }
        }
        /// <summary>
        /// 分析数据
        /// </summary>
        protected void Show()
        {
            int hourBreak = config.GetStatHourPostpone();
            //小时数据
            List<Model.ViewDay> list = BLL.ViewHour.Get24Hour(statModel, hourBreak);
            //报表
            string strSubTitle = "(" + statModel.StartTime.ToShortDateString() + "- -" + statModel.EndTime.ToShortDateString() + ")";
            string strHourXML = Stat.Report.Rp_3_MSLine.GetXML_vHour(list, "24小时访问分布图", strSubTitle, 0);
            this.LtrRp_Hour.Text = BLL.StatCharts.RenderChart("../StatCharts/MSLine.swf", "", strHourXML, "chartHour", "99", "280", false, false);
            Response.Flush();
            //Html
            this.LtrHourList.Text = Stat.Html.HourList.Get(list);
            Response.Flush();
        }
    }
}
