ScrutR

Monitor entities in application and notify when conditions match

var notificationService = new NotificationService();

var product = new Product();
product.Code = "Test";
product.Price = 10m;
product.Stock = 1;
product.Title = "Product test";

var priceCondition = new PriceCondition("price", "Price");
priceCondition.SelectedComparator = new GreaterThanOrEqualsComparator();
priceCondition.PropertyValue = 10;

var subscription = notificationService.CreateSubscription();
subscription.Collector = Collector.Once;
subscription.FullTypeName = typeof(Product).AssemblyQualifiedName;
subscription.ConditionList.Add(priceCondition);
subscription.PublisherList.Add(new EmailPublisher());
subscription.EventName = "update";
subscription.Recipient = new Person() { Email = "test@email.com", FullName = "testperson" };
subscription.SubjectFormat = "Price greater or equals 10";
subscription.BodyFormat = "product {Product.Code} updated with price {Product.Price:F2}";

notificationService.AddSubscription(subscription);
    
notificationService.Start();

notificationService.PushAsync("update", product);




Last edited Oct 15, 2013 at 2:12 PM by mchouteau, version 6