protected void lbUser_SelectedIndexChanged(object sender, EventArgs e) { if (lbUser.Items.Count < 1) { return; } BindCheckBox(); SetCheckBoxChecked(false); DataTable dt = new DAL.Tables.T_UserInGroups().Open("distinct GroupID", "UserID=" + Shove._Web.Utility.FilteSqlInfusion(lbUser.SelectedValue), ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_Competence"); return; } foreach (DataRow dr in dt.Rows) { cbGroup[int.Parse(dr["GroupID"].ToString()) - 1].Checked = true; } dt = new DAL.Tables.T_CompetencesOfUsers().Open("distinct CompetenceID", "UserID=" + Shove._Web.Utility.FilteSqlInfusion(lbUser.SelectedValue), ""); if (dt == null) { PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", "Admin_Competence"); return; } foreach (DataRow dr in dt.Rows) { cbCompetence[int.Parse(dr["CompetenceID"].ToString()) - 1].Checked = true; } // 超级管理员的权限不能修改。 if (_Site.AdministratorID == long.Parse(lbUser.SelectedValue)) //if ((_Site.Level == SiteLevels.MasterSite) && (lbUser.SelectedValue == "1")) { btnSave.Enabled = false; SetCheckBoxEnabled(false); } else { btnSave.Enabled = true; SetCheckBoxEnabled(true); } }
protected void lbUser_SelectedIndexChanged(object sender, EventArgs e) { if (this.lbUser.Items.Count >= 1) { this.BindCheckBox(); this.SetCheckBoxChecked(false); DataTable table = new Tables.T_UserInGroups().Open("distinct GroupID", "UserID=" + Utility.FilteSqlInfusion(this.lbUser.SelectedValue), ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_Competence"); } else { foreach (DataRow row in table.Rows) { this.cbGroup[int.Parse(row["GroupID"].ToString()) - 1].Checked = true; } table = new Tables.T_CompetencesOfUsers().Open("distinct CompetenceID", "UserID=" + Utility.FilteSqlInfusion(this.lbUser.SelectedValue), ""); if (table == null) { PF.GoError(4, "数据库繁忙,请重试", "Admin_Competence"); } else { foreach (DataRow row2 in table.Rows) { this.cbCompetence[int.Parse(row2["CompetenceID"].ToString()) - 1].Checked = true; } if (base._Site.AdministratorID == long.Parse(this.lbUser.SelectedValue)) { this.btnSave.Enabled = false; this.SetCheckBoxEnabled(false); } else { this.btnSave.Enabled = true; this.SetCheckBoxEnabled(true); } } } } }