using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using TopWinCMS.Common;
using TopWinCMS.BLL;
using TopWinCMS.Model;
namespace TopWinCMS.WebUI.Admin.Counter
{
    public partial class Counter_All : System.Web.UI.Page
    {
        SQLModel s_model = new SQLModel();
        CounterDiaryManage MyClassBLL = new CounterDiaryManage();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RightsCheck.CheckWorkPower("Count_Read");

                if (RightsCheck.HasRight("Count_Del"))
                {
                    BT_Delete.Attributes.Add("onclick", "return confirm('您确定要删除？');");
                    BT_DeleteAll.Attributes.Add("onclick", "return confirm('您确定要删除？');");
                }
                else
                {
                    BT_Delete.Attributes.Add("onclick", "alert('您确定没有删除权限？');return false");
                    BT_DeleteAll.Attributes.Add("onclick", "alert('您确定要删除权限？');return false");
                }

                BindList();
            }

        }
        public void BindList()
        {
            LB_Path.Text = Config.SiteName + " →  访问统计 → 详细记录";  

             
            s_model.PageSize = 15;

            MyClassBLL.BindList(GV_List, PageNavigation1, s_model);

            MyJavascript.RegJS(UpdatePanel1, "attachMouseEvent('" + GV_List.ClientID + "');");
        }

        protected void PageNavigation1_PageChanging(object src, TopWinCMS.WebControls.PageChangingEventArgs e)
        {
            s_model.PageNo = e.NewPageIndex;
            BindList();
        }

        protected void BT_Delete_Click(object sender, EventArgs e)
        {
            MyClassBLL.Delete(CD_DateTime.Value, UpdatePanel1);
            s_model.PageNo = 1;
            BindList();
        }

        protected void BT_DeleteAll_Click(object sender, EventArgs e)
        {
            MyClassBLL.Delete();
            s_model.PageNo = 1;
            BindList();
        }

        protected void GV_List_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

    }
}
