public ExDateTime GetNextScheduledTime() { if (this.Mode == ScheduleMode.Never) { return(Schedule.MaximumValidDateTime); } if (this.Mode == ScheduleMode.Always) { return(ExDateTime.Now); } ExDateTime now = ExDateTime.Now; TimeSpan value = TimeSpan.MaxValue; foreach (ScheduleInterval scheduleInterval in this.Intervals) { ExDateTime exDateTime = new ExDateTime(ExTimeZone.CurrentTimeZone, now.Year, now.Month, now.Day, scheduleInterval.StartHour, scheduleInterval.StartMinute, 0); int num = scheduleInterval.StartDay - now.DayOfWeek; if (num < 0 || (num == 0 && scheduleInterval.StartHour < now.Hour) || (num == 0 && scheduleInterval.StartHour == now.Hour && scheduleInterval.StartMinute <= now.Minute)) { num += 7; } exDateTime = exDateTime.AddDays((double)num); TimeSpan timeSpan = exDateTime.Subtract(now); if (timeSpan.Ticks < value.Ticks) { value = timeSpan; } } return(now.Add(value)); }
private void GetStartEndDateForReportingPeriod(ReportingPeriod reportingPeriod, out ExDateTime startDateTime, out ExDateTime endDateTime) { startDateTime = ExDateTime.MinValue; endDateTime = ExDateTime.MaxValue; ExDateTime date = ExDateTime.UtcNow.Date; switch (reportingPeriod) { case ReportingPeriod.Today: startDateTime = date; endDateTime = startDateTime.Add(TimeSpan.FromDays(1.0)).Subtract(TimeSpan.FromMinutes(1.0)); return; case ReportingPeriod.Yesterday: startDateTime = date.Subtract(TimeSpan.FromDays(1.0)); endDateTime = startDateTime.AddDays(1.0).Subtract(TimeSpan.FromMinutes(1.0)); return; case ReportingPeriod.LastWeek: startDateTime = date.Subtract(TimeSpan.FromDays((double)(7 + date.DayOfWeek))); endDateTime = date.Subtract(TimeSpan.FromDays((double)date.DayOfWeek)).Subtract(TimeSpan.FromMinutes(1.0)); return; case ReportingPeriod.LastMonth: startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 1); endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date); return; case ReportingPeriod.Last3Months: startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 3); endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date); return; case ReportingPeriod.Last6Months: startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 6); endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date); return; case ReportingPeriod.Last12Months: startDateTime = GetAvailabilityReport <TIdentity> .SubtractMonths(date, 12); endDateTime = GetAvailabilityReport <TIdentity> .GetLastMonthLastDate(date); return; default: base.WriteError(new ArgumentException(Strings.InvalidReportingPeriod), (ErrorCategory)1000, null); return; } }
// Token: 0x060001CA RID: 458 RVA: 0x000111AC File Offset: 0x0000F3AC private static CalendarItemData CreateCalendarItemDataFromRequest(HttpRequest request, UserContext userContext) { CalendarItemData calendarItemData = new CalendarItemData(); string formParameter = Utilities.GetFormParameter(request, "hidid"); string formParameter2 = Utilities.GetFormParameter(request, "hidfid"); try { if (!string.IsNullOrEmpty(formParameter)) { calendarItemData.Id = StoreObjectId.Deserialize(formParameter); } else { calendarItemData.Id = null; } if (!string.IsNullOrEmpty(formParameter2)) { calendarItemData.FolderId = StoreObjectId.Deserialize(formParameter2); } else { calendarItemData.FolderId = null; } } catch (ArgumentException) { throw new OwaInvalidRequestException("Invalid store object id"); } catch (FormatException) { throw new OwaInvalidRequestException("Invalid store object id"); } ExDateTime startDate = CalendarUtilities.ParseDateTimeFromForm(request, "selSY", "selSM", "selSD", null, userContext); TimeSpan value = CalendarUtilities.ParseTimeFromForm(request, "sttm"); int intValueFromForm = RequestParser.GetIntValueFromForm(request, "drtn"); calendarItemData.StartTime = startDate.Add(value); calendarItemData.EndTime = calendarItemData.StartTime.AddMinutes((double)intValueFromForm); if (calendarItemData.EndTime < calendarItemData.StartTime) { calendarItemData.EndTime = calendarItemData.StartTime.AddHours(1.0); } calendarItemData.Subject = Utilities.GetFormParameter(request, "hidsubj", false); calendarItemData.Location = Utilities.GetFormParameter(request, "hidloc", false); calendarItemData.Recurrence = EditRecurrencePreFormAction.CreateRecurrenceFromRequest(request, startDate, userContext); if (calendarItemData.Recurrence != null) { calendarItemData.IsAllDayEvent = Utilities.IsAllDayEvent(calendarItemData.StartTime, calendarItemData.EndTime); } return(calendarItemData); }
public static void GetStartEndDateForReportingPeriod(ReportingPeriod reportingPeriod, out ExDateTime startDateTime, out ExDateTime endDateTime) { ExDateTime date = ExDateTime.UtcNow.Date; switch (reportingPeriod) { case ReportingPeriod.Today: startDateTime = date; endDateTime = startDateTime.Add(TimeSpan.FromDays(1.0)).Subtract(TimeSpan.FromSeconds(1.0)); return; case ReportingPeriod.Yesterday: startDateTime = date.Subtract(TimeSpan.FromDays(1.0)); endDateTime = startDateTime.AddDays(1.0).Subtract(TimeSpan.FromSeconds(1.0)); return; case ReportingPeriod.LastWeek: startDateTime = date.Subtract(TimeSpan.FromDays((double)(7 + date.DayOfWeek))); endDateTime = date.Subtract(TimeSpan.FromDays((double)date.DayOfWeek)).Subtract(TimeSpan.FromSeconds(1.0)); return; case ReportingPeriod.LastMonth: startDateTime = Utils.SubtractMonths(date, 1); endDateTime = Utils.GetLastMonthLastDate(date); return; case ReportingPeriod.Last3Months: startDateTime = Utils.SubtractMonths(date, 3); endDateTime = Utils.GetLastMonthLastDate(date); return; case ReportingPeriod.Last6Months: startDateTime = Utils.SubtractMonths(date, 6); endDateTime = Utils.GetLastMonthLastDate(date); return; case ReportingPeriod.Last12Months: startDateTime = Utils.SubtractMonths(date, 12); endDateTime = Utils.GetLastMonthLastDate(date); return; default: throw new ArgumentException(Strings.InvalidReportingPeriod); } }
private void MatchCrossPremiseMessages(MapiFolder responseFolder, MapiFolder probeFolder, SmtpAddress source, List <SmtpAddress> targets) { using (MapiTable contentsTable = responseFolder.GetContentsTable()) { using (MapiTable contentsTable2 = probeFolder.GetContentsTable()) { contentsTable.SetColumns(new PropTag[] { PropTag.EntryId, PropTag.Subject, PropTag.ClientSubmitTime }); contentsTable2.SetColumns(new PropTag[] { PropTag.EntryId, PropTag.Subject, PropTag.ClientSubmitTime }); PropValue[][] array = contentsTable.QueryRows(1000, QueryRowsFlags.None); PropValue[][] array2 = contentsTable2.QueryRows(1000, QueryRowsFlags.None); List <byte[]> list = new List <byte[]>(); List <byte[]> list2 = new List <byte[]>(); Dictionary <SmtpAddress, CrossPremiseTestMailFlowHelper.HealthData> dictionary = new Dictionary <SmtpAddress, CrossPremiseTestMailFlowHelper.HealthData>(targets.Count); for (int i = 0; i <= array2.GetUpperBound(0); i++) { if (TestMailFlowHelper.IsValidPropData(array2, i, 3)) { string text = (string)array2[i][1].Value; if (text.StartsWith("CrossPremiseMailFlowMonitoring-", StringComparison.OrdinalIgnoreCase)) { byte[] bytes = array2[i][0].GetBytes(); using (MapiMessage mapiMessage = (MapiMessage)probeFolder.OpenEntry(bytes)) { SmtpAddress key = SmtpAddress.Parse((string)mapiMessage.GetProp(PropTag.ReceivedByEmailAddress).Value); if (!dictionary.ContainsKey(key)) { dictionary.Add(key, new CrossPremiseTestMailFlowHelper.HealthData(EnhancedTimeSpan.Zero, EnhancedTimeSpan.Zero, 0, 0, 0, 0)); } ExDateTime exDateTime = (ExDateTime)array2[i][2].GetDateTime(); if (exDateTime.Add(base.Task.CrossPremisesExpirationTimeout) < ExDateTime.UtcNow) { dictionary[key].ExpiredNumber++; list.Add(bytes); } else { for (int j = 0; j <= array.GetUpperBound(0); j++) { if (TestMailFlowHelper.IsValidPropData(array, j, 3)) { string text2 = (string)array[j][1].Value; if (text2.EndsWith(text, StringComparison.OrdinalIgnoreCase)) { byte[] bytes2 = array[j][0].GetBytes(); if (((ExDateTime)array[j][2].GetDateTime()).Add(base.Task.CrossPremisesExpirationTimeout) < ExDateTime.UtcNow) { list2.Add(bytes2); } else { using (MapiMessage mapiMessage2 = (MapiMessage)responseFolder.OpenEntry(bytes2)) { EnhancedTimeSpan t; EnhancedTimeSpan t2; if (this.ProcessCrossPremiseMessagePair(mapiMessage, mapiMessage2, source.ToString(), key.ToString(), out t, out t2)) { dictionary[key].ProbeLatency += t; dictionary[key].ResponseLatency += t2; dictionary[key].SuccessNumber++; } else { dictionary[key].FailedNumber++; } } list2.Add(bytes2); list.Add(bytes); } } } } if (!list.Contains(bytes) && exDateTime.AddMinutes(10.0) < ExDateTime.UtcNow) { dictionary[key].PendingNumber++; } } } } } } this.SaveHealthData(source, dictionary); if (list2.Count > 0) { responseFolder.DeleteMessages(DeleteMessagesFlags.ForceHardDelete, list2.ToArray()); } if (list.Count > 0) { probeFolder.DeleteMessages(DeleteMessagesFlags.ForceHardDelete, list.ToArray()); } } } }
protected override void ProcessMailbox() { try { ExDateTime exDateTime = this.Date.ToUtc(); ExDateTime startDateTime = new ExDateTime(ExTimeZone.UtcTimeZone, exDateTime.Year, exDateTime.Month, exDateTime.Day); ExDateTime endDateTime = startDateTime.AddDays(1.0); StreamWriter streamWriter = new StreamWriter(this.ClientStream, Encoding.UTF8); streamWriter.WriteCsvLine(this.csvRow.Keys); using (IUMCallDataRecordStorage umcallDataRecordsAcessor = InterServerMailboxAccessor.GetUMCallDataRecordsAcessor(this.DataObject)) { int num = 0; int numberOfRecordsToRead = 5000; if (Utils.RunningInTestMode) { numberOfRecordsToRead = 1; } bool flag; do { flag = false; CDRData[] umcallDataRecords = umcallDataRecordsAcessor.GetUMCallDataRecords(startDateTime.Subtract(this.TimeDelta), endDateTime.Add(this.TimeDelta), num, numberOfRecordsToRead); if (umcallDataRecords != null && umcallDataRecords.Length > 0) { num += umcallDataRecords.Length; this.WriteToStream(umcallDataRecords, streamWriter, startDateTime, endDateTime); flag = true; } streamWriter.Flush(); }while (flag); } } catch (ArgumentException exception) { base.WriteError(exception, ErrorCategory.InvalidArgument, null); } catch (ObjectDisposedException exception2) { base.WriteError(exception2, ErrorCategory.InvalidArgument, null); } catch (IOException exception3) { base.WriteError(exception3, ErrorCategory.WriteError, null); } catch (UnableToFindUMReportDataException exception4) { base.WriteError(exception4, ErrorCategory.ReadError, null); } catch (StorageTransientException exception5) { base.WriteError(exception5, ErrorCategory.ReadError, null); } catch (StoragePermanentException exception6) { base.WriteError(exception6, ErrorCategory.ReadError, null); } catch (HttpException exception7) { base.WriteError(exception7, ErrorCategory.WriteError, null); } catch (CDROperationException exception8) { base.WriteError(exception8, ErrorCategory.ReadError, null); } catch (EWSUMMailboxAccessException exception9) { base.WriteError(exception9, ErrorCategory.ReadError, null); } }
// Token: 0x0600166D RID: 5741 RVA: 0x0007E618 File Offset: 0x0007C818 internal static ExDateRange ConvertReminderTimeHintToExDateRange(ReminderTimeHint hint, ExDateTime referenceTime, ReminderTimeCalculatorContext context) { ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "WorkingHoursAwareReminderTimeCalculator.ConvertReminderTimeHintToExDateRange"); ExTraceGlobals.HeuristicsTracer.TraceInformation <ReminderTimeHint, ExDateTime, DayOfWeek>(0, 0L, "ReminderTimeHint : '{0}'; ReferenceTime : '{1}'; StartOfWeek: '{2}'", hint, referenceTime, context.StartOfWeek); ExDateRange exDateRange; switch (hint) { case ReminderTimeHint.LaterToday: exDateRange = new ExDateRange(referenceTime.Add(WorkingHoursAwareReminderTimeCalculator.RemindLaterMinOffsetTimeSpan).ToUtc(), referenceTime.Add(WorkingHoursAwareReminderTimeCalculator.RemindLaterMinOffsetTimeSpan).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()); goto IL_496; case ReminderTimeHint.Tomorrow: exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()); goto IL_496; case ReminderTimeHint.TomorrowMorning: exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.MorningStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.MorningEndTimeSpan).ToUtc()); goto IL_496; case ReminderTimeHint.TomorrowAfternoon: exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.AfternoonStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.AfternoonEndTimeSpan).ToUtc()); goto IL_496; case ReminderTimeHint.TomorrowEvening: exDateRange = new ExDateRange(referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.EveningStartTimeSpan).ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.EveningEndTimeSpan).ToUtc()); goto IL_496; case ReminderTimeHint.ThisWeekend: { int num = WorkingHoursAwareReminderTimeCalculator.DaysTilNextOccurrence(referenceTime, DayOfWeek.Saturday); if (num == 7) { return(new ExDateRange(referenceTime.ToUtc(), referenceTime.AddDays(1.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc())); } if (num == 6) { return(new ExDateRange(referenceTime.ToUtc(), referenceTime.Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc())); } return(new ExDateRange(referenceTime.AddDays((double)num).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayStartTimeSpan).ToUtc(), referenceTime.AddDays((double)(num + 1)).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc())); } case ReminderTimeHint.NextWeek: { ExDateTime date = referenceTime.AddDays((double)WorkingHoursAwareReminderTimeCalculator.DaysTilNextOccurrence(referenceTime, context.StartOfWeek)).Date; exDateRange = new ExDateRange(date.ToUtc(), date.AddDays(6.0).Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()); goto IL_496; } case ReminderTimeHint.NextMonth: { int num2 = ExDateTime.DaysInMonth(referenceTime.Year, referenceTime.Month) - referenceTime.Day + 1; ExDateTime date2 = referenceTime.AddDays((double)num2).Date; ExDateTime exDateTime = date2.AddDays((double)(ExDateTime.DaysInMonth(date2.Year, date2.Month) - 1)); exDateRange = new ExDateRange(date2.ToUtc(), exDateTime.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()); goto IL_496; } case ReminderTimeHint.Now: exDateRange = new ExDateRange(referenceTime.ToUtc(), referenceTime.ToUtc()); goto IL_496; case ReminderTimeHint.InTwoDays: exDateRange = new ExDateRange(referenceTime.AddDays(2.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayStartTimeSpan).ToUtc(), referenceTime.AddDays(2.0).Date.Add(WorkingHoursAwareReminderTimeCalculator.DayEndTimeSpan).ToUtc()); goto IL_496; } throw new InvalidOperationException("unsupported reminderTimeHint"); IL_496: ExTraceGlobals.HeuristicsTracer.TraceInformation <ExDateTime, ExDateTime>(0, 0L, "Calculated reminder range : '{0}' - '{1}'", exDateRange.Start, exDateRange.End); return(exDateRange); }