Example #1
0
        public ISession UpdateTimeSlot(ITimeSlot value)
        {
            Session newSession = this.Clone();

            newSession.TimeSlot = value;
            return(newSession);
        }
Example #2
0
 private AliasTimeSlot(string name, IAliasProvider provider)
 {
     if (!Regex.IsMatch(name, "^[a-zA-Z0-9]+$"))
     {
         throw new Exception("Name can only contain letters A-Z or a-z or numbers");
     }
     _nom    = name;
     _behind = provider.Fetch(_nom);
 }
        /// <summary>
        /// Projects a new time slot mapped to lower bound and upper bound.
        /// </summary>
        /// <param name="timeSlot">The time slot.</param>
        /// <param name="lowerBound">The search lower bound.</param>
        /// <param name="upperBound">The search upper bound.</param>
        /// <returns> A new instance of <see cref="ITimeSlot"/> mapped to calendar LB and UB.</returns>
        internal static ITimeSlot TimeSlotMapper(this ITimeSlot timeSlot, DateTime lowerBound, DateTime upperBound)
        {
            var(startTime, endTime) = timeSlot;
            var lb = lowerBound.CalibrateToMinutes();
            var ub = upperBound.CalibrateToMinutes();

            return(new TimeSlot(
                       startTime <= lb && lb < endTime ? lb : startTime,
                       startTime < ub && ub < endTime ? ub : endTime));
        }
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MeetingDetails"/> class.
        /// </summary>
        /// <param name="timeSlot">The <see cref="ITimeSlot"/> for the <see cref="MeetingDetails"/>.</param>
        /// <param name="meetingTitle">The title of the <see cref="MeetingDetails"/>.</param>
        /// <param name="meetingLocation">The location of the <see cref="MeetingDetails"/>.</param>
        /// <param name="meetingAgenda">The agenda of the <see cref="MeetingDetails"/>.</param>
        /// <param name="attendees">A list of <see cref="IAttendee"/>.</param>
        /// <param name="attachmentFilePaths">A list of file paths as attachment files.</param>
        /// <exception cref="ArgumentException">
        /// Thrown when:
        /// The <see cref="MeetingDetails"/> start time is invalid.
        /// The <see cref="MeetingDetails"/> finish time is invalid.
        /// The <see cref="MeetingDetails"/> start time is greater than or equals to start time.
        /// </exception>
        public MeetingDetails(ITimeSlot timeSlot, string meetingTitle, string meetingLocation, string meetingAgenda, IEnumerable <IAttendee> attendees, IList <string> attachmentFilePaths = null)
            : this(timeSlot)
        {
            MeetingTitle        = meetingTitle;
            MeetingAgenda       = meetingAgenda;
            AttachmentFilePaths = attachmentFilePaths;
            MeetingLocation     = meetingLocation;

            _attendees = attendees;
        }
        /// <summary>
        /// Maps a <see cref="TimeSlot"/> of a meeting to Time frame of the calendar.
        /// </summary>
        /// <param name="timeSlot">The Meeting.</param>
        /// <param name="calendarStartTime">The start time of the calendar.</param>
        /// <param name="calendarEndTime">The end time of the calendar.</param>
        /// <returns>A new Time slot mapped to calendar time frame.</returns>
        internal static TimeSlot GetTimeSlotMappedToCalendarTimeFrame(this ITimeSlot timeSlot, DateTime calendarStartTime, DateTime calendarEndTime)
        {
            var(startTime, endTime) = timeSlot;

            //Outside of calendar time frame
            if (endTime <= calendarStartTime || startTime >= calendarEndTime)
            {
                return(null);
            }

            return(new TimeSlot(
                       (startTime >= calendarStartTime) ? startTime : calendarStartTime,
                       (endTime <= calendarEndTime) ? endTime : calendarEndTime));
        }
Example #6
0
        public ISession UpdateTimeSlot(ITimeSlot value)
        {
            SessionModel newSession = this.Clone();

            if (null == value)
            {
                newSession.TimeSlotId = 0;
                newSession.TimeSlot   = null;
            }
            else
            {
                newSession.TimeSlotId = value.Id;
                newSession.TimeSlot   = new TimeSlotModel(value);
            }
            return(newSession);
        }
Example #7
0
        public Rule(
            IMatcher <ISubject> subject,
            bool isSubjectAGroup,
            IMatcher <IObject> @object,
            bool isObjectAGroup,
            ITimeSlot timeSlot,
            bool authorize)
        {
            Subject   = subject;
            Objet     = @object;
            TimeSlot  = timeSlot;
            Authorize = authorize;

            Priority = (ushort)((TimeSlot.IsAbsolute ? 0x1 : 0x0) +
                                (isObjectAGroup ? 0x0 : 0x2) +
                                (isSubjectAGroup ? 0x0 : 0x4) +
                                (authorize ? 0x8 : 0x0));
        }
Example #8
0
 private ComplexTimeSlot(ITimeSlot tree)
 {
     _tree = tree;
 }
