Пример #1
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        roleManageDb roleManageDb = new roleManageDb();

        if (roleManageDb.roleDel(this.hfRecord.Value))
        {
            this.JS.Text = "alert('删除成功!');";
            JavaScriptControl expr_2F = this.JS;
            expr_2F.Text = expr_2F.Text + "window.location.href='" + base.Request.Url.ToString() + "';";
            return;
        }
        this.JS.Text = "alert('该制度已被使用,目前不能删除!');";
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string text = base.Request.QueryString["strRoleCode"].Trim();

        if (text.Length != 0)
        {
            roleManageDb roleManageDb = new roleManageDb();
            DataTable    dataTable    = roleManageDb.selAllUsers(text);
            if (dataTable.Rows.Count == 0)
            {
                if (roleManageDb.roleDel(text))
                {
                    string text2 = "";
                    text2 += "<script language=JavaScript>alert(\"删除成功!\");window.location='roleList.aspx';</script>";
                    this.RegisterStartupScript("alert", text2);
                    return;
                }
                string script = "<script language=JavaScript>alert(\"删除失败!\");window.location='roleList.aspx';</script>";
                this.RegisterStartupScript("alert", script);
                return;
            }
            else
            {
                if (dataTable.Rows.Count > 0)
                {
                    string script2 = "<script language=JavaScript>alert(\"该角色被使用,不能删除!\");window.location='roleList.aspx';</script>";
                    this.RegisterStartupScript("alert", script2);
                    return;
                }
            }
        }
        else
        {
            string script3 = "<script language=JavaScript>alert(\"操作失败!\");window.location='roleList.aspx';</script>";
            this.RegisterStartupScript("alert", script3);
        }
    }