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: 0x06001970 RID: 6512 RVA: 0x0009491C File Offset: 0x00092B1C
        internal bool CommitChanges(MailboxSession mailboxSession)
        {
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.Create(this.timeZone, this.workDays, this.workDayStartTimeInWorkingHoursTimeZone, this.workDayEndTimeInWorkingHoursTimeZone);

            try
            {
                StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar);
                storageWorkingHours.SaveTo(mailboxSession, defaultFolderId);
            }
            catch (WorkingHoursSaveFailedException)
            {
                return(false);
            }
            return(true);
        }