Ejemplo n.º 1
0
 //Adds students to the gridView based on the subject given.
 private void addStudents(Subject subject)
 {
     Student[] students = studentDatabase.getStudents(subject);
     for (int i = 0; i < students.Length; i++) {
         studentsGrid.addRecord(students[i]);
     }
 }
Ejemplo n.º 2
0
 //Used to allow for right-clicking to remove subjects
 private void selectSubjectToRemove(object sender, MouseEventArgs e)
 {
     //http://stackoverflow.com/questions/5239913/get-rowindex-via-contextmenu
      	        if (e.Button == MouseButtons.Right) {
         DataGridView.HitTestInfo hit = ui.subjects.HitTest(e.X, e.Y);
         if (hit.Type == DataGridViewHitTestType.Cell)
         {
             subjectToRemove = (Subject)ui.subjects.Rows[hit.RowIndex].Cells[0].Value;
             ui.subjects.ContextMenuStrip.Items.Clear();
             ui.subjects.ContextMenuStrip.Items.Add("Remove " + subjectToRemove.ToString());
         }
     }
 }
Ejemplo n.º 3
0
 //Removes all students for a particular subject from the gridView.
 private void removeStudents(Subject subject)
 {
     Student[] students = studentDatabase.getStudents(subject);
     foreach (Student s in students) {
         studentsGrid.removeRecord(s);
     }
 }