?? moduleadmin.aspx.cs
字號:
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 System.Security;
using System.Security.Principal;
using System.Web.Security;
using System.Data.SqlClient;
using qminoa.DA;
using qminoa.Common;
namespace qminoa.Webs.sysSecurity
{
public class Moduleadmin : qminoa.Webs.PageBase
{
protected System.Web.UI.WebControls.DataList FuncList;
protected System.Web.UI.WebControls.TextBox FuncName;
protected System.Web.UI.WebControls.TextBox FuncDescription;
protected System.Web.UI.WebControls.LinkButton AddFuncBtn;
private void Page_Load(object sender, System.EventArgs e)
{
this.PageBegin("模塊管理",true);
if (Page.IsPostBack == false)
{
BindData();
}
}
#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.FuncList.ItemCommand += new System.Web.UI.WebControls.DataListCommandEventHandler(this.FuncList_ItemCommand);
this.FuncList.ItemDataBound += new System.Web.UI.WebControls.DataListItemEventHandler(this.OnAttachScript);
this.AddFuncBtn.Click += new System.EventHandler(this.AddFuncBtn_Click);
}
#endregion
private void BindData()
{
AdminDB admin = new AdminDB();
FuncList.DataSource = admin.GetAllFuncs();
FuncList.DataBind();
}
private void FuncList_ItemCommand(object sender, DataListCommandEventArgs e)
{
AdminDB admin = new AdminDB();
int FuncID = (int) FuncList.DataKeys[e.Item.ItemIndex];
if (e.CommandName == "edit")
{
if(this.EmpRightCode >= 3)
{
Response.Redirect("FuncRightSet.aspx?funcid=" + FuncID,false);
}
else
{
JScript.Alert("您沒有權限進行此操作!");
}
}
else if (e.CommandName == "delete")
{
if(this.EmpRightCode == 4)
{
if(admin.DeleteFuncRoleUser(FuncID,"func"))
{
this.WriteOptLog("刪除模塊信息");
JScript.Alert("刪除成功!");
BindData();
}
else
JScript.Alert("刪除失敗!");
}
else
{
JScript.Alert("您沒有權限進行此操作!");
}
}
}
private void AddFuncBtn_Click(object sender, System.EventArgs e)
{
if(this.EmpRightCode >=2 )
{
if(FuncName.Text.ToString()!="")
{
bool result = (new AdminDB()).InsertFuncInfo(FuncName.Text.ToString(),FuncDescription.Text.ToString());
if(result == false)
JScript.Alert("添加失??!");
else
{
this.WriteOptLog("添加模塊角色關系信息");
JScript.Alert("添加成功!");
}
BindData();
FuncName.Text = "";
FuncDescription.Text = "";
}
else
{
JScript.Alert("您沒有權限進行此操作!");
}
}
}
private void OnAttachScript (object sender, System.Web.UI.WebControls.DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem)
{
ImageButton button = (ImageButton) e.Item.FindControl("Imagebutton2");
button.Attributes.Add ("onclick",
"return confirm (\"確定要刪除此項記錄嗎?\");");
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -