using System;
using System.Collections.Generic;
namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    public partial class STele : 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;
                //
                if (!IsPostBack)
                {
                    statModel.StartTime = base.StartTime;
                    statModel.EndTime = statModel.StartTime.AddDays(1);
                    //
                    Show();
                }
            }
            else
            {
                Response.Write("该站点不存在！");
                Response.End();
            }
        }

        /// <summary>
        /// 分析数据
        /// </summary>
        protected void Show()
        {
            List<Model.StatItem> list = BLL.ViewTele.Get(statModel);
            ShowReport(list);
            ShowHtml(list);
        }
        /// <summary>
        /// 
        /// </summary>
        protected void ShowHtml(List<Model.StatItem> list)
        {
            this.LtrTeleList.Text = Stat.Html.ItemList.Get(list, statModel.WebID, "网络接入商", "tl", 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_Tele.Text = BLL.StatCharts.RenderChart("../StatCharts/Pie3D.swf", "", strXML, "chartTele", "99", "300", false, false);
            Response.Flush();
        }
    }
}
