private Attachment CreateAdaptiveCardUsingSdk(OrderState order) { var card = new AdaptiveCard(); card.Body.Add(new AdaptiveTextBlock() { Text = Messages.ShowOrdersStatus, Size = AdaptiveTextSize.Small, Weight = AdaptiveTextWeight.Bolder, }); card.Body.Add(new AdaptiveTextBlock() { Text = string.Format(Messages.ShowOrdersCreatedAt, order.CreateDateTime), Size = AdaptiveTextSize.Small, Weight = AdaptiveTextWeight.Bolder, }); card.Body.Add(new AdaptiveTextBlock() { Text = $"{ShowCartDialog.GetPrintableCart(order, "order")}", Size = AdaptiveTextSize.Small, Weight = AdaptiveTextWeight.Bolder, }); return(new Attachment() { ContentType = AdaptiveCard.ContentType, Content = card, }); }
/// <summary> /// Resolve everything is OK. /// </summary> private async Task <DialogTurnResult> ResolveIsEverythingOk( WaterfallStepContext stepContext, CancellationToken cancellationToken) { CustomerState customerState = await _customerService.GetCustomerStateById(stepContext.Context.Activity.From.Id); var whatToChange = stepContext.Result as FoundChoice; // Save name, if prompted. if (whatToChange == null) { await stepContext.Context.SendActivityAsync(ShowCartDialog.GetPrintableCart(customerState.Cart, "order")); await stepContext.Context.SendActivityAsync(GetPrintableCustomerInfo(customerState)); return(await stepContext.PromptAsync( ConfirmUserInfoPrompt, new PromptOptions { Prompt = MessageFactory.Text(Messages.GetUserInfoPromptIsOrderOk), RetryPrompt = MessageFactory.Text(Messages.GetUserInfoPromptIsOrderOk + Messages.CancelPrompt), Choices = ChoiceFactory.ToChoices(new List <string> { Messages.Yes, Messages.No }), }, cancellationToken)); } else { switch (whatToChange.Value) { case Messages.Name: customerState.Name = null; break; case Messages.Email: customerState.Email = null; break; case Messages.PhoneNumber: customerState.PhoneNumber = null; break; case Messages.Address: customerState.Address = null; break; case Messages.PostCode: customerState.PostCode = null; break; case Messages.City: customerState.City = null; break; case Messages.IsAddressMatchShippingAddress: customerState.IsShippingAdressMatch = null; break; case Messages.ShippingName: customerState.ShippingName = null; break; case Messages.ShippingAddress: customerState.ShippingAddress = null; break; case Messages.ShippingPostCode: customerState.ShippingPostCode = null; break; case Messages.ShippingCity: customerState.ShippingCity = null; break; } await _customerService.UpdateCustomerState(customerState); stepContext.ActiveDialog.State["stepIndex"] = DialogIndex[whatToChange.Value]; return(await stepContext.ContinueDialogAsync()); } }