// Use it in the forms public Mark(decimal markValue, TypeOfMarks markType, Student student, Subject subject) { this.MarkValue = markValue; this.MarkType = markType; this.StudentPin = student.Pin; this.SchClass = student.SchClass; this.SchSubClass = student.SchSubClass; this.SubjectName = subject.Name.ToString(); }
public void PunishFor10Notes(Student student) { int counter = 0; foreach (var note in ESchoolDiaryData.Notes) { if (note.StudentPin == student.Pin) { counter++; } } if (counter >= 10) { // Expel the student this.RemoveStudent(student); } }
// Add methods public void AddStudent(Student student) { ESchoolDiaryData.Students.Add(student); }
// Remove methods public void RemoveStudent(Student student) { ESchoolDiaryData.Students.Remove(student); }
public void PunishFor5Notes(Student student) { int counter = 0; foreach (var note in ESchoolDiaryData.Notes) { if (note.StudentPin == student.Pin) { counter++; } } if (counter == 5) { // TODO: Punishment logic } }
private static void LoadStudents() { string filePath = @"../../Data/students.txt"; StreamReader reader = new StreamReader(filePath); using (reader) { string currentLine = reader.ReadLine(); while (currentLine != null) { string[] currentLineArray = currentLine.Split('#'); Sex sex = new Sex(); if (currentLineArray[3] == Sex.Male.ToString()) { sex = Sex.Male; } else { sex = Sex.Female; } Student currStudent = new Student(currentLineArray[0], currentLineArray[1], currentLineArray[2], sex, DateTime.Parse(currentLineArray[4]), Convert.ToInt64(currentLineArray[5]), currentLineArray[6], currentLineArray[7], currentLineArray[8], currentLineArray[9], int.Parse(currentLineArray[10]), char.Parse(currentLineArray[11])); ESchoolDiaryData.Students.Add(currStudent); currentLine = reader.ReadLine(); } } }
public void AddStudent(Student student) { this.Students.Add(student); }