Ejemplo n.º 1
0
        protected override void InternalSave(TObject configObj)
        {
            base.InternalSave(configObj);
            StoreObjectId       defaultFolderId     = base.Session.GetDefaultFolderId(DefaultFolderType.Calendar);
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.LoadFrom(base.Session, defaultFolderId);

            if (storageWorkingHours == null)
            {
                ExTimeZone timeZone = (configObj.WorkingHoursTimeZone != null) ? configObj.WorkingHoursTimeZone.ExTimeZone : ExTimeZone.CurrentTimeZone;
                storageWorkingHours = StorageWorkingHours.Create(timeZone, (int)configObj.WorkDays, (int)configObj.WorkingHoursStartTime.TotalMinutes, (int)configObj.WorkingHoursEndTime.TotalMinutes);
            }
            else
            {
                if (configObj.IsModified(WorkingHoursSchema.WorkingHoursTimeZone))
                {
                    storageWorkingHours.TimeZone = configObj.WorkingHoursTimeZone.ExTimeZone;
                }
                if (configObj.IsModified(WorkingHoursSchema.WorkDays) || configObj.IsModified(WorkingHoursSchema.WorkingHoursStartTime) || configObj.IsModified(WorkingHoursSchema.WorkingHoursEndTime))
                {
                    storageWorkingHours.UpdateWorkingPeriod(configObj.WorkDays, (int)configObj.WorkingHoursStartTime.TotalMinutes, (int)configObj.WorkingHoursEndTime.TotalMinutes);
                }
            }
            try
            {
                storageWorkingHours.SaveTo(base.Session, defaultFolderId);
            }
            catch (ObjectExistedException)
            {
                storageWorkingHours.SaveTo(base.Session, defaultFolderId);
            }
        }
Ejemplo n.º 2
0
        // Token: 0x06001666 RID: 5734 RVA: 0x0007E244 File Offset: 0x0007C444
        private StorageWorkingHours LoadWorkingHours()
        {
            ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "ReminderTimeCalculatorContext.LoadWorkingHours");
            StorageWorkingHours result = null;

            try
            {
                result = StorageWorkingHours.LoadFrom(this.session as MailboxSession, this.session.GetDefaultFolderId(DefaultFolderType.Calendar));
            }
            catch (AccessDeniedException ex)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "AccessDenied in a call of loading working hours : {0}", ex.Message);
            }
            catch (ArgumentNullException ex2)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "Argument exception in a call of loading working hours : {0}", ex2.Message);
            }
            catch (ObjectNotFoundException ex3)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "ObjectNotFoundException exception in a call of loading working hours : {0}", ex3.Message);
            }
            catch (WorkingHoursXmlMalformedException ex4)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "WorkingHoursXmlMalformedException exception in a call of loading working hours : {0}", ex4.Message);
            }
            catch (CorruptDataException ex5)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "CorruptDataException exception in a call of loading working hours : {0}", ex5.Message);
            }
            return(result);
        }
Ejemplo n.º 3
0
        internal static WorkingHours LoadFrom(MailboxSession session, StoreId folderId)
        {
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.LoadFrom(session, folderId);

            if (storageWorkingHours == null)
            {
                return(null);
            }
            return(new WorkingHours
            {
                storageWorkingHours = storageWorkingHours
            });
        }
Ejemplo n.º 4
0
        protected override void InternalFill(TObject configObject)
        {
            base.InternalFill(configObject);
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.LoadFrom(base.Session, base.Session.GetDefaultFolderId(DefaultFolderType.Calendar));

            if (storageWorkingHours == null)
            {
                return;
            }
            configObject.WorkDays = storageWorkingHours.DaysOfWeek;
            configObject.WorkingHoursStartTime = TimeSpan.FromMinutes((double)storageWorkingHours.StartTimeInMinutes);
            configObject.WorkingHoursEndTime   = TimeSpan.FromMinutes((double)storageWorkingHours.EndTimeInMinutes);
            configObject.WorkingHoursTimeZone  = new ExTimeZoneValue(storageWorkingHours.TimeZone);
        }
Ejemplo n.º 5
0
 // Token: 0x06000A65 RID: 2661 RVA: 0x00044620 File Offset: 0x00042820
 internal static bool TryLoadWorkingHours(MailboxSession session, out StorageWorkingHours workingHours)
 {
     workingHours = null;
     try
     {
         StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Calendar);
         if (defaultFolderId != null)
         {
             workingHours = StorageWorkingHours.LoadFrom(session, defaultFolderId);
         }
         else
         {
             Utils.Tracer.TraceError <string>((long)typeof(MailboxData).GetHashCode(), "User {0}'s working hours data could not be retrieved - folderId is null", session.MailboxOwnerLegacyDN);
         }
     }
     catch (CorruptDataException)
     {
         Utils.Tracer.TraceError <string>((long)typeof(MailboxData).GetHashCode(), "User {0}'s working hours data is corrupted", session.MailboxOwnerLegacyDN);
         workingHours = StorageWorkingHours.Create(((ExTimeZoneValue)WorkingHoursSchema.WorkingHoursTimeZone.DefaultValue).ExTimeZone, (int)WorkingHoursSchema.WorkDays.DefaultValue, (int)((TimeSpan)WorkingHoursSchema.WorkingHoursStartTime.DefaultValue).TotalMinutes, (int)((TimeSpan)WorkingHoursSchema.WorkingHoursEndTime.DefaultValue).TotalMinutes);
     }
     return(workingHours != null);
 }
Ejemplo n.º 6
0
        // Token: 0x06001963 RID: 6499 RVA: 0x00094764 File Offset: 0x00092964
        private static WorkingHours.LoadResult LoadFromMailbox(MailboxSession mailboxSession, out WorkingHours workingHours)
        {
            StorageWorkingHours storageWorkingHours = null;

            try
            {
                storageWorkingHours = StorageWorkingHours.LoadFrom(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar));
            }
            catch (AccessDeniedException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.AccessDenied);
            }
            catch (ArgumentNullException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.AccessDenied);
            }
            catch (ObjectNotFoundException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.AccessDenied);
            }
            catch (WorkingHoursXmlMalformedException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.Corrupt);
            }
            if (storageWorkingHours == null)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.Missing);
            }
            workingHours = new WorkingHours(storageWorkingHours.StartTimeInMinutes, storageWorkingHours.EndTimeInMinutes, (int)storageWorkingHours.DaysOfWeek, storageWorkingHours.TimeZone);
            return(WorkingHours.LoadResult.Success);
        }