// Token: 0x0600079A RID: 1946 RVA: 0x00039FA8 File Offset: 0x000381A8 public static bool BuildSendConfirmDialogPrompt(CalendarItemBase calendarItemBase, out string prompt) { if (calendarItemBase == null) { throw new ArgumentNullException("calendarItemBase"); } prompt = null; StringBuilder stringBuilder = null; ExDateTime localTime = DateTimeUtilities.GetLocalTime(); if (calendarItemBase.CalendarItemType == CalendarItemType.RecurringMaster) { CalendarItem calendarItem = calendarItemBase as CalendarItem; if (!(calendarItem.Recurrence.Range is NoEndRecurrenceRange)) { OccurrenceInfo lastOccurrence = calendarItem.Recurrence.GetLastOccurrence(); if (lastOccurrence != null && lastOccurrence.EndTime < localTime) { if (stringBuilder == null) { stringBuilder = new StringBuilder(); } stringBuilder.Append("\n\t"); stringBuilder.Append(LocalizedStrings.GetNonEncoded(2056979915)); } } } else if (calendarItemBase.EndTime < localTime) { if (stringBuilder == null) { stringBuilder = new StringBuilder(); } stringBuilder.Append("\n\t"); stringBuilder.Append(LocalizedStrings.GetNonEncoded(839442440)); } if (string.IsNullOrEmpty(calendarItemBase.Subject)) { if (stringBuilder == null) { stringBuilder = new StringBuilder(); } stringBuilder.Append("\n\t"); stringBuilder.Append(LocalizedStrings.GetNonEncoded(-25858033)); } if (string.IsNullOrEmpty(calendarItemBase.Location)) { if (stringBuilder == null) { stringBuilder = new StringBuilder(); } stringBuilder.Append("\n\t"); stringBuilder.Append(LocalizedStrings.GetNonEncoded(-1681723506)); } if (stringBuilder != null) { stringBuilder.Insert(0, "\n"); stringBuilder.Insert(0, LocalizedStrings.GetNonEncoded(1040416023)); stringBuilder.Append("\n\n"); stringBuilder.Append(LocalizedStrings.GetNonEncoded(105464887)); prompt = stringBuilder.ToString(); return(true); } return(false); }
public static ExDateTime GetLocalTime() { return(DateTimeUtilities.GetLocalTime(OwaContext.Current.SessionContext)); }
public static bool IsToday(ExDateTime date) { ExDateTime localTime = DateTimeUtilities.GetLocalTime(); return(date.Year == localTime.Year && date.Month == localTime.Month && date.Day == localTime.Day); }
internal void HandlePendingGetTimerCallback(bool clearSearchFolderDeleteList) { string mailboxQuotaHtml = null; bool flag = false; bool flag2 = false; bool flag3 = false; try { this.userContext.Lock(); OwaMapiNotificationHandler.UpdateMailboxSessionBeforeAccessing(this.mailboxSession, this.userContext); lock (this) { if (this.isDisposed) { return; } flag3 = this.InitSubscriptions(ClientSubscriptionFlags.None); if (this.missedNotifications) { flag3 = true; } if (clearSearchFolderDeleteList) { this.ClearSearchFolderDeleteList(); } if (this.searchFolderIdCurrent == null) { this.ResetSearchFolderReferences(true); } this.missedNotifications = false; } long num = Globals.ApplicationTime - this.userContext.LastQuotaUpdateTime; if ((this.userContext.IsQuotaAboveWarning && num >= 900000L) || num >= 1800000L) { using (StringWriter stringWriter = new StringWriter()) { RenderingUtilities.RenderMailboxQuota(stringWriter, this.userContext); mailboxQuotaHtml = stringWriter.ToString(); } flag = true; } int num2 = (int)DateTimeUtilities.GetLocalTime(this.userContext).Bias.TotalMinutes; if (num2 != this.userContext.RemindersTimeZoneOffset) { this.userContext.RemindersTimeZoneOffset = num2; flag2 = true; } if (this.userContext.LockedByCurrentThread()) { Utilities.DisconnectStoreSession(this.mailboxSession); this.userContext.Unlock(); } if (flag3) { this.emailPayload.AddRefreshPayload(); } else { if (flag) { this.emailPayload.AddQuotaPayload(mailboxQuotaHtml); } if (flag2) { this.emailPayload.AddReminderNotifyPayload(num2); } } this.emailPayload.PickupData(); } catch (OwaLockTimeoutException ex) { ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "User context lock timed out in the pending GET timer callback. Exception: {0}", ex.Message); } catch (Exception ex2) { ExTraceGlobals.CoreCallTracer.TraceDebug <string>((long)this.GetHashCode(), "Unexpected exception in pending GET timer callback thread. Exception: {0}", ex2.Message); } finally { if (this.userContext.LockedByCurrentThread()) { Utilities.DisconnectStoreSessionSafe(this.mailboxSession); this.userContext.Unlock(); } } }
protected object ConvertToStrongType(Type paramType, string value) { if (string.IsNullOrEmpty(value)) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } try { if (paramType.IsEnum) { OwaEventEnumAttribute owaEventEnumAttribute = OwaEventRegistry.FindEnumInfo(paramType); int intValue = int.Parse(value, CultureInfo.InvariantCulture); object obj = owaEventEnumAttribute.FindValueInfo(intValue); if (obj == null) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse enum type. Type = {0}, Value = {1}", new object[] { paramType, value })); } return(obj); } if (paramType == typeof(int)) { return(int.Parse(value, CultureInfo.InvariantCulture)); } if (paramType == typeof(double)) { return(double.Parse(value, CultureInfo.InvariantCulture)); } if (paramType == typeof(ExDateTime)) { return(DateTimeUtilities.ParseIsoDate(value, this.EventHandler.OwaContext.SessionContext.TimeZone)); } if (paramType == typeof(bool)) { if (string.Equals(value, "0", StringComparison.Ordinal)) { return(false); } if (string.Equals(value, "1", StringComparison.Ordinal)) { return(true); } this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } else { if (paramType == typeof(StoreObjectId)) { UserContext userContext = this.EventHandler.OwaContext.UserContext; return(Utilities.CreateStoreObjectId(userContext.MailboxSession, value)); } if (paramType == typeof(ADObjectId)) { ADObjectId adobjectId = DirectoryAssistance.ParseADObjectId(value); if (adobjectId == null) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } return(adobjectId); } if (paramType == typeof(DocumentLibraryObjectId)) { UserContext userContext2 = this.EventHandler.OwaContext.UserContext; Uri uri; if (null == (uri = Utilities.TryParseUri(value))) { return(null); } ClassifyResult[] array = null; OwaWindowsIdentity owaWindowsIdentity = userContext2.LogonIdentity as OwaWindowsIdentity; if (owaWindowsIdentity != null && owaWindowsIdentity.WindowsPrincipal != null) { array = LinkClassifier.ClassifyLinks(owaWindowsIdentity.WindowsPrincipal, new Uri[] { uri }); } if (array == null || array.Length == 0) { return(null); } return(array[0].ObjectId); } else if (paramType == typeof(OwaStoreObjectId)) { UserContext userContext3 = this.EventHandler.OwaContext.UserContext; if (OwaStoreObjectId.IsDummyArchiveFolder(value)) { return(userContext3.GetArchiveRootFolderId()); } return(OwaStoreObjectId.CreateFromString(value)); } else { this.ThrowParserException("Internal error: unknown type"); } } } catch (FormatException) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } catch (OwaParsingErrorException) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Failed to parse type. Type = {0}, Value = {1}", new object[] { paramType, value })); } catch (OverflowException) { this.ThrowParserException(string.Format(CultureInfo.InvariantCulture, "Type overflow. Type = {0}, Value = {1}", new object[] { paramType, value })); } return(null); }
internal static void ParseProxyLanguagePostBody(Stream bodyStream, out CultureInfo culture, out string timeZoneKeyName, out bool isOptimized, out string destination, out SerializedClientSecurityContext serializedContext) { ExTraceGlobals.ProxyCallTracer.TraceDebug(0L, "ProxyLanguagePostRequest.ParseProxyLanguagePostBody"); culture = null; timeZoneKeyName = string.Empty; isOptimized = false; destination = string.Empty; serializedContext = null; XmlTextReader xmlTextReader = null; try { xmlTextReader = SafeXmlFactory.CreateSafeXmlTextReader(bodyStream); xmlTextReader.WhitespaceHandling = WhitespaceHandling.All; if (!xmlTextReader.Read() || XmlNodeType.Element != xmlTextReader.NodeType || StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.rootElementName) != 0) { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Missing or invalid root node"); } if (xmlTextReader.MoveToFirstAttribute()) { do { if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.timeZoneKeyNameAttributeName) == 0) { if (DateTimeUtilities.IsValidTimeZoneKeyName(xmlTextReader.Value)) { timeZoneKeyName = xmlTextReader.Value; ExTraceGlobals.ProxyDataTracer.TraceDebug <string>(0L, "Found timeZoneKeyName={0}", timeZoneKeyName); } else { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Invalid time zone id"); } } else if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.localeIdAttributeName) == 0) { int num = -1; if (int.TryParse(xmlTextReader.Value, out num) && Culture.IsSupportedCulture(num)) { culture = Culture.GetCultureInfoInstance(num); ExTraceGlobals.ProxyDataTracer.TraceDebug <int>(0L, "Found localeId={0}", num); } else { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Invalid locale id"); } } else if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.isOptimizedAttributeName) == 0) { int num2 = -1; if (int.TryParse(xmlTextReader.Value, out num2)) { isOptimized = (num2 == 1); ExTraceGlobals.ProxyDataTracer.TraceDebug <bool>(0L, "Found isOptimized={0}", isOptimized); } else { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Invalid is-optimized value"); } } else if (StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.destinationAttributeName) == 0) { destination = xmlTextReader.Value; } else { ExTraceGlobals.ProxyTracer.TraceDebug(0L, "ProxyLanguagePostRequest.ParseProxyLanguagePostBody - Found invalid attribute, ignoring it."); } }while (xmlTextReader.MoveToNextAttribute()); } ExTraceGlobals.ProxyTracer.TraceDebug(0L, "Deserializing client context..."); serializedContext = SerializedClientSecurityContext.Deserialize(xmlTextReader); if (!xmlTextReader.Read() || XmlNodeType.EndElement != xmlTextReader.NodeType || StringComparer.OrdinalIgnoreCase.Compare(xmlTextReader.Name, ProxyLanguagePostRequest.rootElementName) != 0) { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, "Missing or invalid root node"); } } catch (XmlException ex) { ProxyLanguagePostRequest.ThrowParserException(xmlTextReader, string.Format("Parser threw an XML exception: {0}", ex.Message)); } finally { xmlTextReader.Close(); } }