protected void btnSave_Click(object sender, EventArgs e) { int roleid = Convert.ToInt32(rblRole.SelectedValue); int masterid = Convert.ToInt32(Request.QueryString["MasterId"].ToString()); MasterInfo master = new MasterInfo(masterid); if (rblIsOver.SelectedItem.Text == "通过") { master.State = 2; master.Save(); try { //添加角色 if (RoleInfo.isRoleMaster(masterid)) { RoleInfo.UpdateRoleMasters(masterid); } else { RoleMasterInfo rm = new RoleMasterInfo(); rm.RoleId = roleid; rm.MasterId = masterid; rm.IsPass = 1; rm.Save(); } //添加权限 if (RoleInfo.isActionMaster(masterid)) { RoleInfo.DelActionMaster(masterid); AddActionMaster(masterid); } else { AddActionMaster(masterid); } master.IsApply = 1; master.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('权限配置成功!');</script>"); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('配置失败:" + Ex.Message + "');", true); } } else { master.State = 3; master.Save(); } }