using System;
using System.Collections;
using System.Collections.Generic;
using System.Web;

namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    public partial class Vpage : Html.ReportPage
    {
        /// <summary>
        /// 
        /// </summary>
        protected Model.SearchInfo searchModel = new Stat.Model.SearchInfo();
        Model.PageInfo pageModel = new Stat.Model.PageInfo(20);
        string strUrlParmar = "";
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            searchModel.WebID = base.Webid;
            //
            Model.WebSites websiteModel = base.Website;
            if (websiteModel != null)
            {
                this.Page.Title = "受访页面分析 " + websiteModel.WebName;
                searchModel.GatherID = websiteModel.GatherServerID;
                //
                pageModel.PageIndex = base.PageIndex;
                //
                searchModel.StartTime = base.StartTime;
                searchModel.EndTime = searchModel.StartTime.AddDays(1);
                //
                searchModel.IP = base.ParmIp;
                searchModel.BrowserID = base.ParmBrowserID;
                searchModel.OperatingSystemId = base.ParmOperatingSystemId;
                searchModel.ResolutionId = base.ParmResolutionId;
                searchModel.LanguageId = base.ParmLanguageId;
                searchModel.ColorDepthId = base.ParmColorDepthId;
                searchModel.View_Alone = base.ParmVisitNumber;
                searchModel.NetClrVersionId = base.ParmNetClrVersionId;
                searchModel.CoId = base.ParmCoId;
                searchModel.CtId = base.ParmCtId;
                searchModel.IsAlexa = base.ParmIsAlexa;
                searchModel.IsJava = base.ParmIsJava;
                //
                Show();
            }
        }

        /// <summary>
        /// 分析数据
        /// </summary>
        protected void Show()
        {
            strUrlParmar = Plugin.Common.GetVpageParmar(searchModel);
            ShowHtml(BLL.ViewOnClickPageIndex.GetList(ref pageModel, searchModel));
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="list"></param>
        protected void ShowHtml(List<Model.ViewClick> list)
        {
            this.LtrVpagetList.Text = Stat.Html.Vpage.Get(list, pageModel, searchModel.WebID, searchModel.IP, searchModel.StartTime, searchModel.EndTime);

            if (list != null && list.Count > 0)
            {
                string urlPar = "wid=" + searchModel.WebID + "&st=" + searchModel.StartTime + "&et=" + searchModel.EndTime.ToShortDateString() + "&ip=" + searchModel.IP;
                urlPar += Plugin.Common.GetVpageParmar(searchModel);
                this.LtrVpagePageIndex.Text = JPageIndex.GetIndex.Get(pageModel.RecordCount, pageModel.PageIndex, pageModel.PageSize, 0, 1, urlPar);

                Response.Flush();
            }
        }
    }
}