Пример #1
0
        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));
        }
Пример #2
0
        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));
        }
Пример #3
0
 public void NewEvent(Event theEvent)
 {
     Clients.All.newEvent(theEvent);
 }