SystemManage/RoleAdd.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Web.UI;

public partial class SystemManage_RoleAdd : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["roleid"] != null)
        {
            Authority myauthority = new Authority();
            int RoleID = Convert.ToInt16(Server.HtmlEncode(Request.Cookies["roleid"].Value));
            int ModuleID = 2;
            if (myauthority.QXExists(RoleID, ModuleID))
            {
                AjaxPro.Utility.RegisterTypeForAjax(typeof(SystemManage_RoleAdd));
            }
            else
            {
                MessageBox.ShowAndRedirect(this.Page, "对不起!您无权操作此版块。", "../Main.aspx");
            }
        }
        else
        {
            MessageBox.ShowAndRedirect(this.Page, "对不起!您还没有登录系统。", "../Logout.aspx");
        } 
    }
    [AjaxPro.AjaxMethod]
    public int Verify(string txtName)
    {
        Role myrole = new Role();
        if (txtName == "")
            return 1;
        else if (myrole.Exists(txtName))
            return 0;
        else
            return -1;
    }
    protected void butAdd_Click(object sender, ImageClickEventArgs e)
    {
        Role myrole = new Role();
        myrole.PoleName = this.tb_rolename.Text;
        myrole.RoleDescription = this.tb_rolediscription.Text;
        myrole.RoleNum = Convert.ToInt16(this.txtNum.Text);
        myrole.Add();

        //查询出RoleID
        string selectRoleId = "SELECT RoleID FROM Role WHERE PoleName='" + this.tb_rolename.Text + "'";
        int myroleid = Convert.ToInt16(DbHelperSQL.GetSingle(selectRoleId));
        //建立关系
        Authority myAuthority = new Authority();
        //设立关系中的 角色id
        myAuthority.RoleID = myroleid;
        for (int i = 0; i < this.cbl_quanxian.Items.Count; i++)
        {
            if (this.cbl_quanxian.Items[i].Selected == true)
            {
                //设立关系中的权限id
                myAuthority.ModuleID = Convert.ToInt16(this.cbl_quanxian.Items[i].Value);
                //添加关系入数据库
后面还有 8 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。