private void LoadSections() { List <Section> sections = YearLevel.GetYearLevelSections(YearLevel.GetYearLevelID(_YearLevels, cmbEducationLevel.Text, cmbYearLevel.Text)); cmbSections.Tag = sections; cmbSections.Items.Clear(); foreach (var item in sections) { cmbSections.Items.Add(item.SectionName); } }
private void button1_Click(object sender, EventArgs e) { int YearLevelID = YearLevel.GetYearLevelID(_YearLevels, cmbEducationLevel.Text, cmbYearLevel.Text); List <Section> sections = cmbSections.Tag as List <Section>; int SelectedSection = sections[cmbSections.SelectedIndex].SectionID; StudentRegistrationInfo model = new StudentRegistrationInfo() { RegisteredStudentID = 0, StudentID = _StudentInfo.StudentID, YearLevelID = YearLevelID, SectionID = SelectedSection, SchoolYearID = 1, }; if (StudentRegistrationInfo.RegisterStudent(model) == true) { MessageBox.Show("Student information has been successfully registered!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Error occured while registration!", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }