コード例 #1
0
    protected void btnAddAdmin_Click(object sender, EventArgs e)
    {
        string loginID = txtAdminID.Text.Trim();
        int    roleID  = Convert.ToInt32(ddlUserRole.SelectedItem.Value.Trim());
        Admin  admin   = adminManage.GetAdminByID(loginID);

        if (admin.LoginID == "")
        {
            int num = adminManage.AddAdmin(loginID, roleID);
            if (num > 0)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加成功!');</script>");
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('添加失败!');</script>");
            }
        }
        else
        {
            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('你添加的管理员帐户号已存在!');</script>");
        }
    }