private void btnAddSubject_Click(object sender, EventArgs e) { subjects = new Subjects(); getNewData(); #region AddOrUpdateLogix int index; Boolean flag = Helper.checkSubjectExist(subjects, out index); if (flag) { Subjects.subjects[index].subjectMark = subjects.subjectMark; Subjects.subjects[index].subjectName = subjects.subjectName; } else { Subjects.addSubject(subjects); } #endregion }
private void btnSubjectDelete_Click(object sender, EventArgs e) { int index; Helper.checkSubjectExist(subjects, out index); try { Subjects.removeSubject(index); } catch (IndexOutOfRangeException ex) { MessageBox.Show(ex.Message); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Adding new Subject to subjects collection /// </summary> /// <param name="subj">Subjects refrence</param> public static void addSubject(Subjects subj) { subjects.Add(subj); }
private void btnRefresh_Click(object sender, EventArgs e) { cmbSubjects.DataSource = Subjects.getSubjectNames(); }