// Token: 0x0600036C RID: 876 RVA: 0x00015654 File Offset: 0x00013854 public void OnIndication(string subscriptionId, string indicationType, PropertyBag indicationProperties, PropertyBag sourceInstanceProperties) { if (OrionCoreNotificationSubscriber.log.IsDebugEnabled) { OrionCoreNotificationSubscriber.log.DebugFormat("Indication of type \"{0}\" arrived.", indicationType); } try { object obj; if (indicationType == IndicationHelper.GetIndicationType(1) && sourceInstanceProperties.TryGetValue("InstanceType", out obj) && string.Equals(obj as string, "Orion.Nodes", StringComparison.OrdinalIgnoreCase)) { if (sourceInstanceProperties.ContainsKey("NodeID")) { int nodeId = Convert.ToInt32(sourceInstanceProperties["NodeID"]); this.InsertIntoDeletedTable(nodeId); } else { OrionCoreNotificationSubscriber.log.WarnFormat("Indication is type of {0} but does not contain NodeID", indicationType); } } } catch (Exception ex) { OrionCoreNotificationSubscriber.log.Error(string.Format("Exception occured when processing incomming indication of type \"{0}\"", indicationType), ex); } }
// Token: 0x060005F8 RID: 1528 RVA: 0x00023A08 File Offset: 0x00021C08 public void OnIndication(string subscriptionId, string indicationType, PropertyBag indicationProperties, PropertyBag sourceInstanceProperties) { if (sourceInstanceProperties == null) { DowntimeMonitoringEnableSubscriber.Log.Error("Argument sourceInstanceProperties is null"); return; } if (!sourceInstanceProperties.ContainsKey("CurrentValue")) { DowntimeMonitoringEnableSubscriber.Log.Error("CurrentValue not supplied in sourceInstanceProperties"); return; } try { DowntimeMonitoringEnableSubscriber.Log.DebugFormat("Downtime monitoring changed to {0}, unsubscribing..", sourceInstanceProperties["CurrentValue"]); bool flag = Convert.ToBoolean(sourceInstanceProperties["CurrentValue"]); this.downtimeMonitoringSubscriber.Stop(); if (flag) { DowntimeMonitoringEnableSubscriber.Log.Debug("Re-subscribing.."); this.downtimeMonitoringSubscriber.Start(); } else { this.SealIntervals(); } } catch (Exception ex) { DowntimeMonitoringEnableSubscriber.Log.Error("Indication handling failed", ex); } }
public void PropertyBag_Writable_Delete() { var bag = new PropertyBag { { "foo", false } }; engine.AddHostObject("bag", bag); engine.Execute("delete bag.foo"); Assert.IsFalse(bag.ContainsKey("foo")); }
/// <summary> /// Convenience method that provides a string Indexer /// to the Properties collection AND the strongly typed /// properties of the object by name. /// /// // dynamic /// exp["Address"] = "112 nowhere lane"; /// // strong /// var name = exp["StronglyTypedProperty"] as string; /// </summary> /// <remarks> /// The getter checks the Properties dictionary first /// then looks in PropertyInfo for properties. /// The setter checks the instance properties before /// checking the Properties dictionary. /// </remarks> /// <param name="key"></param> /// /// <returns></returns> public object this[string key] { get { try { // try to get from properties collection first return(Properties[key]); } catch (KeyNotFoundException ex) { // try reflection on instanceType object result = null; if (GetProperty(Instance, key, out result)) { return(result); } // nope doesn't exist //throw; //Don't throw return null return(null); } } set { if (Properties.ContainsKey(key)) { Properties[key] = value; return; } // check instance for existance of type first var miArray = InstanceType.GetMember(key, BindingFlags.Public | BindingFlags.GetProperty); if (miArray != null && miArray.Length > 0) { SetProperty(Instance, key, value); } else { Properties[key] = value; } } }
public virtual GetProductUrlParam GetProductUrlParams(SitemapParams sitemapParams, CultureInfo culture, PropertyBag propertyBag) { return(new WebsiteGetProductUrlParam { WebsiteId = sitemapParams.Website, CultureInfo = culture, ProductId = (string)propertyBag["ProductId"], ProductName = (string)propertyBag["DisplayName"], SKU = propertyBag.ContainsKey("Sku") ? (string)propertyBag["Sku"] : null, BaseUrl = sitemapParams.BaseUrl }); }
protected virtual bool IsDocumentValid(PropertyBag propertyBag) { return(RequiredDocumentKeys.All(key => { var containsKey = propertyBag.ContainsKey(key); if (!containsKey) { Log.Warn($"Skipping insertion of product {propertyBag[ProductId]} in sitemap because property {key} is not defined."); } return containsKey; })); }
public void IgnoresMissingMetadataColumns() { string document = "value,[Metadata]\n123"; Gallio.Common.GallioFunc <TextReader> documentReaderProvider = delegate { return(new StringReader(document)); }; CsvDataSet dataSet = new CsvDataSet(documentReaderProvider, false) { HasHeader = true }; DataBinding binding = new DataBinding(0, null); List <IDataItem> items = new List <IDataItem>(dataSet.GetItems(new DataBinding[] { binding }, true)); Assert.AreEqual("123", items[0].GetValue(binding)); PropertyBag map = DataItemUtils.GetMetadata(items[0]); Assert.IsFalse(map.ContainsKey("Metadata")); }
protected virtual string ExtractLookupId(string fieldName, PropertyBag propertyBag) { if (propertyBag == null) { return(null); } var fieldValue = propertyBag.ContainsKey(fieldName) ? propertyBag[fieldName] as string : null; if (string.IsNullOrWhiteSpace(fieldValue)) { return(null); } var extractedValues = fieldValue.Split(new[] { "::" }, StringSplitOptions.None); return(extractedValues.Length < 3 ? null : extractedValues[2]); }
private static bool IsViewModelPropertyInSourcePropertyBag(PropertyBag sourcePropertyBag, IPropertyMetadata viewModelProperty) { return(sourcePropertyBag != null && sourcePropertyBag.ContainsKey(viewModelProperty.SourcePropertyName)); }
public bool Exists(string key) { return(PropertyBag.ContainsKey(key)); }
/// <summary> /// /// </summary> public void Save() { //* initialize an object for execute var toExecute = FilterTrashed(); //* set the modified records. The logic behind will handle it without hassle ModifiedAt = DateTime.Now; if (Id == 0) { CreatedAt = DateTime.Now; //* Need to form value to save var recordsToInsert = from pocoCol in PocoColumns.Values where PropertyBag.ContainsKey(pocoCol.PropertyInfo.Name) select new { pocoCol.ColumnName, value = PropertyBag[pocoCol.PropertyInfo.Name] }; //* The condition here is when the number of records to add is more than 2, which is excluding ModifiedAt and CreatedAt if (recordsToInsert.Count() > 2) { //* Do insert here toExecute .Insert((from c in recordsToInsert select c.ColumnName).ToArray()) .Into(TableName); foreach (var red in recordsToInsert) { toExecute.Value(red.ColumnName, red.value); } var ret = DbFacade.GetDatabaseConnection(ConnectionName).Insert(TableName, this); //* implement finding the records by all matches if (ret != null && ret.IsNumber()) { Id = long.Parse(ret.ToString()); } else { Id = long.MinValue; } } } else { UpdateResult = int.MinValue; //* Need to form value to save var recordsToUpdate = from ModifiedProp in ModifiedColumns let pocoCol = PocoColumns[ModifiedProp] select new { pocoCol.ColumnName, value = PropertyBag[ModifiedProp] }; //* The condition here is excluding ModifiedAt if (recordsToUpdate.Count() > 1) { //* Do update here toExecute.Update().Where((model) => model.Id == Id); foreach (var red in recordsToUpdate) { toExecute.Set(red.ColumnName, red.value); } UpdateResult = DbFacade.GetDatabaseConnection(ConnectionName).Update(this); } OnModelSaved(this, null); } }