📄 userrole.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 Itsv.BLL.SystemManage;
public partial class SystemManage_RightTop : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataSet ds = this.GetRoleData();
if (ds != null)
{
this.ddlRoles.DataSource = ds.Tables[0];
this.ddlRoles.DataTextField = "role_Name";
this.ddlRoles.DataValueField = "role_id";
this.ddlRoles.DataBind();
ds.Dispose();
ds = null;
}
if (Request.QueryString["userid"] != null)
{
this.lblAccount.Text = Request.QueryString["userid"];
User_RoleBLL urbll = new User_RoleBLL();
Itsv.Model.User_Role ur = urbll.GetModel(Request.QueryString["userid"], ref msg);
urbll = null;
if (ur == null)
{
return;
}
else
{
this.ddlRoles.SelectedIndex = this.ddlRoles.Items.IndexOf(this.ddlRoles.Items.FindByValue(ur.role_id.ToString()));
}
}
}
}
private DataSet GetRoleData()
{
RolesBLL rbll = new RolesBLL();
DataSet ds = rbll.GetList("", ref msg);
if (ds == null)
{
this.ShowMessage(msg);
}
rbll = null;
return ds;
}
protected void btnAdd_Click(object sender, EventArgs e)
{
Itsv.Model.User_Role ur = new Itsv.Model.User_Role();
ur.role_id = int.Parse(this.ddlRoles.SelectedItem.Value);
ur.account = this.lblAccount.Text;
User_RoleBLL urbll = new User_RoleBLL();
if (urbll.Add(ur, ref msg))
{
this.ShowMessage("设置权限成功!");
}
urbll = null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -