📄 userlog.aspx.cs
字号:
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using qminoa.DA;
using qminoa.Common;
namespace qminoa.Webs.sysSecurity
{
/// <summary>
/// userlog 的摘要说明。
/// </summary>
public class UserLog : qminoa.Webs.PageBase
{
protected System.Web.UI.WebControls.DataGrid DataGridLogininfo;
protected System.Web.UI.WebControls.ImageButton ImgBdel;
protected System.Web.UI.WebControls.CheckBox CheckBox2;
protected System.Web.UI.WebControls.Panel Panel1;
private void Page_Load(object sender, System.EventArgs e)
{
this.PageBegin("登录日志",true);
if(Page.IsPostBack ==false)
{
DataGridLogininfoband();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.DataGridLogininfo.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGridLogininfo_PageIndexChanged);
this.DataGridLogininfo.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.DataGridLogininfo_ItemDataBound);
this.ImgBdel.Click += new System.Web.UI.ImageClickEventHandler(this.ImgBdel_Click);
this.CheckBox2.CheckedChanged += new System.EventHandler(this.CheckBox2_CheckedChanged);
}
#endregion
public void MyBindData()
{
DbManagerLogininfo myclass= new DbManagerLogininfo ();
DataTable mytable=myclass.Getalllogininfo ();
DataColumn mycolumn= mytable.Columns.Add ("number",System.Type .GetType ("System.String"));
for (int i=0;i<mytable.Rows.Count ;i++)
{
mytable.Rows [i]["number"]=(i+1).ToString ();
}
DataGridLogininfo.DataSource =mytable;
DataGridLogininfo.DataBind ();
}
public void DataGridLogininfoband()
{
DataGridLogininfo.CurrentPageIndex =0;
MyBindData();
}
public void DelLoginLog(string strLoginID)
{
DbManagerLogininfo myclass= new DbManagerLogininfo ();
myclass.dellogininfo (strLoginID);
}
private void ImgBdel_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
if(this.EmpRightCode == 4)
{
foreach(DataGridItem thisItem in DataGridLogininfo.Items)
{
if(((CheckBox)thisItem.Cells[0].Controls[1]).Checked)
{
string strLoginID = DataGridLogininfo.DataKeys[thisItem.ItemIndex].ToString();
DelLoginLog(strLoginID);
}
}
this.WriteOptLog("删除登录日志信息");
JScript.Alert("删除成功!");
if( DataGridLogininfo.CurrentPageIndex == DataGridLogininfo.PageCount-1)
DataGridLogininfo.CurrentPageIndex =DataGridLogininfo.CurrentPageIndex-1;
MyBindData();
}
else
{
JScript.Alert("您没有权限进行此操作!");
}
}
private void DataGridLogininfo_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if (itemType == ListItemType.Item )
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#dedfde';";
e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
}
else if( itemType == ListItemType.AlternatingItem)
{
e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor='#ffffff';";
e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor='#fff7ce';cursor='hand';" ;
}
}
private void DataGridLogininfo_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGridLogininfo.CurrentPageIndex =e.NewPageIndex ;
MyBindData();
}
private void CheckBox2_CheckedChanged(object sender, System.EventArgs e)
{
foreach(DataGridItem thisItem in DataGridLogininfo.Items)
{
((CheckBox)thisItem.Cells[0].Controls[1]).Checked = CheckBox2.Checked;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -