internal StudentSelectForm(Student[] students) { InitializeComponent(); this.students = students; this.Width = 300; for (int i = 0; i < students.Length; i++) { PictureBox studentImage = new PictureBox(); studentImage.ImageLocation = students[i].imagePath; studentImage.Width = PICTURE_WIDTH; studentImage.Height = PICTURE_HEIGHT; studentImage.Left = HORIZONTAL_MARGIN; studentImage.Top = VERTICAL_MARGIN + (RECORD_DIVIDE * i); studentImage.Click += selectStudent; this.Controls.Add(studentImage); } }
internal void addRecord(Student student) { grid.Rows.Add(student, student.id); }
public void removeRecord(Student student) { grid.removeRecord<Student>(student); }
//Displayes student being looked up private void displayLookup(Student student) { ui.lookupPic.ImageLocation = student.imagePath; ui.recordBtn.Enabled = true; currentLookup = student; }
//Function to write the students to a file private void writeStudents(Student[] students, string filePath) { StreamWriter file = new StreamWriter(filePath); foreach (Student s in students) { file.WriteLine (s.ToString () + '\t' + s.id.ToString()); } file.Close(); }
//Records attendance of Student. private void recordAttendance(Student student) { studentGrid.removeRecord(student); students.Remove(student); ui.updateSearchBox<Student>(students); ui.studentPic.ImageLocation = student.imagePath; attendees.Add(student); ui.writeStatus(student.ToString() + " [" + student.id.ToString() + "] " + "attended"); }
private void selectStudent(object sender, EventArgs e) { PictureBox box = (PictureBox) sender; this.selectedStudent = students.First(student => student.imagePath.Equals(box.ImageLocation)); this.Close(); }