diff --git a/LangLang/Domain/Models/Course.cs b/LangLang/Domain/Models/Course.cs index c37037d..88340fb 100644 --- a/LangLang/Domain/Models/Course.cs +++ b/LangLang/Domain/Models/Course.cs @@ -124,7 +124,7 @@ public override string ToString() { sbDays.Remove(sbDays.Length - 1, 1); } - return string.Join("|", new object[] { Id, TutorId, Language, Level.ToString(), NumberOfWeeks, sbDays.ToString(), Online, NumberOfStudents, MaxStudents, StartDateTime.ToString(), CreatedByDirector, Modifiable, GratitudeEmailSent, CreatedAt}); + return string.Join("|", new object[] { Id, TutorId, Language, Level.ToString(), NumberOfWeeks, sbDays.ToString(), Online, NumberOfStudents, MaxStudents, StartDateTime.ToString(Constants.DATE_TIME_FORMAT), CreatedByDirector, Modifiable, GratitudeEmailSent, CreatedAt.ToString(Constants.DATE_TIME_FORMAT) }); } public string ToPdfString() diff --git a/LangLang/Repositories/CourseRepository.cs b/LangLang/Repositories/CourseRepository.cs index 04360a4..328697b 100644 --- a/LangLang/Repositories/CourseRepository.cs +++ b/LangLang/Repositories/CourseRepository.cs @@ -69,7 +69,7 @@ public Dictionary Load() bool createdByDirector = bool.Parse(tokens[10]); bool modifiable = bool.Parse(tokens[11]); bool gratitudeEmailSent = bool.Parse(tokens[12]); - DateTime createdAt = DateTime.Parse(tokens[13]); + DateTime createdAt = DateTime.ParseExact(tokens[13], Constants.DATE_TIME_FORMAT, null); var course = new Course(id, tutorId, language, level, numOfWeeks, daysOfWeek, online, numOfStud, maxStud, startDateTime, createdByDirector, modifiable, gratitudeEmailSent, createdAt); courses.Add(course.Id, course); diff --git a/LangLang/Repositories/ExamSlotRepository.cs b/LangLang/Repositories/ExamSlotRepository.cs index 8a4425b..3d9caf7 100644 --- a/LangLang/Repositories/ExamSlotRepository.cs +++ b/LangLang/Repositories/ExamSlotRepository.cs @@ -95,7 +95,8 @@ public void Save() exam.Applicants.ToString(), exam.Modifiable.ToString(), exam.ResultsGenerated.ToString(), - exam.ExamineesNotified.ToString()); + exam.ExamineesNotified.ToString(), + exam.CreatedAt.ToString(Constants.DATE_TIME_FORMAT)); }); File.WriteAllLines(_filePath, lines); @@ -123,8 +124,8 @@ public Dictionary Load() bool modifiable = bool.Parse(values[8]); bool resultsGenerated = bool.Parse(values[9]); bool examineesNotified = bool.Parse(values[10]); - DateTime createdAt = DateTime.Parse(values[11]); - + DateTime createdAt = DateTime.ParseExact(values[11], Constants.DATE_TIME_FORMAT, null); + ExamSlot exam = new ExamSlot(id, language, level, timeSlot, maxStudents, tutorId, applicants, modifiable, resultsGenerated, examineesNotified, createdAt); exams.Add(id, exam); diff --git a/LangLang/Repositories/PenaltyPointRepository.cs b/LangLang/Repositories/PenaltyPointRepository.cs index 4ed54e6..7f07767 100644 --- a/LangLang/Repositories/PenaltyPointRepository.cs +++ b/LangLang/Repositories/PenaltyPointRepository.cs @@ -76,7 +76,7 @@ public void Save() point.StudentId.ToString(), point.TutorId.ToString(), point.CourseId.ToString(), - point.Date.ToString()); + point.Date.ToString(Constants.DATE_TIME_FORMAT)); }); File.WriteAllLines(_filePath, lines); @@ -98,7 +98,7 @@ public Dictionary Load() int studentId = int.Parse(values[1]); int tutorId = int.Parse(values[2]); int courseId = int.Parse(values[3]); - DateTime date = DateTime.Parse(values[4]); + DateTime date = DateTime.ParseExact(values[4], Constants.DATE_TIME_FORMAT, null); PenaltyPoint point = new PenaltyPoint( id, studentId, tutorId, courseId, date); points.Add(point.Id, point);