Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TimeSlotGroup"/> class.
 /// </summary>
 /// <param name="startTime">The start time.</param>
 /// <param name="duration">The duration.</param>
 /// <param name="timeSlots">The time slots.</param>
 public TimeSlotGroup(
     DateTime startTime,
     TimeSpan duration,
     TimeSlotCollection timeSlots)
     : base(startTime, duration)
 {
     this.timeSlots = timeSlots;
 }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TimeSlotGroup"/> class
        /// adding the given time slots.
        /// </summary>
        /// <param name="timeSlots">The time slots that will be added to the group.</param>
        public TimeSlotGroup(IEnumerable <TimeSlot> timeSlots)
        {
            this.timeSlots = new TimeSlotCollection(timeSlots);
            if (this.timeSlots.Count > 0)
            {
                this.Start = this.timeSlots[0].Start;
                this.End   = this.timeSlots[0].End;

                for (int i = 1; i < this.timeSlots.Count; i++)
                {
                    TimeSlot slot = this.timeSlots[i];

                    if (this.Start > slot.Start)
                    {
                        this.Start = slot.Start;
                    }

                    if (this.End < slot.End)
                    {
                        this.End = slot.End;
                    }
                }
            }
        }