Example #9
0
 public static ComplexTimeSlot CreateBut(ITimeSlot a, ITimeSlot b)
 {
     return(new ComplexTimeSlot(new ButTimeSlotRelationship(a, b)));
 }
Example #10
0
 public static ComplexTimeSlot CreateIntersecting(ITimeSlot a, ITimeSlot b)
 {
     return(new ComplexTimeSlot(new IntersectingTimeSlotRelationship(a, b)));
 }
 protected TimeSlotRelationshipAbstract(ITimeSlot a, ITimeSlot b)
 {
     _a = a;
     _b = b;
 }
Example #12
0
 public IntersectingTimeSlotRelationship(ITimeSlot a, ITimeSlot b) : base(a, b)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Calendar"/> class.
 /// </summary>
 /// <param name="timeSlot">The <see cref="ITimeSlot"/> as calendar window.</param>
 /// <param name="attendees">A list of <see cref="Attendee"/> along with their <see cref="MeetingInfo"/>.</param>
 /// <exception cref="ArgumentException">
 /// Thrown when:
 /// The <see cref="Calendar"/> start time is invalid.
 /// The <see cref="Calendar"/> end time is invalid.
 /// The <see cref="Calendar"/> start time is greater than or equals to start time.
 /// </exception>
 public Calendar(ITimeSlot timeSlot, ICollection <IAttendee> attendees)
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MeetingInfo"/> class.
 /// </summary>
 /// <param name="timeSlot">The <see cref="ITimeSlot"/> for the meeting.</param>
 /// <exception cref="ArgumentException">
 /// Thrown when:
 /// The <see cref="MeetingInfo"/> start time is invalid.
 /// The <see cref="MeetingInfo"/> finish time is invalid.
 /// The <see cref="MeetingInfo"/> start time is greater than or equals to start time.
 /// </exception>
 public MeetingInfo(ITimeSlot timeSlot)
     : this(timeSlot.StartTime, timeSlot.EndTime)
 {
 }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MeetingDetails"/> class.
 /// </summary>
 /// <param name="timeSlot">The <see cref="ITimeSlot"/> for the <see cref="MeetingDetails"/>.</param>
 /// <exception cref="ArgumentException">
 /// Thrown when:
 /// The <see cref="MeetingDetails"/> start time is invalid.
 /// The <see cref="MeetingDetails"/> finish time is invalid.
 /// The <see cref="MeetingDetails"/> start time is greater than or equals to start time.
 /// </exception>
 private MeetingDetails(ITimeSlot timeSlot)
     : this(timeSlot.StartTime, timeSlot.EndTime)
 {
 }
Example #16
0
 public OrTimeSlotRelationship(ITimeSlot a, ITimeSlot b) : base(a, b)
 {
 }
 static bool IncludeAllPredicate(ITimeSlot t) => true;
        /// <summary>
        /// Calculates the scheduled meeting durations only within the time frame of Calendar.
        /// </summary>
        /// <param name="timeSlot">The Time Slot.</param>
        /// <param name="seriesStartTime">The start time of time series.</param>
        /// <returns></returns>
        internal static IDictionary <DateTime, AvailabilityTypes> GetTimeSeriesByMinutes(this ITimeSlot timeSlot, DateTime seriesStartTime = default)
        {
            var timeRange = new Dictionary <DateTime, AvailabilityTypes>();

            if (timeSlot == null)
            {
                return(timeRange);
            }

            var temp = (seriesStartTime == default) ? timeSlot.StartTime : seriesStartTime;

            while (temp < timeSlot.EndTime)
            {
                timeRange.Add(temp, AvailabilityTypes.Available);
                temp = temp.AddMinutes(1);
            }

            return(timeRange);
        }
 /// <summary>
 /// Gets the duration of a <see cref="ITimeSlot"/> in minutes.
 /// </summary>
 /// <param name="timeSlot">The time slot.</param>
 /// <returns>The duration.</returns>
 internal static double GetDuration(this ITimeSlot timeSlot)
 => timeSlot.StartTime.Equals(timeSlot.EndTime) ? 0 : timeSlot.EndTime.Subtract(timeSlot.StartTime).TotalMinutes;
Example #20
0
 // Needed for Session
 internal TimeSlot(ITimeSlot timeSlot)
 {
     this.Id        = timeSlot.Id;
     this.StartTime = timeSlot.StartTime;
     this.EndTime   = timeSlot.EndTime;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Calendar"/> class.
 /// </summary>
 /// <param name="timeSlot">The <see cref="ITimeSlot"/> as calendar window.</param>
 /// <exception cref="ArgumentException">
 /// Thrown when:
 /// The <see cref="Calendar"/> start time is invalid.
 /// The <see cref="Calendar"/> end time is invalid.
 /// The <see cref="Calendar"/> start time is greater than or equals to start time.
 /// </exception>
 public Calendar(ITimeSlot timeSlot)
     : this(timeSlot.StartTime, timeSlot.EndTime)
 {
 }