private void BtnAddSections_Click(object sender, EventArgs e) { GradingSection gradingSection = new GradingSection(); gradingSection.SectionName = string.Empty; GradingPostionsEditForm gradingPostionsEditForm = new GradingPostionsEditForm(gradingSection); if (gradingPostionsEditForm.ShowDialog() != DialogResult.OK) { return; } gradingSection = gradingPostionsEditForm._GradingSection; if (!this.lstGradingSections.Items.Contains(gradingSection)) { this.lstGradingSections.Items.Add(gradingSection); this.lstGradingSections.SelectedIndex = this.lstGradingSections.FindStringExact(gradingSection.SectionName); } else { this.lstGradingSections.SelectedIndex = this.lstGradingSections.FindStringExact(gradingSection.SectionName); Webb.Utilities.MessageBoxEx.ShowMessage("faild to add a existing name in the list!"); } }
private void BtnEdit_Click(object sender, EventArgs e) { int selectIndex = this.lstGradingSections.SelectedIndex; if (selectIndex < 0) { return; } this._CurrentSelectSection = this.lstGradingSections.SelectedItem as GradingSection; GradingPostionsEditForm gradingPostionsEditForm = new GradingPostionsEditForm(this._CurrentSelectSection); if (gradingPostionsEditForm.ShowDialog() != DialogResult.OK) { return; } this._CurrentSelectSection = gradingPostionsEditForm._GradingSection; this.lstGradingSections.Items[selectIndex] = this._CurrentSelectSection; ListSelectSectionsChanged(); }