Exemplo n.º 1
0
 //Initialises the Student database by reading the config file for data file paths and constructing it.
 private void initDatabase()
 {
     StreamReader f = new StreamReader("config.txt");
     string subjectPath = f.ReadLine();
     string studentPath = f.ReadLine();
     f.Close();
     this.studentDatabase = new SubjectRollDatabase(studentPath, subjectPath);
 }
Exemplo n.º 2
0
 //Constructor
 internal Attender(GridViewForm studentGrid, List<Subject> subjects, SubjectRollDatabase database)
 {
     InitializeComponent();
     this.attendees = new List<Student>();
     this.Text = "Exam Attender";
     initScanners(SerialPort.GetPortNames());
     this.studentGrid = studentGrid;
     this.ui = UIBuilder.buildUI<ExamAttenderUI>(this);
     this.studentGrid.Show();
     this.students = retrieveAllStudents(subjects, database);
     ui.lookupBtn.Enabled = true;
     ui.updateSearchBox<Student>(students);
     ui.searchBox.TextChanged += checkButtonValidity;
     ui.searchBox.KeyDown += searchBoxEnterDown;
     ui.lookupBtn.Click += lookupBtnClicked;
     ui.recordBtn.Click += recordBtnClicked;
     ui.finaliseBtn.Click += finalise;
     ui.recordBtn.Enabled = false;
     displaySubjects(subjects);
 }
Exemplo n.º 3
0
 //Retreves all students from the database based on the subjects chosen. Remvoes Duplicates.
 private List<Student> retrieveAllStudents(List<Subject> subjects, SubjectRollDatabase database)
 {
     List<Student> allStudents = new List<Student>();
     for (int i = 0; i < subjects.Count; i++)
         allStudents.AddRange(database.getStudents(subjects[i]));
     return allStudents.Distinct().ToList();
 }