Example #1
0
        private async void SetSpeakerAndSessions(Speaker speaker)
        {
            Speaker = speaker;

            Timeslots.Clear();
            foreach (var speakerTimeslot in await _timeslots.AllBySpeakerAsync(speaker))
            {
                Timeslots.Add(speakerTimeslot);
            }
        }
        private async void ActivateAsync()
        {
            if (Timeslots.Any())
            {
                return;
            }

            var allTimeslots     = (await _timeslots.AllAsync()).ToList();
            var groupedTimeslots = from timeslot in allTimeslots
                                   orderby timeslot.Start
                                   group timeslot by timeslot.TimeDisplayShort
                                   into timeslotGroup
                                   select new Grouping <string, Timeslot>(timeslotGroup.Key, timeslotGroup);

            foreach (var grouping in groupedTimeslots)
            {
                Timeslots.Add(grouping);
            }
        }
Example #3
0
        public void CreateTimeslot(Timeslot timeslot, Calendar calendar)
        {
            bool teacherOccupied = false;

            foreach (var ts in   Timeslots)
            {
                bool teacherOccupiedTimeslot = (timeslot.TimeslotStartDateTime <= ts.TimeslotEndDateTime) && (timeslot.TimeslotEndDateTime >= ts.TimeslotStartDateTime);
                if (teacherOccupiedTimeslot == true)
                {
                    teacherOccupied = true;
                    break;
                }
            }
            if (!teacherOccupied == true)
            {
                calendar.Timeslots.Add(timeslot);
                Timeslots.Add(timeslot);
            }
        }