public FormProfessor(string reg_num, FormLogin login) { InitializeComponent(); this.login = login; ChooseCourseMnBtn.BackColor = Color.FromArgb(100, 10, 10, 10); ModifyProjectMnBtn.BackColor = Color.FromArgb(100, 10, 10, 10); ModifyTeamMnBtn.BackColor = Color.FromArgb(100, 10, 10, 10); GradeProjectsMnBtn.BackColor = Color.FromArgb(100, 10, 10, 10); label1.BackColor = Color.FromArgb(100, 10, 10, 10); LogoutBtn.BackColor = Color.FromArgb(100, 10, 10, 10); TeamGroupBox.Paint += Paint; ProjectGroupBox.Paint += Paint; GradeGroupBox.Paint += Paint; currentUser = Database.GetUser(UserTypes.PROFESSOR, reg_num); user = (Professor)currentUser; //Courses List: A list that displays professor's courses CoursesList.Bounds = new Rectangle(new Point(450, 50), new Size(275, 400)); CoursesList.View = View.Details; CoursesList.FullRowSelect = true; CoursesList.GridLines = true; CoursesList.Sorting = SortOrder.Ascending; CoursesList.Columns.Add("Cource name", -2, HorizontalAlignment.Center); CoursesList.Columns.Add("ID", -2, HorizontalAlignment.Center); foreach (Course course in user.getCourseList()) { var listViewItem = new ListViewItem(course.getCourseName()); listViewItem.SubItems.Add(course.getCourseID()); CoursesList.Items.Add(listViewItem); } SelectedCourseLabel.Location = new Point(475, 20); SelectCourseBtn.Location = new Point(551, 458); //============================================================================== //Project List:A list that displays the professor's projects ProjectList.Bounds = new Rectangle(new Point(150, 12), new Size(250, 500)); ProjectList.View = View.Details; ProjectList.FullRowSelect = true; ProjectList.GridLines = true; ProjectList.Sorting = SortOrder.Ascending; ProjectList.Columns.Add("ID", -2, HorizontalAlignment.Left); ProjectList.Columns.Add("Project Name", -2, HorizontalAlignment.Left); ProjectList.Columns.Add("Max Grade", -2, HorizontalAlignment.Left); //========================================================================== //Students List: A list that displays each teams infos TeamList.Bounds = new Rectangle(new Point(150, 12), new Size(375, 500)); TeamList.View = View.Details; TeamList.FullRowSelect = true; TeamList.GridLines = true; TeamList.Sorting = SortOrder.Ascending; TeamList.Columns.Add("Team", -2, HorizontalAlignment.Left); TeamList.Columns.Add("Student 1", -2, HorizontalAlignment.Left); TeamList.Columns.Add("Student 2", -2, HorizontalAlignment.Left); TeamList.Columns.Add("Student 3", -2, HorizontalAlignment.Left); TeamList.Columns.Add("Student 4", -2, HorizontalAlignment.Left); TeamList.Columns.Add("Student 5", -2, HorizontalAlignment.Left); //============================================================================= //Grade List: A list that displays the team with its project an the grade GradeList.Bounds = new Rectangle(new Point(150, 12), new Size(275, 500)); GradeList.View = View.Details; GradeList.FullRowSelect = true; GradeList.GridLines = true; GradeList.Sorting = SortOrder.Ascending; GradeList.Columns.Add("Team", -2, HorizontalAlignment.Left); GradeList.Columns.Add("Project ID", -2, HorizontalAlignment.Left); GradeList.Columns.Add("Project name", -2, HorizontalAlignment.Left); GradeList.Columns.Add("Project Uploaded", -2, HorizontalAlignment.Left); GradeList.Columns.Add("Grade", -2, HorizontalAlignment.Left); //============================================================================== //Teams Right Click menu creation ToolStripMenuItem TeamRightClickMenuEdit = new ToolStripMenuItem("Edit"); ToolStripMenuItem TeamRightClickMenuDelete = new ToolStripMenuItem("Delete"); TeamRightClickMenuDelete.Click += new EventHandler(TeamDelete_RightClick); TeamRightClickMenuEdit.Click += new EventHandler(TeamEdit_RightClick); TeamRightClickMenu.Items.AddRange(new ToolStripItem[] { TeamRightClickMenuEdit, TeamRightClickMenuDelete }); //========================================================================================================== //Projects Right Click menu creation ToolStripMenuItem ProjectRightClickMenuEdit = new ToolStripMenuItem("Edit"); ToolStripMenuItem ProjectRightClickMenuDelete = new ToolStripMenuItem("Delete"); ProjectRightClickMenuDelete.Click += new EventHandler(ProjectDelete_RightClick); ProjectRightClickMenuEdit.Click += new EventHandler(ProjectEdit_RightClick); ProjectRightClickMenu.Items.AddRange(new ToolStripItem[] { ProjectRightClickMenuEdit, ProjectRightClickMenuDelete }); //=================================================================================================================== CourseHolderLabel.BackColor = Color.FromArgb(100, 10, 10, 10); TeamGroupBox.Text = ""; ProjectGroupBox.Text = ""; GradeGroupBox.Text = ""; TeamGroupBox.Bounds = new Rectangle(new Point(550, 12), new Size(380, 355)); CoursesList.Show(); SelectCourseBtn.Show(); ChooseCourseMnBtn.BackColor = Color.Black; TeamGroupBox.Hide(); TeamList.Hide(); GradeList.Hide(); GradeGroupBox.Hide(); ProjectGroupBox.Hide(); ProjectList.Hide(); ModifyProjectMnBtn.Enabled = false; ModifyTeamMnBtn.Enabled = false; GradeProjectsMnBtn.Enabled = false; }
private void RefreshList() { currentUser = Database.GetUser(UserTypes.PROFESSOR, currentUser.registrationNumber.getRegNumString()); user = (Professor)currentUser; TeamList.Items.Clear(); var listViewItem = new ListViewItem(); foreach (Course course in user.getCourseList()) { if (course.getCourseID() == selectedCourse) { selCourse = course; break; } } foreach (Team team in selCourse.getTeamList()) { listViewItem = new ListViewItem(); listViewItem.Text = team.getTeamID(); foreach (Student stu in team.getStudentList()) { listViewItem.SubItems.Add(stu.registrationNumber.getRegNumString()); } TeamList.Items.Add(listViewItem); } ProjectList.Items.Clear(); foreach (Project proj in selCourse.getProjectList()) { listViewItem = new ListViewItem(); listViewItem.Text = proj.getProjectID(); listViewItem.SubItems.Add(proj.getname()); listViewItem.SubItems.Add(proj.getmaxGrade().ToString()); ProjectList.Items.Add(listViewItem); } GradeList.Items.Clear(); listViewItem = new ListViewItem(); foreach (Team team in selCourse.getTeamList()) { foreach (KeyValuePair <Project, ProjectFile> pair in team.getProjectAssignmentsD()) { if (DateTime.Compare(pair.Key.getDueDate(), DateTime.Now) < 0) { listViewItem = new ListViewItem(); listViewItem.Text = team.getTeamID(); listViewItem.SubItems.Add(pair.Key.getProjectID()); listViewItem.SubItems.Add(pair.Key.getname()); if (pair.Value == null) { listViewItem.SubItems.Add("No"); } else { listViewItem.SubItems.Add("Yes"); } try { if (!(pair.Value.getGrade() < 0)) { listViewItem.SubItems.Add(pair.Value.getGrade().ToString()); } else { listViewItem.SubItems.Add("-"); } } catch (NullReferenceException ex) { listViewItem.SubItems.Add("-"); } GradeList.Items.Add(listViewItem); } } } }
public void setProfessor(Professor professor) { this.professor = professor; }