OpRoleManager.aspx.cs
上传用户:tiancihang
上传日期:2014-03-12
资源大小:21387k
文件大小:4k
源码类别:

.net编程

开发平台:

C#

  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11. using com.etong.DAL.FC;
  12. public partial class SysManage_OpRoleManager : System.Web.UI.Page
  13. {
  14.     protected void Page_Load(object sender, EventArgs e)
  15.     {
  16.         if (!IsPostBack)
  17.         {
  18.             EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  19.             DataView dv = EFlyPrj.GetAllOpRole();
  20.             GridView1.DataSource = dv;
  21.             GridView1.DataBind();
  22.             TB_Condition.Attributes.Add("onkeypress", "javascript:return EnterTextBox();");
  23.         }
  24.     }
  25.     protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
  26.     {
  27.         int currentpageindex;
  28.         currentpageindex = Convert.ToInt32(e.NewPageIndex);
  29.         if (currentpageindex == -2)
  30.         {
  31.             TextBox txtNewPageIndex;
  32.             txtNewPageIndex = GridView1.BottomPagerRow.FindControl("LinkTextBoxNewPage") as TextBox;
  33.             if (txtNewPageIndex != null)
  34.             {
  35.                 try
  36.                 {
  37.                     currentpageindex = Convert.ToInt32(txtNewPageIndex.Text) - 1;
  38.                 }
  39.                 catch
  40.                 {
  41.                     currentpageindex = 0;
  42.                 }
  43.             }
  44.         }
  45.         currentpageindex = currentpageindex < 0 ? 0 : currentpageindex;
  46.         currentpageindex = currentpageindex >= GridView1.PageCount ? GridView1.PageCount - 1 : currentpageindex;
  47.         GridView1.PageIndex = currentpageindex;
  48.         EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  49.         DataView dv = EFlyPrj.GetAllOpRole();
  50.         GridView1.DataSource = dv;
  51.         GridView1.DataBind();
  52.     }
  53.     protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
  54.     {
  55.         if (e.Row.RowType == DataControlRowType.DataRow)
  56.         {
  57.             int iRow;
  58.             iRow = e.Row.DataItemIndex;
  59.             iRow = iRow % 2;
  60.             if (iRow > 0)
  61.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='#f0f0f0';");
  62.             else
  63.                 e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';");
  64.             e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#E8F2FA';");
  65.             EtongFlyChouCode EFlyCode = new EtongFlyChouCode();
  66.             try
  67.             {
  68.                 e.Row.Cells[2].Text = EFlyCode.GetSortByID(e.Row.Cells[2].Text);
  69.             }
  70.             catch
  71.             {
  72.                 e.Row.Cells[6].Text = "未知";
  73.             }
  74.         }
  75.         
  76.     }
  77.     protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
  78.     {
  79.         int iOpID = Convert.ToInt32(GridView1.DataKeys[e.NewEditIndex].Value);
  80.         string sURL = "OpRoleModify.aspx?strN=M&strOp=" + iOpID;
  81.         //Response.Redirect(sURL);
  82.         this.ClientScript.RegisterStartupScript(this.GetType(), "0", "<script> window.showModalDialog('" + sURL + "','业务角色修改','help:0;dialogWidth:550px;dialogHeight:600px,location=no,status=no;');</script>");
  83.     }
  84.     protected void IB_Search_Click(object sender, ImageClickEventArgs e)
  85.     {
  86.         EtongFlyChouWFPrj EFlyPrj = new EtongFlyChouWFPrj();
  87.         if (DDL_Condition.SelectedValue == "1")
  88.         {
  89.             if (TB_Condition.Text == null || TB_Condition.Text.Trim() == "") ;
  90.             else
  91.             {
  92.                 try
  93.                 {
  94.                     EFlyPrj.OpID = Convert.ToInt32(TB_Condition.Text);
  95.                 }
  96.                 catch
  97.                 {
  98.                     this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:编号查询指允许输入数据,请输入数字!');", true);
  99.                     return;
  100.                 }
  101.             }
  102.         }
  103.         else if (DDL_Condition.SelectedValue == "2")
  104.         {
  105.             EFlyPrj.OpName = TB_Condition.Text.Trim();
  106.         }
  107.         else
  108.         {
  109.             this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('系统提示:请输入系统查询条件!');", true);
  110.             return;
  111.         }
  112.         DataView dv = new DataView();
  113.         dv = EFlyPrj.CheckOpByCondition();
  114.         GridView1.DataSource = dv;
  115.         GridView1.DataBind();
  116.     }
  117. }