public static TParameterType GetParameter <TParameterType>(this DataCollection <string, object> inputParameter, string parameterName) { if (inputParameter.Contains(parameterName) && inputParameter[parameterName] is TParameterType) { return((TParameterType)inputParameter[parameterName]); } return(default(TParameterType)); }
public bool Remove(Quote item) { if (DataCollection.Contains(item)) { return(DataCollection.Remove(item)); } else { return(false); } }
private string getAttributeValue(Entity entityRecord, string keyName, DataCollection <string> invalidNewValue) { string value = string.Empty; if (invalidNewValue != null && invalidNewValue.Contains(keyName)) { return(NO_VALUE); } if (entityRecord != null && entityRecord.Contains(keyName) && entityRecord[keyName] != null) { value = this.GetAttributeValueBasedOnType(entityRecord, keyName); } return(value == null ? string.Empty : value); }
/// <summary> /// Get the Target Entity data from the record that triggered the plugin execution /// </summary> /// <param name="parameterCollection">A collection containing Input Parameter data for the plugin execution</param> /// <returns>Entity object containing the record fields that were updated and triggered the plugin.</returns> protected T GetEntityFromTarget <T>(DataCollection <string, object> parameterCollection) { if (parameterCollection == null) { throw new ArgumentException("No Input Parameters were found in the context. Please contact your system administrator."); } if (!parameterCollection.Contains("Target")) { throw new ArgumentException("No Target Entity was found in the context. Please contact your system administrator."); } T entity = (T)Convert.ChangeType(parameterCollection["Target"], typeof(T)); return(entity); }
public override void SetPropertyValue(PSAdaptedProperty adaptedProperty, object value) { if (IsReadOnly) { throw new NotSupportedException(); } DataCollection <string, TValue> internalObject = adaptedProperty.BaseObject as DataCollection <string, TValue>; if (internalObject != null && IsSettable(adaptedProperty)) { if (internalObject.Contains(adaptedProperty.Name)) { internalObject[adaptedProperty.Name] = (TValue)value; } else { internalObject.Add(adaptedProperty.Name, (TValue)value); } } }
public bool Contains(Quote item) { return(DataCollection.Contains(item)); }
public DataCollection<StandBildMappingFull> GetCorrectOrderedStandBildMappingFull (Guid? RootID, Guid? TypID, String TargetTableName) { DataCollection<StandBildMappingFull> Result = new DataCollection<StandBildMappingFull>(); if ((!String.IsNullOrEmpty (TargetTableName)) && (TargetTableName != "*")) { foreach (StandBildMappingFull Entry in AllStandBildMappingFull.Values) { if (Entry.TargetTable == "*") continue; if (Entry.TargetTable != TargetTableName) continue; Result.Add(Entry); } if (Result.Count > 0) return Result; } foreach (StandBildMappingFull Entry in AllStandBildMappingFull.Values) { if (Entry.RootFormat != RootID) continue; if ((!String.IsNullOrEmpty(Entry.ItemContent)) && (Guid.Parse(Entry.ItemContent) != Entry.RootFormat) && (Entry.TypID != Guid.Empty)) continue; Result.Add(Entry); } foreach (StandBildMappingFull Entry in AllStandBildMappingFull.Values) { if (Result.Contains(Entry)) continue; if (Entry.TypID != TypID) continue; Result.Add(Entry); } return Result; }
public DataCollection<StandBildMappingFull> GetCorrectOrderedStandBildMappingFullForTyp (Guid RootID, Guid TypID, String TargetTableName) { DataCollection<StandBildMappingFull> Result = new DataCollection<StandBildMappingFull>(); foreach (StandBildMappingFull Entry in AllStandBildMappingFull.Values) { if (Entry.RootFormat != RootID) continue; if ((Entry.SpecialTypID != null) && (Entry.SpecialTypID != Guid.Empty)) continue; if (Entry.TargetTable != "*") continue; Result.Add(Entry); } foreach (StandBildMappingFull Entry in AllStandBildMappingFull.Values) { if (Result.Contains(Entry)) continue; if (Entry.TargetTable != TargetTableName) continue; Result.Add(Entry); } foreach (StandBildMappingFull Entry in AllStandBildMappingFull.Values) { if (Result.Contains(Entry)) continue; if (Entry.SpecialTypID != TypID) continue; Result.Add(Entry); } return Result; }
public void op_Contains_string_stringMissing() { var obj = new DataCollection { { "name", "value" } }; Assert.False(obj.Contains("name", "???")); }
public void op_Contains_string_string() { var obj = new DataCollection { { "name", string.Empty }, { "name", "value" } }; Assert.True(obj.Contains("name", "value")); }