private void ExecuteAction(FlowModel flow, Event value) { foreach (var eventParameter in value.Parameters) { var eventParameterCriteria = flow.EventParameters.SingleOrDefault( ep => ep.Name.Equals(eventParameter.Name, StringComparison.InvariantCultureIgnoreCase)); if (eventParameterCriteria == null) { Debug.WriteLine("Parameter " + eventParameter.Name + " was not found on flow"); return; } if (!string.IsNullOrEmpty(eventParameterCriteria.Value) && eventParameterCriteria.Value != "null") { if (!eventParameter.Value.ToLower().Contains(eventParameterCriteria.Value.ToLower())) { Debug.WriteLine("Parameter " + eventParameter.Name + " did not contain expected value " + eventParameterCriteria.Value); return; } } } var action = new EventAction { Name = flow.ActionName, Application = flow.ActionApplication, Parameters = flow.ActionParameters }; GlobalHost.ConnectionManager.GetHubContext<EventLogHub>().Clients.All.newAction(JsonConvert.SerializeObject(action)); }
private void RouteEvent(Event value) { var data = System.IO.File.ReadAllText(ConfigurationManager.AppSettings["flowsPath"]); var flows = JsonConvert.DeserializeObject<List<FlowModel>>(data); flows .Where(flow => flow.EventApplication.Equals(value.Application, StringComparison.InvariantCultureIgnoreCase) && flow.EventName.Equals(value.Name, StringComparison.InvariantCultureIgnoreCase)) .ToList() .ForEach(flow => ExecuteAction(flow, value)); }
public void NewEvent(Event theEvent) { Clients.All.newEvent(theEvent); }