Exemplo n.º 1
0
 // Interface methods implementation
 public void AddMark(Mark mark)
 {
     ESchoolDiaryData.Marks.Add(mark);
 }
Exemplo n.º 2
0
        private static void LoadMarks()
        {
            string filePath = @"../../Data/students_marks.txt";

            StreamReader reader = new StreamReader(filePath);
            using (reader)
            {
                string currentLine = reader.ReadLine();

                while (currentLine != null)
                {
                    string[] currentLineArray = currentLine.Split('#');

                    TypeOfMarks markType = new TypeOfMarks();
                    switch (currentLineArray[1])
                    {
                        case "Current": markType = TypeOfMarks.Current; break;
                        case "Term": markType = TypeOfMarks.Term; break;
                        case "Annual": markType = TypeOfMarks.Annual; break;
                    }

                    // 3,50#Current#1111111111#10#A#Math  -  Sample record of mark
                    Mark currMark = new Mark(decimal.Parse(currentLineArray[0]), markType, long.Parse(currentLineArray[2]),
                                                  int.Parse(currentLineArray[3]), char.Parse(currentLineArray[4]),
                                                  currentLineArray[5]);

                    ESchoolDiaryData.Marks.Add(currMark);

                    currentLine = reader.ReadLine();
                }
            }
        }