📄 module_add.aspx.cs
字号:
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 Sovo.OA.BLL;
using Sovo.OA.BLL.Utils;
using Sovo.OA.Model;
public partial class Admin_System_module_add : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ModuleBLL mBLL = new ModuleBLL();
GridView1.DataSource = mBLL.getAllModulesForDS();
GridView1.DataBind();
}
protected void ddlParentModule_DataBound(object sender, EventArgs e)
{
//加入所有权限的根目录
ddlParentModule.Items.Insert(0, new ListItem("root", "100"));
}
protected void Button1_Click(object sender, EventArgs e)
{
ModuleBLL mBLL = new ModuleBLL();
String parentID = ddlParentModule.SelectedItem.Value;
String moduleID = mBLL.getNextID(parentID);
lblMsg.Text = "parentID=" + parentID + "moduleID=" + moduleID;
String moduleName = txtModuleName.Text;
String description = txtModuleDescription.Text;
String link = txtLink.Text;
//--再数据库中新增Module
mBLL.addModule(moduleID, moduleName, parentID, description, link);
ddlParentModule.DataSourceID = "";
ddlParentModule.DataSource = mBLL.getFristModules();
ddlParentModule.DataBind();
GridView1.DataSource = mBLL.getAllModulesForDS();
GridView1.DataBind();
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int index = Convert.ToInt32(e.CommandArgument.ToString());
String moduleID = Convert.ToString(GridView1.DataKeys[index].Value);
if (e.CommandName == "deleteModule")
{
ModuleBLL mBLL = new ModuleBLL();
DBResult result = mBLL.deleteModuleByID(moduleID);
Literal txtMsg = new Literal();
if (result == DBResult.Success)
{
txtMsg.Text = "<script>alert('删除成功!')</script>";
Page.Controls.Add(txtMsg);
}
else
{
txtMsg.Text = "<script>alert('删除失败!')</script>";
Page.Controls.Add(txtMsg);
}
GridView1.DataSource = mBLL.getAllModulesForDS();
GridView1.DataBind();
ddlParentModule.DataSourceID = "";
ddlParentModule.DataSource = mBLL.getFristModules();
ddlParentModule.DataBind();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -