SysManageUser.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:6k
- 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 com.etong.BusinessRule.Zwf;
- public partial class sysManage_SysManageUser : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- DataView dv = new DataView();
- EtongZwf etongzwf = new EtongZwf();
- dv = etongzwf.UserSearch("", "",false);
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
- }
- }
- protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- {
-
- int currentpageindex;
- currentpageindex = Convert.ToInt32(e.NewPageIndex);
- if (currentpageindex == -2)
- {
- TextBox txtNewPageIndex;
- txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
- if (txtNewPageIndex != null)
- {
- try
- {
- currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
- }
- catch
- {
- currentpageindex = 0;
- }
- }
- }
- currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
- currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
- GridView1.PageIndex = currentpageindex;
- EtongZwf etongzwf = new EtongZwf();
- DataView dv= etongzwf.UserSearch("", "",false);
- dv.Sort = (string)ViewState["sortFieldName"];
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
-
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- int iRow;
- iRow = e.Row.DataItemIndex;
- iRow = iRow % 2;
- if (iRow > 0)
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
- else
- e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
- e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
-
- ImageButton addButton = ((ImageButton)e.Row.FindControl("IB_Key"));
- addButton.CommandArgument = e.Row.RowIndex.ToString();
- }
-
-
- }
- protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
- {
- try
- {
- int userid = Convert.ToInt16(GridView1.DataKeys[e.RowIndex].Value.ToString());
- EtongZwf etongzwf = new EtongZwf();
- etongzwf.UserDelete(userid);
- GridView1.DataSource = etongzwf.UserSearch("", "5",false);
- GridView1.DataBind();
-
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:删除记录成功!');</script>");
- }
- catch (Exception ex)
- {
- ClientScript.RegisterStartupScript(this.GetType(), "errorMessage", "<script>alert('" + ex.Message.Replace("'", "").Replace("rn", "") + "');</script>");
- }
- }
- protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
- {
- int userid = Convert.ToInt16(GridView1.DataKeys[e.NewEditIndex].Value.ToString());
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.showModalDialog('UserUpdata.aspx?userid=" + userid + "','','help:0;dialogWidth=650px;dialogHeight=400px,status=no;scroll=no;')</script>");
- // Response.Write();
- // Response.Write("<script>window.open('UserUpdata.aspx?userid=" + userid + "','','window.innerHeight:500px;innerWidth:600px,top:250px;left:250px;location=no, status=no;');</script>");
- }
- protected void GridView1_Sorting(object sender, GridViewSortEventArgs e)
- {
- }
- protected void IB_Search_Click(object sender, ImageClickEventArgs e)
- {
- string SearchKind = this.DDL_Condition.SelectedValue.Trim();
- string SearchTxt=this.TB_Condition.Text.Trim();
- bool IsSearch=this.CB_Blur.Checked;
- DataView dv = new DataView();
- EtongZwf etongzwf = new EtongZwf();
- dv = etongzwf.UserSearch(SearchTxt, SearchKind, IsSearch);
- this.GridView1.DataSource = dv;
- this.GridView1.DataBind();
-
- }
-
- protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
- {
-
-
- }
-
- protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- if (e.CommandName == "key2")
- {
- int id = Convert.ToInt32(e.CommandArgument);
- int userid = Convert.ToInt16(GridView1.Rows[id].Cells[0].Text.ToString().Trim());
- EtongZwf etongzwf = new EtongZwf();
- bool returnvalue = etongzwf.UserPwdUpdata(userid);
- ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('系统提示:密码重置成功,\n 密码为:111111');</script>");
- }
- }
- protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
- {
- if (e.Row.RowType == DataControlRowType.DataRow || e.Row.RowType == DataControlRowType.Header)
- {
- e.Row.Cells[0].Visible = false;
-
- }
- }
- protected void ddlRandom_SelectedIndexChanged(object sender, EventArgs e)
- {
- //GridViewRow gvr = this.GridView1.BottomPagerRow;
- //DropDownList ddlRandom = (DropDownList)(gvr.FindControl("ddlRandom"));
- //this.currentPage = Convert.ToInt32(ddlRandom.SelectedIndex.ToString()) + 1;
-
- //Response.Redirect("SysManageUser.aspx?id=" + this.currentPage);
- }
- protected void IB_Key_Click(object sender, ImageClickEventArgs e)
- {
- }
- }