public static Boolean Exists(Event ev, MetadataId searchId, out String searchKey) { searchKey = null; if (ev.ExtendedProperties == null || ev.ExtendedProperties.Private__ == null) { return(false); } searchKey = metadataIdKeyName(searchId); int maxSet; int?keySet = getKeySet(ev, out maxSet); if (keySet.HasValue && keySet.Value != 0) { searchKey += "-" + keySet.Value.ToString("D2"); } if (searchId == MetadataId.oCalendarId) { return(ev.ExtendedProperties.Private__.ContainsKey(searchKey) && ev.ExtendedProperties.Private__[searchKey] == Sync.Engine.Calendar.Instance.Profile.UseOutlookCalendar.Id); } else { return(ev.ExtendedProperties.Private__.ContainsKey(searchKey) && Get(ev, MetadataId.oCalendarId) == Sync.Engine.Calendar.Instance.Profile.UseOutlookCalendar.Id); } }
public string ToQuery(CompilerOptions opts) { var alias = $"{opts.Alias}I"; var valueNum = new Column("ValueNumber"); var valueDate = new Column("ValueDate"); var sourceMod = new Column("SourceModifier"); var importId = new Column("ImportMetadataId"); var rowId = new Column("Id"); var personId = new ExpressedColumn(opts.FieldPersonId, new Expression($"{alias}.PersonId")); var encId = new ExpressedColumn(opts.FieldEncounterId, new Expression("CONVERT(NVARCHAR(10),NULL)")); var where = new List <IEvaluatable>(); where.Add(importId == MetadataId.ToString()); where.Add(new RawEval($"{alias}.{rowId} LIKE '{UniversalId.BaseSegment}%'")); if (UniversalId.Value.HasValue) { where.Add(valueNum == (int)UniversalId.Value); } if (UniversalId.UseModifier) { where.Add(sourceMod == UniversalId.Modifier); } var query = new NamedSet { Select = new ISelectable[] { personId, encId, valueNum, valueDate }, From = $"{opts.AppDb}.app.Import", Alias = alias, Where = where }; return(query.ToString()); }
/// <summary> /// Returns true if InlineResponseDefault6Value instances are equal /// </summary> /// <param name="other">Instance of InlineResponseDefault6Value to be compared</param> /// <returns>Boolean</returns> public bool Equals(InlineResponseDefault6Value other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( LogicalName == other.LogicalName || LogicalName != null && LogicalName.Equals(other.LogicalName) ) && ( MetadataId == other.MetadataId || MetadataId != null && MetadataId.Equals(other.MetadataId) ) && ( OptionSet == other.OptionSet || OptionSet != null && OptionSet.Equals(other.OptionSet) )); }
public static Boolean Exists(AppointmentItem ai, MetadataId searchId, out String searchKey) { searchKey = metadataIdKeyName(searchId); int maxSet; int?keySet = getKeySet(ai, out maxSet); if (keySet.HasValue && keySet.Value != 0) { searchKey += "-" + keySet.Value.ToString("D2"); } UserProperties ups = null; UserProperty prop = null; try { ups = ai.UserProperties; prop = ups.Find(searchKey); if (searchId == MetadataId.gCalendarId) { return(prop != null && prop.Value.ToString() == Settings.Instance.UseGoogleCalendar.Id); } else { return(prop != null && Get(ai, MetadataId.gCalendarId) == Settings.Instance.UseGoogleCalendar.Id); } } catch { return(false); } finally { prop = (UserProperty)OutlookOgcs.Calendar.ReleaseObject(prop); ups = (UserProperties)OutlookOgcs.Calendar.ReleaseObject(ups); } }
public static String Get(AppointmentItem ai, MetadataId key) { String retVal = null; String searchKey; if (Exists(ai, key, out searchKey)) { UserProperties ups = null; UserProperty prop = null; try { ups = ai.UserProperties; prop = ups.Find(searchKey); if (prop != null) { if (prop.Type != OlUserPropertyType.olText) { log.Warn("Non-string property " + searchKey + " being retrieved as String."); } retVal = prop.Value.ToString(); } } finally { prop = (UserProperty)OutlookOgcs.Calendar.ReleaseObject(prop); ups = (UserProperties)OutlookOgcs.Calendar.ReleaseObject(ups); } } return(retVal); }
private static void add(ref AppointmentItem ai, MetadataId key, OlUserPropertyType keyType, object keyValue) { String addkeyName = metadataIdKeyName(key); UserProperties ups = null; try { if (!Exists(ai, key)) { int newSet; int?keySet = getKeySet(ai, out newSet); keySet = keySet ?? newSet + 1; if (keySet.HasValue && keySet.Value != 0) { addkeyName += "-" + keySet.Value.ToString("D2"); } try { ups = ai.UserProperties; ups.Add(addkeyName, keyType); } catch (System.Exception ex) { OGCSexception.Analyse(ex); ups.Add(addkeyName, keyType, false); } finally { ups = (UserProperties)Calendar.ReleaseObject(ups); } } ups = ai.UserProperties; ups[addkeyName].Value = keyValue; log.Fine("Set userproperty " + addkeyName + "=" + keyValue.ToString()); } finally { ups = (UserProperties)Calendar.ReleaseObject(ups); } }
public static void Add(ref Event ev, MetadataId key, String value) { String addkeyName = metadataIdKeyName(key); if (ev.ExtendedProperties == null) { ev.ExtendedProperties = new Event.ExtendedPropertiesData(); } if (ev.ExtendedProperties.Private__ == null) { ev.ExtendedProperties.Private__ = new Dictionary <String, String>(); } int maxSet; int?keySet = getKeySet(ev, out maxSet); if (key == MetadataId.oCalendarId && (keySet ?? 0) == 0) //Couldn't find key set for calendar { keySet = maxSet + 1; //So start a new one } else if (key != MetadataId.oCalendarId && keySet == null) //Couldn't find non-calendar key in the current set { keySet = 0; //Add them in to the default key set } add(ref ev, addkeyName, value, keySet); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Label != null) { hashCode = hashCode * 59 + Label.GetHashCode(); } if (LanguageCode != null) { hashCode = hashCode * 59 + LanguageCode.GetHashCode(); } if (IsManaged != null) { hashCode = hashCode * 59 + IsManaged.GetHashCode(); } if (MetadataId != null) { hashCode = hashCode * 59 + MetadataId.GetHashCode(); } if (HasChanged != null) { hashCode = hashCode * 59 + HasChanged.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if InlineResponseDefault7Options instances are equal /// </summary> /// <param name="other">Instance of InlineResponseDefault7Options to be compared</param> /// <returns>Boolean</returns> public bool Equals(InlineResponseDefault7Options other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Value == other.Value || Value != null && Value.Equals(other.Value) ) && ( Color == other.Color || Color != null && Color.Equals(other.Color) ) && ( IsManaged == other.IsManaged || IsManaged != null && IsManaged.Equals(other.IsManaged) ) && ( ExternalValue == other.ExternalValue || ExternalValue != null && ExternalValue.Equals(other.ExternalValue) ) && ( ParentValues == other.ParentValues || ParentValues != null && ParentValues.SequenceEqual(other.ParentValues) ) && ( MetadataId == other.MetadataId || MetadataId != null && MetadataId.Equals(other.MetadataId) ) && ( HasChanged == other.HasChanged || HasChanged != null && HasChanged.Equals(other.HasChanged) ) && ( Label == other.Label || Label != null && Label.Equals(other.Label) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) )); }
public static void Remove(ref Event ev, MetadataId id) { String key; if (Exists(ev, id, out key)) { ev.ExtendedProperties.Private__.Remove(key); } }
public static String Get(Event ev, MetadataId id) { String key; if (Exists(ev, id, out key)) { return(ev.ExtendedProperties.Private__[key]); } else { return(null); } }
public override int GetHashCode() { unchecked { int hash = 17; hash = (hash * 3) + MetadataId.GetHashCode(); hash = (hash * 5) + NodeUid.GetHashCode(); hash = (hash * 7) + RelationshipUid.GetHashCode(); hash = (hash * 13) + DescriptorTypeUid.GetHashCode(); return(hash); } }
private static void add(ref AppointmentItem ai, MetadataId key, OlUserPropertyType keyType, object keyValue) { String addkeyName = metadataIdKeyName(key); UserProperties ups = null; try { int maxSet; int? keySet = null; String currentKeyName = null; if (!Exists(ai, key, out currentKeyName)) { keySet = getKeySet(ai, out maxSet); if (key == MetadataId.gCalendarId && (keySet ?? 0) == 0) //Couldn't find key set for calendar { keySet = maxSet + 1; //So start a new one } else if (key != MetadataId.gCalendarId && keySet == null) //Couldn't find non-calendar key in the current set { keySet = 0; //Add them in to the default key set } if (keySet.HasValue && keySet.Value != 0) { addkeyName += "-" + keySet.Value.ToString("D2"); } try { ups = ai.UserProperties; ups.Add(addkeyName, keyType); } catch (System.Exception ex) { OGCSexception.Analyse(ex); ups.Add(addkeyName, keyType, false); } finally { ups = (UserProperties)Calendar.ReleaseObject(ups); } } else { addkeyName = currentKeyName; //Might be suffixed with "-01" } ups = ai.UserProperties; ups[addkeyName].Value = keyValue; OutlookOgcs.Calendar.Instance.EphemeralProperties.Add(ai, new EphemeralProperty(EphemeralProperty.PropertyName.KeySet, keySet)); OutlookOgcs.Calendar.Instance.EphemeralProperties.Add(ai, new EphemeralProperty(EphemeralProperty.PropertyName.MaxSet, keySet)); log.Fine("Set userproperty " + addkeyName + "=" + keyValue.ToString()); } finally { ups = (UserProperties)Calendar.ReleaseObject(ups); } }
/// <summary> /// The name of the keys as held in the custom attribute. /// Names can be stored with numbers appended to support syncing the same object between multiple calendars. /// CalendarID is the master keyname to determine an ID set number. /// </summary> private static String metadataIdKeyName(MetadataId Id) { switch (Id) { case MetadataId.gEventID: return("googleEventID"); case MetadataId.gCalendarId: return("googleCalendarID"); case MetadataId.ogcsModified: return("OGCSmodified"); case MetadataId.forceSave: return("forceSave"); default: return(Id.ToString()); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Value != null) { hashCode = hashCode * 59 + Value.GetHashCode(); } if (Color != null) { hashCode = hashCode * 59 + Color.GetHashCode(); } if (IsManaged != null) { hashCode = hashCode * 59 + IsManaged.GetHashCode(); } if (ExternalValue != null) { hashCode = hashCode * 59 + ExternalValue.GetHashCode(); } if (ParentValues != null) { hashCode = hashCode * 59 + ParentValues.GetHashCode(); } if (MetadataId != null) { hashCode = hashCode * 59 + MetadataId.GetHashCode(); } if (HasChanged != null) { hashCode = hashCode * 59 + HasChanged.GetHashCode(); } if (Label != null) { hashCode = hashCode * 59 + Label.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } return(hashCode); } }
public static void Add(ref Event ev, MetadataId key, String value) { String addkeyName = metadataIdKeyName(key); if (ev.ExtendedProperties == null) { ev.ExtendedProperties = new Event.ExtendedPropertiesData(); } if (ev.ExtendedProperties.Private__ == null) { ev.ExtendedProperties.Private__ = new Dictionary <String, String>(); } int newSet; int?keySet = getKeySet(ev, out newSet); add(ref ev, addkeyName, value, keySet ?? newSet + 1); }
public static void Remove(ref AppointmentItem ai, MetadataId key) { String searchKey; if (Exists(ai, key, out searchKey)) { UserProperties ups = null; UserProperty prop = null; try { ups = ai.UserProperties; prop = ups.Find(searchKey); prop.Delete(); log.Debug("Removed " + searchKey + " property."); } finally { prop = (UserProperty)Calendar.ReleaseObject(prop); ups = (UserProperties)Calendar.ReleaseObject(ups); } } }
/// <summary> /// The name of the keys as held in the custom attribute. /// Names can be stored with numbers appended to support syncing the same object between multiple calendars. /// CalendarID is the master keyname to determine an ID set number. /// </summary> private static String metadataIdKeyName(MetadataId id) { switch (id) { case MetadataId.oEntryId: return("outlook_EntryID"); case MetadataId.oGlobalApptId: return("outlook_GlobalApptID"); case MetadataId.oCalendarId: return("outlook_CalendarID"); case MetadataId.ogcsModified: return("OGCSmodified"); case MetadataId.apiLimitHit: return("APIlimitHit"); case MetadataId.forceSave: return("forceSave"); default: return("outlook_EntryID"); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (LogicalName != null) { hashCode = hashCode * 59 + LogicalName.GetHashCode(); } if (MetadataId != null) { hashCode = hashCode * 59 + MetadataId.GetHashCode(); } if (OptionSet != null) { hashCode = hashCode * 59 + OptionSet.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if InlineResponseDefault6OptionSetDescriptionUserLocalizedLabel instances are equal /// </summary> /// <param name="other">Instance of InlineResponseDefault6OptionSetDescriptionUserLocalizedLabel to be compared</param> /// <returns>Boolean</returns> public bool Equals(InlineResponseDefault6OptionSetDescriptionUserLocalizedLabel other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Label == other.Label || Label != null && Label.Equals(other.Label) ) && ( LanguageCode == other.LanguageCode || LanguageCode != null && LanguageCode.Equals(other.LanguageCode) ) && ( IsManaged == other.IsManaged || IsManaged != null && IsManaged.Equals(other.IsManaged) ) && ( MetadataId == other.MetadataId || MetadataId != null && MetadataId.Equals(other.MetadataId) ) && ( HasChanged == other.HasChanged || HasChanged != null && HasChanged.Equals(other.HasChanged) )); }
private static DateTime get_datetime(AppointmentItem ai, MetadataId key) { DateTime retVal = new DateTime(); String searchKey; if (Exists(ai, key, out searchKey)) { UserProperties ups = null; UserProperty prop = null; try { ups = ai.UserProperties; prop = ups.Find(searchKey); if (prop != null) { try { if (prop.Type != OlUserPropertyType.olDateTime) { log.Warn("Non-datetime property " + searchKey + " being retrieved as DateTime."); retVal = DateTime.Parse(prop.Value.ToString()); } else { retVal = (DateTime)prop.Value; } } catch (System.Exception ex) { log.Error("Failed to retrieve DateTime value for property " + searchKey); OGCSexception.Analyse(ex); } } } finally { prop = (UserProperty)Calendar.ReleaseObject(prop); ups = (UserProperties)Calendar.ReleaseObject(ups); } } return(retVal); }
private static void Add(ref Event ev, MetadataId key, DateTime value) { Add(ref ev, key, value.ToString("yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture)); }
public static Boolean Exists(Event ev, MetadataId searchId) { String throwAway; return(Exists(ev, searchId, out throwAway)); }
private ModelGroupMetadata(ImmutableModelGroup modelGroup) : base(isImageOwner: true, id: MetadataId.CreateNewId()) { _modelGroup = modelGroup; }
public static LoadBalancerMetadataItem GetNodeMetadataItem(this ILoadBalancerService service, LoadBalancerId loadBalancerId, NodeId nodeId, MetadataId metadataId) { if (service == null) throw new ArgumentNullException("service"); try { return service.GetNodeMetadataItemAsync(loadBalancerId, nodeId, metadataId, CancellationToken.None).Result; } catch (AggregateException ex) { ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) throw innerExceptions[0]; throw; } }
public static void Add(ref AppointmentItem ai, MetadataId key, DateTime value) { add(ref ai, key, OlUserPropertyType.olDateTime, value); }
public static void Add(ref AppointmentItem ai, MetadataId key, String value) { add(ref ai, key, OlUserPropertyType.olText, value); }
public static void UpdateNodeMetadataItem(this ILoadBalancerService service, LoadBalancerId loadBalancerId, NodeId nodeId, MetadataId metadataId, string value) { if (service == null) throw new ArgumentNullException("service"); try { service.UpdateNodeMetadataItemAsync(loadBalancerId, nodeId, metadataId, value, CancellationToken.None).Wait(); } catch (AggregateException ex) { ReadOnlyCollection<Exception> innerExceptions = ex.Flatten().InnerExceptions; if (innerExceptions.Count == 1) throw innerExceptions[0]; throw; } }
/// <summary> /// Returns true if InlineResponseDefault7 instances are equal /// </summary> /// <param name="other">Instance of InlineResponseDefault7 to be compared</param> /// <returns>Boolean</returns> public bool Equals(InlineResponseDefault7 other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( OdataContext == other.OdataContext || OdataContext != null && OdataContext.Equals(other.OdataContext) ) && ( OdataType == other.OdataType || OdataType != null && OdataType.Equals(other.OdataType) ) && ( ParentOptionSetName == other.ParentOptionSetName || ParentOptionSetName != null && ParentOptionSetName.Equals(other.ParentOptionSetName) ) && ( IsCustomOptionSet == other.IsCustomOptionSet || IsCustomOptionSet != null && IsCustomOptionSet.Equals(other.IsCustomOptionSet) ) && ( IsGlobal == other.IsGlobal || IsGlobal != null && IsGlobal.Equals(other.IsGlobal) ) && ( IsManaged == other.IsManaged || IsManaged != null && IsManaged.Equals(other.IsManaged) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( ExternalTypeName == other.ExternalTypeName || ExternalTypeName != null && ExternalTypeName.Equals(other.ExternalTypeName) ) && ( OptionSetType == other.OptionSetType || OptionSetType != null && OptionSetType.Equals(other.OptionSetType) ) && ( IntroducedVersion == other.IntroducedVersion || IntroducedVersion != null && IntroducedVersion.Equals(other.IntroducedVersion) ) && ( MetadataId == other.MetadataId || MetadataId != null && MetadataId.Equals(other.MetadataId) ) && ( HasChanged == other.HasChanged || HasChanged != null && HasChanged.Equals(other.HasChanged) ) && ( Options == other.Options || Options != null && Options.SequenceEqual(other.Options) ) && ( Description == other.Description || Description != null && Description.Equals(other.Description) ) && ( DisplayName == other.DisplayName || DisplayName != null && DisplayName.Equals(other.DisplayName) ) && ( IsCustomizable == other.IsCustomizable || IsCustomizable != null && IsCustomizable.Equals(other.IsCustomizable) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (OdataContext != null) { hashCode = hashCode * 59 + OdataContext.GetHashCode(); } if (OdataType != null) { hashCode = hashCode * 59 + OdataType.GetHashCode(); } if (ParentOptionSetName != null) { hashCode = hashCode * 59 + ParentOptionSetName.GetHashCode(); } if (IsCustomOptionSet != null) { hashCode = hashCode * 59 + IsCustomOptionSet.GetHashCode(); } if (IsGlobal != null) { hashCode = hashCode * 59 + IsGlobal.GetHashCode(); } if (IsManaged != null) { hashCode = hashCode * 59 + IsManaged.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (ExternalTypeName != null) { hashCode = hashCode * 59 + ExternalTypeName.GetHashCode(); } if (OptionSetType != null) { hashCode = hashCode * 59 + OptionSetType.GetHashCode(); } if (IntroducedVersion != null) { hashCode = hashCode * 59 + IntroducedVersion.GetHashCode(); } if (MetadataId != null) { hashCode = hashCode * 59 + MetadataId.GetHashCode(); } if (HasChanged != null) { hashCode = hashCode * 59 + HasChanged.GetHashCode(); } if (Options != null) { hashCode = hashCode * 59 + Options.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } if (DisplayName != null) { hashCode = hashCode * 59 + DisplayName.GetHashCode(); } if (IsCustomizable != null) { hashCode = hashCode * 59 + IsCustomizable.GetHashCode(); } return(hashCode); } }
private ModelMetadata(ImmutableModel model) : base(isImageOwner: true, id: MetadataId.CreateNewId()) { _model = model; }
public static Boolean Exists(AppointmentItem ai, MetadataId searchId) { String throwAway; return(Exists(ai, searchId, out throwAway)); }