private SubjectEntity MapOneSubject(SubjectModel subjectModel) { string subjectJson = TimetableSerializer.SerializeToJson(subjectModel); string subjectHash = HashCoder.GetSha256Hash(subjectJson); var info = new SubjectInfoEntity { Title = subjectModel.Title, Teachers = subjectModel.Teachers, LectureStartDate = subjectModel.LectureStartDate, LectureEndDate = subjectModel.LectureEndDate, PracticeStartDate = subjectModel.PracticeStartDate, PracticeEndDate = subjectModel.PracticeEndDate }; string infoJson = TimetableSerializer.SerializeToJson(info); string infoHash = HashCoder.GetSha256Hash(infoJson); info.Hash = infoHash; string daysJson = TimetableSerializer.SerializeToJson(subjectModel.Days); string daysHash = HashCoder.GetSha256Hash(daysJson); SubjectEntity entity = new SubjectEntity { Info = info, Days = MapSchoolDays(subjectModel.Days), HashDays = daysHash, Hash = subjectHash }; return(entity); }
private SchoolDayEntity MapOneSchoolDay(SchoolDayModel day) { string dayJson = TimetableSerializer.SerializeToJson(day); string dayHash = HashCoder.GetSha256Hash(dayJson); var entity = new SchoolDayEntity { Day = day.Day, IsDayOfEvenWeek = day.IsDayOfEvenWeek, Periods = MapPeriods(day.Periods), Hash = dayHash }; return(entity); }
public TimetableEntity MapTimetable(TimetableModel timetableModel) { string jsonTimetable = TimetableSerializer.SerializeToJson(timetableModel); string hashTimetable = HashCoder.GetSha256Hash(jsonTimetable); var entity = new TimetableEntity { Key = timetableModel.Key, Groups = MapGroups(timetableModel.Groups), Subjects = MapSubjects(timetableModel.Subjects), Hash = hashTimetable }; return(entity); }
private PeriodEntity MapOnePeriod(PeriodModel period) { string periodJson = TimetableSerializer.SerializeToJson(period); string periodHash = HashCoder.GetSha256Hash(periodJson); var entity = new PeriodEntity { Number = period.Number, Cabinet = period.Cabinet, Subgroup = period.Subgroup, IsLecture = period.IsLecture, Option = period.Modification.Option, OptionDate = period.Modification.Date, OptionCabinet = period.Modification.Cabinet, Hash = periodHash }; return(entity); }