using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using TopWinCMS.BLL;
using TopWinCMS.Model;
using TopWinCMS.Common;
namespace TopWinCMS.WebUI.Admin
{
    /// <summary>
    /// Admin_Log 的摘要说明。
    /// </summary>
    public partial class Admin_Log : System.Web.UI.Page
    {
        BLL.LogManage MyClassBLL = new BLL.LogManage();
        SQLModel s_model = new SQLModel();
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                RightsCheck.CheckWorkPower("O_3");
 
                BT_Delete.Attributes.Add("onclick", "return confirm('您确定要删除？');");

                GV_List.EmptyDataTemplate = TopWinCMS.WebFactory.PageBase.GetTemplate(this);

                BindList();
            }
        }

        private void BindList()
        {
            LB_LogChoose.Text = MyClassBLL.GroupBy();
            if (Request["Key"] == null)
            {
                LB_Path.Text = Config.SiteName + " →  <a href=\"Log.aspx\">日志管理</a>";
                s_model.WHERE = "Deleted=0";
            }
            else
            {
                LB_Path.Text = Config.SiteName + " → <a href=\"Log.aspx\">日志管理</a> → " + HttpUtility.UrlDecode(Request.QueryString["Key"]); ;
                s_model.WHERE = "Deleted=0 and [Type]='" + HttpUtility.UrlDecode(Request.QueryString["Key"]) + "'";
            }

            MyClassBLL.BindList(GV_List, PageNavigation1, s_model);

 
        }

   


 

        protected void BT_Delete_Click(object sender, System.EventArgs e)
        {
            string IDs = GetSelectedRow.IDs(GV_List);
            MyClassBLL.Delete(IDs, UpdatePanel1);
            BindList();
        }
        protected void PageNavigation1_PageChanging(object src, TopWinCMS.WebControls.PageChangingEventArgs e)
        {
            s_model.PageNo = e.NewPageIndex;
            BindList();
        }

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