private void datagridCourseTable_CellContentClick(object sender, DataGridViewCellEventArgs e) { Console.WriteLine(e.ColumnIndex); Console.WriteLine(e.RowIndex); int id = Convert.ToInt32(datagridCourseTable.Rows[e.RowIndex].Cells[0].Value); CourseDataHandler courseData = new CourseDataHandler(id); this.textboxCourseID.Text = courseData.GetID().ToString(); this.textboxCourseName.Text = courseData.GetName(); this.comboboxCourseCredits.SelectedIndex = courseData.GetCredits(); this.comboboxCourseDepartment.SelectedIndex = courseData.GetDepartment(); this.comboboxCourseEndTime.SelectedIndex = courseData.GetEndTime(); this.comboboxCourseSection.SelectedIndex = courseData.GetSection(); this.comboboxCourseStartTime.SelectedIndex = courseData.GetStartTime(); if (courseData.GetDaySlot() == 1) { radiobuttonSundayTuesday.Checked = true; } else { radiobuttonMondayWednesday.Checked = true; } this.tabControlAdmin.SelectTab(5); }
private void buttonCourseRemove_Click(object sender, EventArgs e) { CourseDataHandler courseData = new CourseDataHandler(); courseData.UnassignCourse(Convert.ToInt32(this.datagridFacultyCoursesAssigned.CurrentCell.Value.ToString())); UpdateForm(); }
private void comboboxCourseAssignFaculty_SelectedIndexChanged(object sender, EventArgs e) { CourseDataHandler courseData = new CourseDataHandler(); string FacultyName = this.comboboxCourseAssignFaculty.SelectedItem.ToString(); this.datagridFacultyCoursesAssigned.DataSource = courseData.GetFacultyCoursesAssigned(FacultyName); }
private void buttonCourseDelete_Click(object sender, EventArgs e) { int id = Convert.ToInt32(this.textboxCourseID.Text); CourseDataHandler courseData = new CourseDataHandler(id); courseData.DeleteCourse(); UpdateForm(); MessageBox.Show("Course Deleted"); }
private void buttonCourseAssign_Click(object sender, EventArgs e) { string FacultyName = this.comboboxCourseAssignFaculty.SelectedItem.ToString(); int CourseID = Convert.ToInt32(textboxCourseID.Text); CourseDataHandler courseData = new CourseDataHandler(); courseData.AssignCourse(FacultyName, CourseID); UpdateForm(); }
private void UpdateForm() { StudentDataHandler studentData = new StudentDataHandler(); FacultyDataHandler facultyData = new FacultyDataHandler(); CourseDataHandler courseData = new CourseDataHandler(); this.datagridStudentTable.DataSource = studentData.GetStudentTable(); this.datagridFacultyTable.DataSource = facultyData.GetFacultyTable(); this.datagridCourseTable.DataSource = courseData.GetCourseTable(); string FacultyName = this.comboboxCourseAssignFaculty.SelectedItem.ToString(); this.datagridFacultyCoursesAssigned.DataSource = courseData.GetFacultyCoursesAssigned(FacultyName); }
private void textboxSearchAssignCourse_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { CourseDataHandler courseData = new CourseDataHandler(); if (Regex.IsMatch(textboxSearchAssignCourse.Text, @"^[\p{L}]+$")) { this.datagridSearchAssignCourses.DataSource = courseData.SearchAssignCourseByName(textboxSearchAssignCourse.Text); } else if (textboxSearchAssignCourse.Text.Length > 0) { this.datagridSearchAssignCourses.DataSource = courseData.SearchAssignCourseByID(Convert.ToInt32(textboxSearchAssignCourse.Text)); } else { this.datagridSearchAssignCourses.DataSource = courseData.GetAssignCourseTable(); } } }
private void textboxCourseID_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { int id = Convert.ToInt32(this.textboxCourseID.Text); CourseDataHandler courseData = new CourseDataHandler(id); this.textboxCourseName.Text = courseData.GetName(); this.comboboxCourseCredits.SelectedIndex = courseData.GetCredits(); this.comboboxCourseDepartment.SelectedIndex = courseData.GetDepartment(); this.comboboxCourseEndTime.SelectedIndex = courseData.GetEndTime(); this.comboboxCourseSection.SelectedIndex = courseData.GetSection(); this.comboboxCourseStartTime.SelectedIndex = courseData.GetStartTime(); if (courseData.GetDaySlot() == 1) { radiobuttonSundayTuesday.Checked = true; } else { radiobuttonMondayWednesday.Checked = true; } } }
private void buttonCourseUpdate_Click(object sender, EventArgs e) { int id = Convert.ToInt32(this.textboxCourseID.Text); CourseDataHandler courseData = new CourseDataHandler(id); courseData.SetCredits(this.comboboxCourseCredits.SelectedIndex); courseData.SetDepartment(this.comboboxCourseDepartment.SelectedIndex); courseData.SetSection(this.comboboxCourseSection.SelectedIndex); courseData.SetStartTime(this.comboboxCourseStartTime.SelectedIndex); courseData.SetEndTime(this.comboboxCourseEndTime.SelectedIndex); courseData.SetName(this.textboxCourseName.Text); if (radiobuttonSundayTuesday.Checked) { courseData.SetDaySlot(1); } else { courseData.SetDaySlot(2); } courseData.UpdateCourse(); UpdateForm(); MessageBox.Show("Course Updated"); }
private void comboboxCourses_SelectedIndexChanged(object sender, EventArgs e) { FacultyDataHandler facultyData = new FacultyDataHandler(this.id); List <int?> CourseIDs = facultyData.GetCourseIDs(); string CourseName = comboboxCourses.SelectedItem.ToString(); int ansCourseID = 0; foreach (var courseid in CourseIDs) { CourseDataHandler courseData1 = new CourseDataHandler(courseid ?? 1); if (courseData1.GetName() == CourseName) { ansCourseID = courseid ?? 1; break; } } CourseDataHandler courseData = new CourseDataHandler(ansCourseID); this.labelCourseIDAns.Text = courseData.GetID().ToString(); this.labelCourseNameAns.Text = courseData.GetName().ToString(); this.labelCourseNameAnswer.Text = courseData.GetName().ToString(); this.labelDepartmentAns.Text = courseData.GetDepartment().ToString(); if (courseData.GetDaySlot() == 1) { this.labelDaysAns.Text = "Sun-Tues"; } else { this.labelDaysAns.Text = "Mon-Wed"; } this.labelStartTimeEndTime.Text = Times[courseData.GetStartTime()] + " - " + Times[courseData.GetEndTime()]; this.labelSectionAns.Text = Sections[courseData.GetSection()]; }
public AdminInterface(string id) { this.id = id; InitializeComponent(); foreach (var bg in Enum.GetValues(typeof(BloodGroup))) { comboboxFacultyBloodGroup.Items.Add(bg); comboboxStudentBloodGroup.Items.Add(bg); } foreach (var nationality in Enum.GetValues(typeof(Nationality))) { comboboxFacultyNationality.Items.Add(nationality); comboboxStudentNationality.Items.Add(nationality); } AdminDataHandler departmentData = new AdminDataHandler(); List <string> departmentList = departmentData.GetDepartmentData(); foreach (string dept in departmentList) { this.comboboxCourseDepartment.Items.Add(dept); this.comboboxFacultyDepartment.Items.Add(dept); this.comboboxStudentDepartment.Items.Add(dept); } foreach (string time in Times) { this.comboboxCourseStartTime.Items.Add(time); this.comboboxCourseEndTime.Items.Add(time); } foreach (int credit in Credits) { this.comboboxCourseCredits.Items.Add(credit); } foreach (string section in Sections) { this.comboboxCourseSection.Items.Add(section); } AdminDataHandler adminData = new AdminDataHandler(id); StudentDataHandler studentData = new StudentDataHandler(); FacultyDataHandler facultyData = new FacultyDataHandler(); CourseDataHandler courseData = new CourseDataHandler(); List <string> facultyList = facultyData.GetAllFaculty(); foreach (string faculty in facultyList) { this.comboboxCourseAssignFaculty.Items.Add(faculty); } this.Text = "Welcome, " + adminData.GetName(); this.labelPhoneAns.Text = adminData.GetPhone(); this.labelNameAns.Text = adminData.GetName(); this.labelMotherAns.Text = adminData.GetMother(); this.labelIDAns.Text = adminData.GetID(); this.labelGenderAns.Text = adminData.GetGender().ToString(); this.labelFatherAns.Text = adminData.GetFather(); this.labelEmailAns.Text = adminData.GetEmail(); this.labelDOBAns.Text = adminData.GetDOB(); this.labelBloodGroupAns.Text = Enum.GetName(typeof(BloodGroup), adminData.GetBloodGroup()); this.datagridStudentTable.DataSource = studentData.GetStudentTable(); this.datagridFacultyTable.DataSource = facultyData.GetFacultyTable(); this.datagridCourseTable.DataSource = courseData.GetCourseTable(); this.datagridSearchAssignCourses.DataSource = courseData.GetAssignCourseTable(); try { string FacultyName = this.comboboxCourseAssignFaculty.SelectedItem.ToString(); } catch { string FacultyName = "n/a"; this.datagridFacultyCoursesAssigned.DataSource = courseData.GetFacultyCoursesAssigned(FacultyName); } }