public DialogTeachingHistory(DataGridViewRow row) { InitializeComponent(); currentSemester = new SemesterKey(cmd.GetCurrentSemesterKey()); string email = row.Cells["Email"].Value.ToString(); string name = row.Cells["FirstName"].Value.ToString() + " " + row.Cells["LastName"].Value.ToString(); ColumnProperties columnProperties = new ColumnProperties(); BuildView historyView = new BuildView() { GridView = DGV_DialogTeachingHistory, TabledData = cmd.TeacherHistory(email), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.courseCode, columnProperties.courseName, columnProperties.subjectName, columnProperties.collegeName, columnProperties.semesterName, columnProperties.period, columnProperties.teacherEmail_Hidden, columnProperties.teacherFullName_Hidden, columnProperties.semesterKey } }; historyView.Create(); historyView.GridView.MultiSelect = true; SetPeriod(); LBL_TeachingHistory_Name.Text = name; LBL_DialogTeacherHistoryResults.Text = string.Format("{0} Course(s)", historyView.ResultCount.ToString()); }
private void BTN_DialogRegisterAdd_Click(object sender, EventArgs e) { RegisterStudentInSemesterAtCollege regedStudent; if (LBL_DialogRegister_Name.Text.Contains("College")) { if (DGV_DialogRegister.SelectedRows[0].Index < 0) { _ = MessageBox.Show(null, "A selection is required.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } regedStudent = new RegisterStudentInSemesterAtCollege() { StudentEmail = DGV_DialogRegister.SelectedRows[0].Cells["StudentEmail"].Value.ToString(), Year = new DateTime(semesterKey.Year, 1, 1).Date, SecondSemester = semesterKey.Semester == 2, CollegeId = collegeId, RegistrationDate = DateTime.Now.Date }; if (cmd.AddRegistration(regedStudent)) { mainForm.GoToRegistrations( semesterKey.Key, collegeId, DGV_DialogRegister.SelectedRows[0].Cells["StudentEmail"].Value.ToString() ); } } else { if (DGV_DialogRegister.SelectedRows[0].Index < 0) { _ = MessageBox.Show(null, "A selection is required.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SemesterKey key = new SemesterKey((int)DGV_DialogRegister.SelectedRows[0].Cells["SemesterKey"].Value); regedStudent = new RegisterStudentInSemesterAtCollege() { StudentEmail = studentEmail, Year = new DateTime(key.Year, 1, 1).Date, SecondSemester = key.Semester.Equals(2), CollegeId = (int)DGV_DialogRegister.SelectedRows[0].Cells["CollegeId"].Value, RegistrationDate = DateTime.Now.Date }; if (cmd.AddRegistration(regedStudent)) { mainForm.GoToRegistrations( key.Key, (int)DGV_DialogRegister.SelectedRows[0].Cells["CollegeId"].Value, studentEmail ); } } }
// From Semester - alternate signature public DialogSemesterCollege(MainForm form, DataGridView dgv, int rowNumber) { InitializeComponent(); mainForm = form; DataGridViewRow row = dgv.Rows[rowNumber]; semesterKey = new SemesterKey(row.Cells["SemesterKey"].Value.ToString()); semesterName = row.Cells["SemesterName"].Value.ToString(); LBL_DialogSemesterCollege_Name.Text = "Semester:"; LBL_DialogSemesterCollege_Value.Text = semesterName; semesterCollegeView = new BuildView() { GridView = DGV_SemesterCollege, TabledData = cmd.CollegesNotOperatingDuringSemester(semesterKey.Key), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.collegeId_Hidden, columnProperties.collegeName, columnProperties.address, columnProperties.city, columnProperties.state, columnProperties.postCode, columnProperties.semesterKey } }; semesterCollegeView.Create(); if (semesterCollegeView.ResultCount < 1) { LBL_DialogSemesterCollege_Results.Text = "No available College(s)"; BTN_DialogSemesterCollegeAdd.Enabled = false; } else { if (mainForm.currentSemester.Key >= semesterKey.Key) { BTN_DialogSemesterCollegeAdd.Enabled = false; LBL_DialogSemesterCollege_Results.Text = "Cannot operate in the past " + semesterCollegeView.ResultCount.ToString() + " College(s)"; } else { LBL_DialogSemesterCollege_Results.Text = semesterCollegeView.ResultCount.ToString() + " available College(s)"; } } }
// From Student Enrolments public DialogRegister(MainForm form, DataGridViewRow row) { InitializeComponent(); // Add values to variables mainForm = form; college = row.Cells["CollegeName"].Value.ToString(); semesterName = row.Cells["SemesterName"].Value.ToString(); semesterKey = new SemesterKey((int)row.Cells["SemesterKey"].Value); collegeId = (int)row.Cells["CollegeId"].Value; LBL_DialogRegister_Name.Text = "College:"; LBL_DialogRegister_Value.Text = college; LBL_DialogRegister_Semester.Text = "Semester:"; LBL_DialogRegister_SemesterValue.Text = semesterName; LBL_DialogRegister_Semester.Visible = true; LBL_DialogRegister_SemesterValue.Visible = true; // Create DataGridView ColumnProperties columnProperties = new ColumnProperties(); BuildView registerView = new BuildView() { GridView = DGV_DialogRegister, TabledData = cmd.AllExceptRegisteredStudents(semesterKey.Key, collegeId), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.studentFirstName_Dialog, columnProperties.studentLastName_Dialog, columnProperties.studentEmail } }; registerView.Create(); // Sundry functions if (form.currentSemester.Key >= semesterKey.Key) { BTN_DialogRegisterAdd.Enabled = false; LBL_DialogRegisterResults.Text = string.Format("Cannot register in the past {0} unregistered students(s)", registerView.ResultCount.ToString()); } else { LBL_DialogRegisterResults.Text = string.Format("Select a student from {0} unregistered students(s)", registerView.ResultCount.ToString()); } }
public DialogEnrol(MainForm form, DataGridViewRow row) { InitializeComponent(); // Add values to variables mainForm = form; name = row.Cells["StudentFullName"].Value.ToString(); college = row.Cells["CollegeName"].Value.ToString(); semesterName = row.Cells["SemesterName"].Value.ToString(); email = row.Cells["StudentEmail"].Value.ToString(); semesterKey = new SemesterKey((int)row.Cells["SemesterKey"].Value); collegeId = (int)row.Cells["CollegeId"].Value; currentSemester = mainForm.currentSemester; LBL_DialogEnrol_Name.Text = name; LBL_DialogEnrol_College.Text = college; LBL_DialogEnrol_Semester.Text = semesterName; // Create DataGridView columnProperties = new ColumnProperties() { }; enrolView = new BuildView() { GridView = DGV_DialogEnrol, TabledData = cmd.DialogEnrolment(semesterKey.Key, collegeId, email), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.courseCode, columnProperties.courseName, columnProperties.year, columnProperties.isSecondSemester, columnProperties.collegeName, columnProperties.fee, columnProperties.dateEnroled, columnProperties.select_Hidden }, ButtonColumns = new ButtonColumn[] { columnProperties.enrol } }; enrolView.Create(); // Sundry functions DGV_DialogEnrol.CurrentCellDirtyStateChanged += new EventHandler(DGV_DialogEnrol_CurrentCellDirtyStateChanged); }
public DialogSubjectUnit(MainForm form, DataGridViewRow row) { InitializeComponent(); // Add values to variables mainForm = form; currentSemester = mainForm.currentSemester; semesterKey = new SemesterKey(row.Cells["SemesterKey"].Value.ToString()); semesterName = row.Cells["SemesterName"].Value.ToString(); collegeId = (int)row.Cells["CollegeId"].Value; college = row.Cells["CollegeName"].Value.ToString(); courseCode = row.Cells["CourseCode"].Value.ToString(); courseName = row.Cells["CourseName"].Value.ToString(); // Create DataGridView comboBoxColumn = columnProperties.subject; comboBoxColumn.ComboData = new MainDAL().ViewSubjectAssignments(semesterKey.Key, collegeId, courseCode, 0, ""); subjectUnitView = new BuildView() { GridView = DGV_DialogSubjectUnit, TabledData = cmd.SpecialSubjectUnit(semesterKey.Key, collegeId, courseCode), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.unitCode, columnProperties.unitDescription, columnProperties.subjectId_Hidden, columnProperties.subjectName_Hidden, columnProperties.core, columnProperties.select_CheckBox }, ComboBoxColumns = new ComboBoxColumn[] { comboBoxColumn }, EditMode = DataGridViewEditMode.EditOnEnter }; comboBoxColumn.Create(); // Column must be added to grid on 'data binding complete' subjectUnitView.Create(); // Sundry functions GetLoadedUnits(); SelectCore(); LBL_DialogSubjectUnit_Course.Text = courseCode + " - " + courseName; LBL_DialogSubjectUnit_College.Text = college; LBL_DialogSubjectUnit_Semester.Text = semesterName; }
public DialogCourseSubject(MainForm form, DataGridViewRow row) { InitializeComponent(); // Add values to variables mainForm = form; currentSemester = mainForm.currentSemester; semesterKey = new SemesterKey((int)row.Cells["SemesterKey"].Value); semesterName = row.Cells["SemesterName"].Value.ToString(); collegeId = (int)row.Cells["CollegeId"].Value; college = row.Cells["CollegeName"].Value.ToString(); courseCode = row.Cells["CourseCode"].Value.ToString(); courseName = row.Cells["CourseName"].Value.ToString(); // Create DataGridView comboBoxColumn = columnProperties.teacher; courseSubjectView = new BuildView() { GridView = DGV_DialogCourseSubject, TabledData = cmd.SpecialCourseSubject(semesterKey.Key, collegeId, courseCode), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.semesterKey, columnProperties.collegeId_Hidden, columnProperties.courseCode_Hidden, columnProperties.subjectId_Hidden, columnProperties.subjectName, columnProperties.teacherFullName_Hidden, columnProperties.teacherEmail_Hidden, columnProperties.select_CheckBox }, ComboBoxColumns = new ComboBoxColumn[] { comboBoxColumn }, EditMode = DataGridViewEditMode.EditOnEnter }; comboBoxColumn.Create(); // Column must be added on 'data binding complete' courseSubjectView.Create(); // Sundry functions GetLoadedSubjects(); LBL_DialogCourseSubject_Course.Text = courseCode + " - " + courseName; LBL_DialogCourseSubject_College.Text = college; LBL_DialogCourseSubject_Semester.Text = semesterName; }
private void BTN_DialogSemesterCollegeAdd_Click(object sender, EventArgs e) { if (LBL_DialogSemesterCollege_Name.Text.Contains("College")) { if (DGV_SemesterCollege.SelectedRows[0].Index < 0) { _ = MessageBox.Show(null, "A selection is required.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } semesterKey = new SemesterKey(DGV_SemesterCollege.SelectedRows[0].Cells["SemesterKey"].Value.ToString()); SemesterAtCollege semesterAtCollege = new SemesterAtCollege() { Year = new DateTime(semesterKey.Year, 1, 1), SecondSemester = semesterKey.Semester == 2, CollegeId = collegeId }; if (cmd.AddSemesterAtCollege(semesterAtCollege)) { mainForm.GoToSemesterAtCollege(semesterKey.Key, collegeId); } } else if (LBL_DialogSemesterCollege_Name.Text.Contains("Semester")) { if (DGV_SemesterCollege.SelectedRows[0].Index < 0) { _ = MessageBox.Show(null, "A selection is required.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } collegeId = (int)DGV_SemesterCollege.SelectedRows[0].Cells["CollegeId"].Value; SemesterAtCollege semesterAtCollege = new SemesterAtCollege() { Year = new DateTime(semesterKey.Year, 1, 1), SecondSemester = semesterKey.Semester == 2, CollegeId = collegeId }; if (cmd.AddSemesterAtCollege(semesterAtCollege)) { mainForm.GoToSemesterAtCollege(semesterKey.Key, collegeId); } } }
public DialogGrade(MainForm form, DataGridViewRow row) { // Mainform currently unused - keeping dialog constructor params consistant InitializeComponent(); semesterKey = new SemesterKey((int)row.Cells["SemesterKey"].Value); collegeId = (int)row.Cells["CollegeId"].Value; courseCode = row.Cells["CourseCode"].Value.ToString(); email = row.Cells["StudentEmail"].Value.ToString(); name = row.Cells["StudentFullName"].Value.ToString(); college = row.Cells["CollegeName"].Value.ToString(); semesterName = row.Cells["SemesterName"].Value.ToString(); course = row.Cells["CourseName"].Value.ToString(); LBL_DialogGrade_Name.Text = name; LBL_DialogGrade_College.Text = college; LBL_DialogGrade_Semester.Text = semesterName; LBL_DialogGrade_Course.Text = courseCode + " - " + course; ColumnProperties columnProperties = new ColumnProperties(); gradesView = new BuildView() { GridView = DGV_DialogGrade, TabledData = cmd.DialogGrades(semesterKey.Key, collegeId, email, courseCode), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.unitCode, columnProperties.unitDescription, columnProperties.subjectName, columnProperties.subjectId_Hidden, columnProperties.competent_CheckBox, columnProperties.rpl_CheckBox, columnProperties.dateGraded }, EditMode = DataGridViewEditMode.EditOnEnter }; gradesView.Create(); GetGradedUnits(); }
public DialogCollegeCourse(MainForm form, DataGridViewRow row) { InitializeComponent(); mainForm = form; college = row.Cells["CollegeName"].Value.ToString(); semesterName = row.Cells["SemesterName"].Value.ToString(); semesterKey = new SemesterKey((int)row.Cells["SemesterKey"].Value); collegeId = (int)row.Cells["CollegeId"].Value; ColumnProperties columnProperties = new ColumnProperties(); BuildView collegeCourseView = new BuildView() { GridView = DGV_DialogCollegeCourse, TabledData = cmd.CoursesNotRunning(semesterKey.Key, collegeId), DataGridViewColumns = new DataGridViewColumn[] { columnProperties.courseCode, columnProperties.courseName } }; collegeCourseView.Create(); // TODO - On hold whilst deciding how TAB navigation should operate // collegeCourseView.GridView.TabStop = true; LBL_DialogCollegeCourse_College.Text = college; LBL_DialogCollegeCourse_Semester.Text = semesterName; if (form.currentSemester.Key >= semesterKey.Key) { BTN_DialogCollegeCourseAdd.Enabled = false; LBL_DialogCollegeCourse_Results.Text = string.Format("Cannot assign in the past {0} course(s)", collegeCourseView.ResultCount.ToString()); } else { LBL_DialogCollegeCourse_Results.Text = string.Format("{0} available course(s)", collegeCourseView.ResultCount.ToString()); } }