コード例 #1
0
        public void ApplyToAllCourse(ApplyToAllCourseRequest body)
        {
            var areArgumentsValid = body != null
                && !string.IsNullOrEmpty(body.UserProfileId)
                && !string.IsNullOrEmpty(body.ClassRoomId);
            if (!areArgumentsValid) return;

            UserProfile userprofile;
            var canAccessToCourse = validateAccessToCourseScheduleManagement(body.UserProfileId, body.ClassRoomId, out userprofile);
            if (!canAccessToCourse) return;

            var masterClassCalendar = _classCalendarRepo.GetClassCalendarByClassRoomId(body.ClassRoomId);
            var isMasterClassCalendarValid = masterClassCalendar != null && !masterClassCalendar.DeletedDate.HasValue;
            if (!isMasterClassCalendarValid) return;

            var reqChangeCourseScheduleClassRoomIds = userprofile.Subscriptions
                .Where(it => it.ClassRoomId != body.ClassRoomId)
                .Where(it => !it.DeletedDate.HasValue)
                .Where(it => it.Role == UserProfile.AccountRole.Teacher)
                .Select(it => it.ClassRoomId);
            if (!reqChangeCourseScheduleClassRoomIds.Any()) return;

            var reqApplyScheduleClassCalendars = _classCalendarRepo.GetClassCalendarByClassRoomId(reqChangeCourseScheduleClassRoomIds)
                .Where(it => it != null)
                .Where(it => !it.CloseDate.HasValue)
                .Where(it => !it.DeletedDate.HasValue)
                .ToList();

            reqApplyScheduleClassCalendars.ForEach(it =>
            {
                it.BeginDate = masterClassCalendar.BeginDate;
                it.ShiftDays = masterClassCalendar.ShiftDays;
                it.Holidays = masterClassCalendar.Holidays;
                it.CalculateCourseSchedule();
            });

            reqApplyScheduleClassCalendars.ForEach(it => _classCalendarRepo.UpsertClassCalendar(it));
        }
コード例 #2
0
 public void ApplyToAllCourse(ApplyToAllCourseRequest body)
 {
     // TODO: Not implemented 
     throw new NotImplementedException();
 }