예제 #1
0
        public async Task <CreateSalesOrderOutput> CreateSalesOrderAsync(CreateSalesOrderInput input)
        {
            var jobInfo = CreateStartJobInfo(GetProcessKey(nameof(CreateSalesOrderAsync)), input);
            var job     = await _orchestratorClient.ExecuteJobAsync(jobInfo);

            return(JsonConvert.DeserializeObject <CreateSalesOrderOutput>(job.OutputArguments));
        }
예제 #2
0
 public async Task<CreateSalesOrderOutput> CreateSalesOrderAsync(CreateSalesOrderInput input)
 {
     return new CreateSalesOrderOutput()
     {
         DeliveryDate = DateTime.Today.AddDays(7),
         OrderId = "45678",
     };
 }
예제 #3
0
        private async Task <DialogTurnResult> PlaceOrderStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var message = stepContext.Context.Activity.AsMessageActivity().Text;


            if (message.OrdinalEquals(Resource.Return) || message.OrdinalEquals(Resource.Replace))
            {
                await stepContext.Context.SendActivityAsync(Resource.Working_On);

                var item = (Item)stepContext.Values["SelectedItem"];

                var cancelInput = new CancelOrderInput()
                {
                    OrderId      = item.OrderId,
                    CancelReason = (string)stepContext.Values["Damage"],
                };
                var cancelOrderOutput = await _myRpaClient.CancelOrderAsync(cancelInput);

                var orderCancelMessage = string.Format(Resource.Order_Cancelled, item.OrderId, cancelOrderOutput.ReturnLabelLocation);
                await stepContext.Context.SendActivityAsync(orderCancelMessage);

                if (message.OrdinalEquals(Resource.Replace))
                {
                    var salesOrderInput = new CreateSalesOrderInput()
                    {
                        CustomerId = (string)stepContext.Values[c_customerId],
                        ItemId     = item.ItemId,
                        Quantity   = item.Quantity,
                    };
                    var createSaledOrderOuput = await _myRpaClient.CreateSalesOrderAsync(salesOrderInput);

                    var orderCreatedMessage = string.Format(Resource.Order_Created, createSaledOrderOuput.OrderId, createSaledOrderOuput.DeliveryDate.ToShortDateString());
                    await stepContext.Context.SendActivityAsync(orderCreatedMessage);
                }
                await stepContext.Context.SendActivityAsync(Resource.Anything_Else);
            }
            else
            {
                await stepContext.Context.SendActivityAsync(Resource.Cannot_Understand);
            }

            return(await stepContext.EndDialogAsync());
        }