예제 #1
0
 // 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();
 }
예제 #2
0
        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);
            }
        }
예제 #3
0
 // Add methods
 public void AddStudent(Student student)
 {
     ESchoolDiaryData.Students.Add(student);
 }
예제 #4
0
 // Remove methods
 public void RemoveStudent(Student student)
 {
     ESchoolDiaryData.Students.Remove(student);
 }
예제 #5
0
        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
            }
        }
예제 #6
0
        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();
                }
            }
        }
예제 #7
0
 public void AddStudent(Student student)
 {
     this.Students.Add(student);
 }