using System;

namespace Stat.web.Manager
{
    /// <summary>
    /// 
    /// </summary>
    public partial class SitesRank : System.Web.UI.Page
    {
        int RandNum = 1;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DateTime dt = DateTime.Now.AddDays(-1);
                this.txtDate.Text = dt.ToShortDateString();
            }
        }

        private void GetRank(DateTime dt)
        {
            this.GvList.DataSource = BLL.ViewDay.Rank(dt);
            this.GvList.DataBind();
            this.txtDate.Text = dt.ToShortDateString();
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnShow_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime dt = Convert.ToDateTime(this.txtDate.Text);
                GetRank(dt);
            }
            catch (Exception ex)
            {
                this.ltrPageIndex.Text = ex.Message;
            }

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void GvList_RowDataBound(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
        {
            if (e.Row.RowIndex >= 0)
            {
                e.Row.Cells[0].Text = (RandNum++).ToString();
            }
        }
    }
}
