private void Publish(eXAlert alert, AlertInterest interest) { var implementor = ResolveHandler(interest.Notification.Method); if (implementor != null) { implementor.Execute(alert, interest); } }
private static bool Zone(eXAlert alert, AlertTarget target) { bool b = false; if (!String.IsNullOrEmpty(alert.Zone) && alert.Zone.Equals(target.Value)) { b = true; } return(b); }
private static bool Category(eXAlert alert, AlertTarget target) { bool b = false; if (alert.Categories != null && alert.Categories.Contains(target.Value)) { b = true; } return(false); }
private static bool Target(eXAlert alert, AlertTarget target) { bool b = false; if (alert.Audiences != null && alert.Audiences.Contains(target.Value)) { b = true; } return(b); }
private bool Contains(eXAlert alert, AlertTarget target) { bool b = false; if (targetmaps.ContainsKey(target.Key)) { b = targetmaps[target.Key].Invoke(alert, target); } return(b); }
public bool Execute(eXAlert model) { bool b = false; if (model != null) { b = ExecuteAlert(model); } return(b); }
private static bool Urgency(eXAlert alert, AlertTarget target) { bool b = false; ScaleOption alertOpt; ScaleOption targetOpt; if (!String.IsNullOrEmpty(alert.Urgency) && Enum.TryParse <ScaleOption>(alert.Urgency, out alertOpt)) { if (Enum.TryParse <ScaleOption>(target.Value, out targetOpt)) { b = alertOpt >= targetOpt; } } return(b); }
private bool ExecuteAlert(eXAlert alert) { int alertCount = 0; List <string> list = null; foreach (var subscriber in subscribers) { foreach (var interest in subscriber.Interests) { bool b = true; for (int i = 0; b && i < interest.Targets.Count; i++) { AlertTarget target = interest.Targets[i]; b = Contains(alert, target); } if (b) { alertCount++; Publish(alert, interest); } } } if (alert.Dispositions != null) { list = new List <string>(alert.Dispositions); } else { list = new List <string>(); } string disposition = String.Format("{0} subscribers, {1} alerts :{2}", subscribers.Count, alertCount, DateTime.Now.ToString(XFConstants.DateTimeFormat)); list.Add(disposition); alert.Dispositions = list.ToArray(); return(true); }