internal static void NotificationPhoneNumberSetter(object value, IPropertyBag propertyBag) { TextMessagingSettingsVersion1Point0 textMessagingSettingsVersion1Point = (TextMessagingSettingsVersion1Point0)propertyBag[TextMessagingAccountSchema.TextMessagingSettings]; if (value == null) { PossibleRecipient.MarkEffective(textMessagingSettingsVersion1Point.MachineToPersonMessagingPolicies.PossibleRecipients, false); return; } bool flag = false; PossibleRecipient writablePossibleRecipient = TextMessagingAccount.GetWritablePossibleRecipient(textMessagingSettingsVersion1Point, out flag); if (flag) { writablePossibleRecipient.PhoneNumber = (E164Number)value; } else { PossibleRecipient mathed = PossibleRecipient.GetMathed(textMessagingSettingsVersion1Point.MachineToPersonMessagingPolicies.PossibleRecipients, (E164Number)value, false); PossibleRecipient.MarkEffective(textMessagingSettingsVersion1Point.MachineToPersonMessagingPolicies.PossibleRecipients, false); if (mathed == null) { textMessagingSettingsVersion1Point.MachineToPersonMessagingPolicies.PossibleRecipients.Add(new PossibleRecipient(true, DateTime.UtcNow, writablePossibleRecipient.Region, writablePossibleRecipient.Carrier, (E164Number)value, false, null, null, null)); } else { mathed.Region = writablePossibleRecipient.Region; mathed.Carrier = writablePossibleRecipient.Carrier; mathed.MarkEffective(true); } } PossibleRecipient.PurgeNonEffectiveBefore(textMessagingSettingsVersion1Point.MachineToPersonMessagingPolicies.PossibleRecipients, DateTime.UtcNow - TimeSpan.FromDays(7.0), 10); }
internal static void CountryRegionIdSetter(object value, IPropertyBag propertyBag) { TextMessagingSettingsVersion1Point0 settings = (TextMessagingSettingsVersion1Point0)propertyBag[TextMessagingAccountSchema.TextMessagingSettings]; string region = (value == null) ? null : ((RegionInfo)value).TwoLetterISORegionName; TextMessagingAccount.GetWritablePossibleRecipient(settings).Region = region; }
internal static void MobileOperatorIdSetter(object value, IPropertyBag propertyBag) { TextMessagingSettingsVersion1Point0 settings = (TextMessagingSettingsVersion1Point0)propertyBag[TextMessagingAccountSchema.TextMessagingSettings]; string carrier = (-1 == (int)value) ? null : ((int)value).ToString("00000"); TextMessagingAccount.GetWritablePossibleRecipient(settings).Carrier = carrier; }
private static PossibleRecipient GetWritablePossibleRecipient(TextMessagingSettingsVersion1Point0 settings) { bool flag = false; return(TextMessagingAccount.GetWritablePossibleRecipient(settings, out flag)); }
protected override IEnumerable <T> InternalFindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize) { if (filter != null && !(filter is FalseFilter)) { throw new NotSupportedException("filter"); } if (rootId != null && rootId is ADObjectId && !ADObjectId.Equals((ADObjectId)rootId, base.MailboxSession.MailboxOwner.ObjectId)) { throw new NotSupportedException("rootId"); } if (!typeof(VersionedXmlConfigurationObject).GetTypeInfo().IsAssignableFrom(typeof(T).GetTypeInfo())) { throw new NotSupportedException("FindPaged: " + typeof(T).FullName); } VersionedXmlConfigurationObject configObject = (VersionedXmlConfigurationObject)((object)((default(T) == null) ? Activator.CreateInstance <T>() : default(T))); configObject[VersionedXmlConfigurationObjectSchema.Identity] = base.MailboxSession.MailboxOwner.ObjectId; VersionedXmlBase configXml = null; using (UserConfiguration mailboxConfiguration = UserConfigurationHelper.GetMailboxConfiguration(base.MailboxSession, configObject.UserConfigurationName, UserConfigurationTypes.XML, false)) { if (mailboxConfiguration != null) { using (Stream xmlStream = mailboxConfiguration.GetXmlStream()) { try { configXml = VersionedXmlBase.Deserialize(xmlStream); } catch (InvalidOperationException ex) { ExTraceGlobals.XsoTracer.TraceDebug <string>((long)this.GetHashCode(), "Deserialize TextMessagingSettings failed: {0}", ex.ToString()); } } } } if (configXml != null) { if (configObject.RawVersionedXmlPropertyDefinition.Type != configXml.GetType()) { throw new NotSupportedException("FindPaged: " + typeof(T).FullName); } configObject[configObject.RawVersionedXmlPropertyDefinition] = configXml; TextMessagingAccount textMessagingAccount = configObject as TextMessagingAccount; if (textMessagingAccount != null) { textMessagingAccount.NotificationPreferredCulture = base.MailboxSession.PreferedCulture; if (textMessagingAccount.CountryRegionId != null) { if (string.Equals(textMessagingAccount.CountryRegionId.TwoLetterISORegionName, "US", StringComparison.OrdinalIgnoreCase)) { textMessagingAccount.NotificationPreferredCulture = new CultureInfo("en-US"); } else if (string.Equals(textMessagingAccount.CountryRegionId.TwoLetterISORegionName, "CA", StringComparison.OrdinalIgnoreCase)) { if (textMessagingAccount.NotificationPreferredCulture != null && string.Equals(textMessagingAccount.NotificationPreferredCulture.TwoLetterISOLanguageName, "fr", StringComparison.OrdinalIgnoreCase)) { textMessagingAccount.NotificationPreferredCulture = new CultureInfo("fr-CA"); } else { textMessagingAccount.NotificationPreferredCulture = new CultureInfo("en-CA"); } } } } ValidationError[] array = configObject.Validate(); if (array != null && 0 < array.Length) { ExTraceGlobals.XsoTracer.TraceDebug <string>((long)this.GetHashCode(), "TextMessagingSettings validation failed: {0}", array[0].ToString()); configObject[configObject.RawVersionedXmlPropertyDefinition] = null; } configObject.ResetChangeTracking(); } yield return((T)((object)configObject)); yield break; }