using System;
using System.Collections.Generic;
namespace Stat.web.v
{
    /// <summary>
    /// 
    /// </summary>
    public partial class Panel : System.Web.UI.UserControl
    {
        Stat.Cache.IAd ad = Stat.Cache.CacheFatory.CreateAd();
        /// <summary>
        /// 
        /// </summary>
        protected Model.Panel model = new Stat.Model.Panel();
        Stat.Cache.IWebSite myWebsite = Stat.Cache.CacheFatory.CreateWebSite();
        /// <summary>
        /// 
        /// </summary>
        protected int webid;
        /// <summary>
        /// 
        /// </summary>
        protected string ContentStat;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            string td = DateTime.Now.ToShortDateString();//今日
            string yd = DateTime.Now.AddDays(-1).ToShortDateString();//昨日
            DateTime md = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            string m1 = md.ToShortDateString();
            string m2 = md.AddMonths(1).AddDays(-1).ToShortDateString();
            string d7 = DateTime.Now.AddDays(-6).ToShortDateString();
            string d30 = DateTime.Now.AddDays(-29).ToShortDateString();
            webid = Plugin.Common.Rq_Int("wid");
            /*------------------------------------------------------------------------------------*/
            model.ProbablyUrl = "Main.aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.TdTimePara = "Timeflux.aspx?wid=" + webid + "&st=" + td + "&et=" + td; //今日
            model.YdTimePara = "Timeflux.aspx?wid=" + webid + "&st=" + yd + "&et=" + yd; //昨日
            model.N7dTimePara = "Timeflux.aspx?wid=" + webid + "&st=" + d7 + "&et=" + td; //最近7天
            model.N30dTimePara = "Timeflux.aspx?wid=" + webid + "&st=" + d30 + "&et=" + td; //最近30天
            model.MdTimePara = "Timeflux.aspx?wid=" + webid + "&st=" + m1 + "&et=" + m2; //本月
            model.Hour = "Hour.Aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.Online = "Online.aspx?wid=" + webid;
            model.OnlinePage = "StayPage.aspx?wid=" + webid;
            model.NReferer = "Referer.aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.Engine = "Engine.aspx?wid=" + webid;
            model.Keyword = "Keyword.aspx?wid=" + webid;
            model.EngineList = "EngineList.aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.Domain = "Rdomain.aspx?wid=" + webid;
            model.RPage = "Rpage.aspx?wid=" + webid;
            model.TReferer = "Rclass.aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.Brows = "Browser.Aspx?wid=" + webid;
            model.System = "System.Aspx?wid=" + webid;
            model.Resolve = "Resolve.Aspx?wid=" + webid;
            model.Tele = "Tele.Aspx?wid=" + webid;
            model.Province = "Province.Aspx?wid=" + webid;
            model.Lang = "Language.Aspx?wid=" + webid;
            model.ColorDepth = "ColorDepth.Aspx?wid=" + webid;
            model.UserIP = "Vip.Aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.Returnuser = "Returnuser.aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.Alexa = "Alexa.aspx?wid=" + webid;
            model.JavaApplet = "JavaApplets.aspx?wid=" + webid;
            model.ClrVersion = "ClrVersion.aspx?wid=" + webid;
            /*------------------------------------------------------------------------------------*/
            model.PvTop = "Vtop.aspx?wid=" + webid;
            model.Vpage = "Vpage.aspx?wid=" + webid;
            model.IPStat = "IPStat.aspx?wid=" + webid;//未启用
            model.UVStat = "UVStat.aspx?wid=" + webid;//未启用
            model.Enter = "Ventrance.aspx?wid=" + webid;
            model.Exit = "Vexit.aspx?wid=" + webid;//未启用
            /*------------------------------------------------------------------------------------*/
            ContentStat = GetContentNav();
            /*------------------------------------------------------------------------------------*/
            GetAd();
        }

        private void GetAd()
        {
            this.ltr_AD_Panel.Text = Stat.Html.FrendLink.GetImg(ad.GetImg(5, 2, 2), 150, 50);
        }
        private string GetContentNav()
        {
            string tep = string.Empty;
            IList<Model.WebsiteStructure> list = myWebsite.GetRuleList(webid);
            if (list != null && list.Count > 0)
            {
                tep += "<dt class=\"Stat_miTi\">";
                tep += "<span class=\"Stat_Img\"><img src=\"images/icng_on.gif\" id=\"img9\"></span>";
                tep += "<SPAN><a onclick=\"show('folder9',9);\" style=\"cursor: pointer\">&nbsp;栏目内容</a></SPAN>";
                tep += "</dt>";
                tep += "<div id=\"folder9\">";
                tep += " <li class=\"P_item\"><SPAN><A title=\"栏目分析\" href=\"Column.Aspx?wid=" + webid + "\">栏目分析&nbsp;&nbsp;<EM class=New2>new</EM></A></SPAN></li>";
                tep += " <li class=\"P_item\"><SPAN><A title=\"内容分析\" href=\"Content.Aspx?wid=" + webid + "\">内容分析&nbsp;&nbsp;<EM class=New2>new</EM></A></SPAN></li>";

                tep += "</div>	";
            }
            return tep;
        }
    }
}