public Task SendInitiativeWorkOrderCreatedAsync(WorkOrderCreatedEventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            if (args.Initiative == null)
            {
                throw new ArgumentException("Initiative cannot be null");
            }
            if (args.Owner == null)
            {
                throw new ArgumentException("Owner cannot be null");
            }
            if (string.IsNullOrWhiteSpace(args.WorkOrderId))
            {
                throw new ArgumentException("WorkOrderId cannot be null or empty");
            }

            _logger.Information("Posting InitiativeWorkOrderCreated event to service bus for Initiative {InitiativeId} and WorkOrderId {WorkOrderId}", args.Initiative.Id, args.WorkOrderId);

            var userProperties = new Dictionary <string, object>();

            SetInitiative(args.Initiative, userProperties);
            SetOwner(args.Owner, userProperties);
            SetWorkOrder(args.WorkOrderId, args.EtaUtc, userProperties);
            //ADD ETA!
            return(_messageSender.SendMessageAsync(REMEDY_WORK_ITEM_CREATED, userProperties));
        }
Esempio n. 2
0
        public Task SendInitiativeWorkOrderCreatedAsync(WorkOrderCreatedEventArgs args)
        {
            var tasks             = new List <Task>();
            var cancellationToken = new System.Threading.CancellationToken();

            foreach (var h in _messageReceiver.WorkOrderCreatedHandlers)
            {
                tasks.Add(h(args, cancellationToken));
            }
            return(Task.WhenAll(tasks));
        }