internal static bool UpdateEmailAddressProperty(ICorePropertyBag propertyBag, EmailAddressProperties emailAddressProperty) { if (!propertyBag.IsPropertyDirty(emailAddressProperty.OriginalDisplayName) || propertyBag.IsPropertyDirty(emailAddressProperty.Address)) { return(false); } string valueOrDefault = propertyBag.GetValueOrDefault <string>(emailAddressProperty.RoutingType, null); if (!"SMTP".Equals(valueOrDefault, StringComparison.OrdinalIgnoreCase)) { return(false); } string valueOrDefault2 = propertyBag.GetValueOrDefault <string>(emailAddressProperty.OriginalDisplayName, null); if (string.IsNullOrEmpty(valueOrDefault2)) { return(false); } string valueOrDefault3 = propertyBag.GetValueOrDefault <string>(emailAddressProperty.Address, null); if (string.IsNullOrEmpty(valueOrDefault3)) { propertyBag[emailAddressProperty.Address] = valueOrDefault2; return(true); } return(false); }
protected override bool WriteEnforceRule(ICorePropertyBag propertyBag) { bool flag = false; object obj = null; foreach (PropertyDefinition propertyDefinition in base.ReadProperties) { if (propertyBag.IsPropertyDirty(propertyDefinition)) { flag = true; obj = propertyBag.TryGetProperty(propertyDefinition); if (!PropertyError.IsPropertyNotFound(obj)) { break; } } } if (flag) { foreach (PropertyDefinition property in base.WriteProperties) { propertyBag.SetOrDeleteProperty(property, obj); } } return(flag); }
private static bool UpdatePartnerNetworkIdAndUserId(ICorePropertyBag propertyBag, byte[] oscContactSources, OscNetworkProperties networkProperties) { if (propertyBag.IsPropertyDirty(ContactSchema.PartnerNetworkId) || propertyBag.IsPropertyDirty(ContactSchema.PartnerNetworkUserId)) { return(false); } if (oscContactSources == null) { propertyBag.Delete(ContactSchema.PartnerNetworkId); propertyBag.Delete(ContactSchema.PartnerNetworkUserId); return(true); } if (networkProperties != null) { propertyBag[ContactSchema.PartnerNetworkId] = networkProperties.NetworkId; propertyBag[ContactSchema.PartnerNetworkUserId] = networkProperties.NetworkUserId; return(true); } return(false); }
protected override bool WriteEnforceRule(ICorePropertyBag propertyBag) { bool result = false; if (propertyBag.IsPropertyDirty(this.primary)) { propertyBag.SetOrDeleteProperty(this.secondary, propertyBag.TryGetProperty(this.primary)); result = true; } return(result); }
private static bool CopyCloudIdFromOscContactSourcesIfCurrentCloudIdIsBlank(ICorePropertyBag propertyBag, OscNetworkProperties networkProperties) { if (propertyBag.IsPropertyDirty(ItemSchema.CloudId)) { return(false); } if (!string.IsNullOrEmpty(propertyBag.GetValueOrDefault <string>(ItemSchema.CloudId))) { return(false); } if (networkProperties != null && !string.IsNullOrEmpty(networkProperties.NetworkUserId)) { propertyBag[ItemSchema.CloudId] = networkProperties.NetworkUserId; return(true); } return(false); }
protected sealed override bool WriteEnforceRule(ICorePropertyBag propertyBag) { bool result = false; bool isPropertyDirty = propertyBag.IsPropertyDirty(this.propertyToSet); object propertyValue = propertyBag.TryGetProperty(this.propertyToSet); if (this.ShouldEnforce(isPropertyDirty, propertyValue)) { TSet valueOrDefault = propertyBag.GetValueOrDefault <TSet>(this.propertyToSet); TDepend valueOrDefault2 = propertyBag.GetValueOrDefault <TDepend>(this.propertyToDepend); TSet tset; if (this.CalculateValue(valueOrDefault2, valueOrDefault, out tset) && (PropertyError.IsPropertyNotFound(propertyValue) || !object.Equals(tset, valueOrDefault))) { propertyBag.SetOrDeleteProperty(this.propertyToSet, tset); result = true; } } return(result); }
public virtual bool UpdateDisplayNameProperties(ICorePropertyBag propertyBag) { bool flag = false; foreach (NativeStorePropertyDefinition propertyDefinition in this.allSourceProperties) { if (propertyBag.IsPropertyDirty(propertyDefinition)) { flag = true; break; } } if (!flag) { return(false); } bool flag2 = false; for (int i = 0; i < this.candidateProperties.Count; i++) { PriorityBasedDisplayNamePropertyRule.CandidateProperty candidateProperty = this.candidateProperties[i]; if (candidateProperty.HasNonEmptyValue(propertyBag)) { string value = null; string value2 = null; candidateProperty.GetValue(propertyBag, out value, out value2); propertyBag.SetProperty(InternalSchema.DisplayNameFirstLast, value); propertyBag.SetProperty(InternalSchema.DisplayNameLastFirst, value2); propertyBag.SetProperty(InternalSchema.DisplayNamePriority, i); flag2 = true; break; } } if (!flag2) { propertyBag.Delete(InternalSchema.DisplayNameFirstLast); propertyBag.Delete(InternalSchema.DisplayNameLastFirst); propertyBag.Delete(InternalSchema.DisplayNamePriority); } return(true); }
public bool UpdatePartnerNetworkProperties(ICorePropertyBag propertyBag) { if (!propertyBag.IsPropertyDirty(ContactSchema.OscContactSourcesForContact)) { return(false); } byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(ContactSchema.OscContactSourcesForContact, null); if (valueOrDefault == null || valueOrDefault.Length == 0) { return(OscContactSourcesForContactUpdateRule.UpdateDependentProperties(propertyBag, null, null)); } try { return(OscContactSourcesForContactUpdateRule.UpdateDependentProperties(propertyBag, valueOrDefault, this.oscParser.ReadOscContactSource(valueOrDefault))); } catch (OscContactSourcesForContactParseException arg) { OscContactSourcesForContactUpdateRule.Tracer.TraceError <OscContactSourcesForContactParseException>((long)this.GetHashCode(), "Encountered exception when parsing: {0}", arg); } return(false); }