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); } }
private WorkingHours(ExTimeZone timeZone, DaysOfWeek daysOfWeek, int startTimeInMinutes, int endTimeInMinutes) { if (timeZone == null) { throw new ArgumentException("timeZone"); } this.storageWorkingHours = StorageWorkingHours.Create(timeZone, (int)WorkingHours.ToStorageDaysOfWeek(daysOfWeek), startTimeInMinutes, endTimeInMinutes); }
// 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); }
// Token: 0x060009EC RID: 2540 RVA: 0x00041B98 File Offset: 0x0003FD98 internal static TextNotificationSettings ParseTextSettingsItemBody(string body) { TextNotificationSettings result; using (StringReader stringReader = new StringReader(body)) { if (SettingsItemBodyParser.GetNextLine(stringReader) != "V1.2") { SettingsItemBodyParser.Tracer.TraceDebug(0L, "Unknown user settings version, skipped"); throw new FormatException(); } MailboxRegionalConfiguration mailboxRegionalConfiguration = new MailboxRegionalConfiguration(); mailboxRegionalConfiguration.TimeZone = new ExTimeZoneValue(SettingsItemBodyParser.GetNextTimeZone(stringReader)); int nextInteger = SettingsItemBodyParser.GetNextInteger(stringReader); if (nextInteger != 0) { mailboxRegionalConfiguration.Language = new CultureInfo(nextInteger); } mailboxRegionalConfiguration.TimeFormat = SettingsItemBodyParser.GetNextLine(stringReader); mailboxRegionalConfiguration.DateFormat = SettingsItemBodyParser.GetNextLine(stringReader); CalendarNotification calendarNotification = new CalendarNotification(); calendarNotification.MeetingReminderNotification = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.MeetingReminderSendDuringWorkHour = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.NextDays = SettingsItemBodyParser.GetNextInteger(stringReader); calendarNotification.CalendarUpdateNotification = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.CalendarUpdateSendDuringWorkHour = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.DailyAgendaNotification = SettingsItemBodyParser.GetNextBoolean(stringReader); calendarNotification.DailyAgendaNotificationSendTime = TimeSpan.FromSeconds((double)SettingsItemBodyParser.GetNextInteger(stringReader)); E164Number textMessagingPhoneNumber; if (!E164Number.TryParse(SettingsItemBodyParser.GetNextLine(stringReader), out textMessagingPhoneNumber)) { SettingsItemBodyParser.Tracer.TraceDebug(0L, "Invalid phone number, skipped"); throw new FormatException(); } calendarNotification.TextMessagingPhoneNumber = textMessagingPhoneNumber; ExTimeZone nextTimeZone = SettingsItemBodyParser.GetNextTimeZone(stringReader); int nextInteger2 = SettingsItemBodyParser.GetNextInteger(stringReader); int nextInteger3 = SettingsItemBodyParser.GetNextInteger(stringReader); int nextInteger4 = SettingsItemBodyParser.GetNextInteger(stringReader); StorageWorkingHours workingHours = StorageWorkingHours.Create(nextTimeZone, nextInteger2, nextInteger3, nextInteger4); result = new TextNotificationSettings(mailboxRegionalConfiguration, calendarNotification, workingHours); } return(result); }
// 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); }
public WorkingHours() { this.storageWorkingHours = StorageWorkingHours.Create(ExTimeZone.CurrentTimeZone); }