Example #1
0
        //Make day from hint
        private void NewDay(MDay currentMDay, string weekId, DateTime dayWeek)
        {
            var newDay = new Day();

            newDay.Id      = Guid.NewGuid().ToString();
            newDay.WeekDay = currentMDay.Name;
            newDay.WeekId  = weekId;
            newDay.Date    = dayWeek;

            var dayExitst = _dbAgenda.GetDay(newDay.WeekDay, weekId);

            if (dayExitst == null)
            {
                _dbAgenda.SaveDay(newDay);
            }
            else
            {
                newDay.Id = dayExitst.Id;
            }

            foreach (var hour in currentMDay.Hours)
            {
                NewHour(hour, newDay.Id);
            }
        }
Example #2
0
        //Get all hours
        private Schedule GetHours(Schedule schedule, int currentDay, Day day)
        {
            var hours = _dbAgenda.GetHours(day.Id);

            foreach (var hour in hours)
            {
                schedule.SetCourse(hour.which - 1, currentDay, hour.Course);
                schedule.SetClassName(hour.which - 1, currentDay, hour.Class);
                schedule.SetTeacherName(hour.which - 1, currentDay, hour.ShortName);
            }

            return(schedule);
        }