- namespace qminoa.Webs.sysSecurity
- {
- using System;
- using System.Data;
- using System.Drawing;
- using System.Web;
- using System.Web.UI.WebControls;
- using System.Web.UI.HtmlControls;
- using qminoa.DA;
- /// <summary>
- /// ManagerUserlog 的摘要说明。
- /// </summary>
- public abstract class ManagerUserlog : System.Web.UI.UserControl
- {
- protected System.Web.UI.WebControls.Panel Panel1;
- protected System.Web.UI.WebControls.ImageButton ImgBdel;
- protected System.Web.UI.WebControls.DataGrid DataGridLogininfo;
- protected System.Web.UI.WebControls.ImageButton ImBdel;
- public void DataGridLogininfoband()
- {
- DataGridLogininfo.CurrentPageIndex =0;
- 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 ();
- }
- private void Page_Load(object sender, System.EventArgs e)
- {
- 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>
- private void InitializeComponent()
- {
- this.DataGridLogininfo.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(this.DataGridLogininfo_PageIndexChanged);
- this.ImgBdel.Click += new System.Web.UI.ImageClickEventHandler(this.ImgBdel_Click);
- this.Load += new System.EventHandler(this.Page_Load);
- }
- #endregion
- public void dellogin(string strLoginID)
- {
- DbManagerLogininfo myclass= new DbManagerLogininfo ();
- myclass.dellogininfo (strLoginID);
- }
- private void ImgBdel_Click(object sender, System.Web.UI.ImageClickEventArgs e)
- {
- foreach(DataGridItem thisItem in DataGridLogininfo.Items)
- {
- if(((CheckBox)thisItem.Cells[0].Controls[1]).Checked)
- {
- string strLoginID = DataGridLogininfo.DataKeys[thisItem.ItemIndex].ToString();
- dellogin(strLoginID);
- }
- }
- if( DataGridLogininfo.CurrentPageIndex >DataGridLogininfo.PageCount-1)
- DataGridLogininfo.CurrentPageIndex =DataGridLogininfo.PageCount-1;
- //else DataGridLogininfo.CurrentPageIndex =e.NewPageIndex ;
- 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 ();
- }
- private void DataGridLogininfo_ItemDataBound_1(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 ;
- 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 ();
- }
- }
- }