using System;
using System.Collections.Generic;
namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    public partial class SProvince : 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 = base.EndTime;
                    Show();
                }
            }
            else
            {
                Response.Write("该站点不存在！");
                Response.End();
            }
        }
        /// <summary>
        /// 分析数据
        /// </summary>
        protected void Show()
        {
            List<Model.StatItem> list = BLL.ViewProvince.Get(statModel);
            ShowReport(list);
            ShowHtml(list);
        }
        /// <summary>
        /// 
        /// </summary>
        protected void ShowHtml(List<Model.StatItem> list)
        {
            this.LtrProvinceList.Text = Stat.Html.ItemList.Get(list, statModel.WebID, "国家/省份", "pv", statModel.StartTime.ToShortDateString(), statModel.EndTime.ToShortDateString());
            Response.Flush();
        }
        /// <summary>
        /// 
        /// </summary>
        protected void ShowReport(List<Model.StatItem> list)
        {
            string strXML = Report.Map_China.GetXML(BLL.ViewProvince.GetChina(list));
            this.LtrRp_Province.Text = BLL.StatMaps.RenderMap("../MapsCharts/FCMap_China2.swf", "", strXML, "MapChina", "780", "400", false, false);
            Response.Flush();
        }
    }
}