using System;

namespace Stat.web.Manager
{
    /// <summary>
    /// 
    /// </summary>
    public partial class ShowActive2 : System.Web.UI.Page
    {
        string keyword = "";
        DateTime dt = new DateTime();
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            keyword = Plugin.Common.Rq("k").ToLower();
            dt = Plugin.Common.Rq_DateTime("t");

            if (!IsPostBack)
            {
                this.txtDateTime.Text = dt.ToShortDateString();
                GetAtive(keyword);
                this.dpdType.SelectedIndex = -1;
                if (this.dpdType.Items.FindByValue(keyword) != null)
                    this.dpdType.Items.FindByValue(keyword).Selected = true;
            }

        }
        void GetAtive(string keyword)
        {
            if (keyword == "website")
            {
                this.ltrMsg.Text += "<hr style=\" width:98%; text-align:center;\" /><br>";
                this.ltrMsg.Text += "【时间】：";
                this.ltrMsg.Text += dt.ToShortDateString() + "<br><br>";
                this.ltrMsg.Text += "【站点】 活跃总数：";
                this.ltrMsg.Text += BLL.Systems.Totali_Active_Website(dt) + "<br><br>";
                this.ltrMsg.Text += "【日作业】，【小时作业】，【Alexa 作业】，【JavaApplets 作业】，【.Net Framework 】参考此项<br>";
            }
            else if (keyword == "ip")
            {
                this.ltrMsg.Text += "<hr style=\" width:98%; text-align:center;\" /><br>";
                this.ltrMsg.Text += "【时间】：";
                this.ltrMsg.Text += dt.ToShortDateString() + "<br><br>";
                this.ltrMsg.Text += "【I P】 活跃总数：";
                this.ltrMsg.Text += BLL.Systems.Totali_Active_IP(dt) + "<br><br>";
                this.ltrMsg.Text += "【IP作业】参考此项<br>";
            }
            else if (keyword == "keyword")
            {
                this.ltrMsg.Text += "<hr style=\" width:98%; text-align:center;\" /><br>";
                this.ltrMsg.Text += "【时间】：";
                this.ltrMsg.Text += dt.ToShortDateString() + "<br><br>";
                this.ltrMsg.Text += "【关键字】 活跃总数：";
                this.ltrMsg.Text += BLL.Systems.Totali_Active_Keyword(dt) + "<br><br>";
                this.ltrMsg.Text += "【搜索引擎作业】参考此项<br>";
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSearce_Click(object sender, EventArgs e)
        {
            string url = "ShowActive.aspx?k=" + this.dpdType.SelectedValue + "&t=" + this.txtDateTime.Text.Trim();
            Response.Redirect(url);
        }
    }
}