Esempio n. 1
0
        public Task Handle(NewCustomerReceived message, IMessageHandlerContext context)
        {
            //Save the entire message.  We'll need it.
            Data.NewCustomerEvent = message;
            Console.WriteLine($"New Customer {message.ContactId} Received. Lastname is {message.LastName}.  Creating a Task due in an hour");
            var newTaskRequest = new CreateCustomerTaskRequest
            {
                ContactId   = Data.ContactId,
                Description = "Customer Fraud Review",
                Subject     = "Fraud Review Task",
                Deadline    = DateTimeOffset.Now.AddHours(8),
                CreatedById = Data.NewCustomerEvent.CreatedById
            };

            return(context.Send(newTaskRequest));
        }
Esempio n. 2
0
        public Task Handle(ContactCreate message, IMessageHandlerContext context)
        {
            log.Info($"Received CRM message id: {context.MessageId} (contact: {message.FullName})");

            var newCustomer = new NewCustomerReceived
            {
                ContactId   = message.ContactId,
                CreatedById = message.CreatedById,
                CreateDate  = message.CreateDate,
                FullName    = message.FullName,
                FirstName   = message.FirstName,
                LastName    = message.LastName,
                Address     = message.Address,
                Email       = message.Email
            };

            log.Info($"Created new customer for Customer {newCustomer.ContactId}, Lastname {newCustomer.LastName}, createdby {newCustomer.CreatedById}");

            return(context.Publish(newCustomer));
        }