Ejemplo n.º 1
0
        public static void SetOrgUnitSchedules(ObjectContext context, OrgUnitV2 source, OrgUnit orgUnit)
        {
            //ignore null values
            if (source.OrgUnitHours == null)
                return;

            //remove all schedules, will re-add below
            orgUnit.Schedules.ToList().ForEach(context.DeleteObject);

            foreach (var item in source.OrgUnitHours)
            {
                var timeSpan = new ScheduleTimeSpan(ResolveOpenTime(item), ResolveOpenHours(item));
                orgUnit.AddSchedule(timeSpan);
            }
        }