示例#1
0
        public bool InWorkingHours(ExDateTime startUtc, ExDateTime endUtc)
        {
            DaysOfWeek daysOfWeek;
            int        num;

            this.UtcToWorkTime(startUtc, out daysOfWeek, out num);
            DaysOfWeek daysOfWeek2;
            int        num2;

            this.UtcToWorkTime(endUtc, out daysOfWeek2, out num2);
            if (this.WorkingPeriodArray == null || this.WorkingPeriodArray.Length != 1)
            {
                throw new ArgumentException("WorkingPeriodArray can not be null or have more than one element in Version1.");
            }
            WorkingPeriod workingPeriod = this.WorkingPeriodArray[0];

            if (daysOfWeek == daysOfWeek2 && (daysOfWeek & workingPeriod.DayOfWeek) != (DaysOfWeek)0 && num >= workingPeriod.StartTimeInMinutes && num <= workingPeriod.EndTimeInMinutes && num2 >= workingPeriod.StartTimeInMinutes && num2 <= workingPeriod.EndTimeInMinutes)
            {
                return(true);
            }
            if (daysOfWeek != daysOfWeek2 && workingPeriod.StartTimeInMinutes == 0 && workingPeriod.EndTimeInMinutes >= 1439)
            {
                DaysOfWeek daysOfWeek3 = daysOfWeek;
                while ((daysOfWeek3 & workingPeriod.DayOfWeek) != (DaysOfWeek)0)
                {
                    if (daysOfWeek3 == daysOfWeek2)
                    {
                        return(true);
                    }
                    daysOfWeek3 = WorkingHours.NextDays(daysOfWeek3);
                }
                return(false);
            }
            return(false);
        }
示例#2
0
        internal void SaveTo(MailboxSession session, StoreId folderId)
        {
            if (this.WorkingPeriodArray == null || this.WorkingPeriodArray.Length != 1 || this.WorkingPeriodArray[0] == null)
            {
                throw new ArgumentException("WorkingPeriodArray", "WorkingPeriodArray must have one element");
            }
            WorkingPeriod workingPeriod = this.WorkingPeriodArray[0];

            this.storageWorkingHours.SaveTo(session, folderId);
        }