public async Task Negative(IDialogContext context, LuisResult result) { if (MeetsMinimumIntentScore(result)) { var orderNumber = StateController.GetConversationData(ConversationState.OrderNumber); string message = ""; if (StateController.GetConversationData(ConversationState.OrderIntent) == OrderIntents.Cancel) { message = String.Format(ResourceController.GetMessage(MessageTitles.CancelNotConfirm), orderNumber); } else if (StateController.GetConversationData(ConversationState.OrderIntent) == OrderIntents.Return) { message = String.Format(ResourceController.GetMessage(MessageTitles.ReturnNotConfirm), orderNumber); } if (!string.IsNullOrEmpty(message)) { await PostAsyncMethod(context, message); context.Wait(MessageReceived); } else { await None(context, result); } } else { await None(context, result); } }
public async Task IdentifyOrderNumber(IDialogContext context, LuisResult result) { if (MeetsMinimumIntentScore(result) && result.Entities.Count > 0) { var orderNumber = result.Entities.Where(e => e.Type == ConversationState.OrderNumber).First().Entity; StateController.SetConversationData(ConversationState.OrderNumber, orderNumber); string message = string.Empty; switch (StateController.GetConversationData(ConversationState.OrderIntent)) { case OrderIntents.Status: var orderStatus = OrderManager.OrderStatus(orderNumber); message = String.Format(ResourceController.GetMessage(MessageTitles.OrderStatusConfirm), orderStatus); break; case OrderIntents.Track: var trackingNumber = OrderManager.TrackOrder(orderNumber); message = String.Format(ResourceController.GetMessage(MessageTitles.TrackOrderConfirm), trackingNumber); break; case OrderIntents.Cancel: bool isCancellable = OrderManager.IsCancellable(orderNumber); if (!isCancellable) { message = ResourceController.GetMessage(MessageTitles.CancelNotAllowed); } else { message = ResourceController.GetMessage(MessageTitles.CancelConfirm); } break; case OrderIntents.Return: bool isReturnable = OrderManager.IsReturnable(orderNumber); if (!isReturnable) { message = ResourceController.GetMessage(MessageTitles.ReturnNotAllowed); } else { message = ResourceController.GetMessage(MessageTitles.ReturnConfirm); } break; } await PostAsyncMethod(context, message); context.Wait(MessageReceived); } else { await None(context, result); } }
public async Task OrderStatus(IDialogContext context, LuisResult result) { if (MeetsMinimumIntentScore(result)) { StateController.SetConversationData(ConversationState.OrderIntent, OrderIntents.Status); await PostAsyncMethod(context, ResourceController.GetMessage(MessageTitles.OrderStatus)); context.Wait(MessageReceived); } else { await None(context, result); } }
public async Task Affirmative(IDialogContext context, LuisResult result) { if (MeetsMinimumIntentScore(result)) { var orderNumber = StateController.GetConversationData(ConversationState.OrderNumber); string message = ""; if (StateController.GetConversationData(ConversationState.OrderIntent) == OrderIntents.Cancel) { bool cancelled = OrderManager.CancelOrder(orderNumber); if (cancelled) { message = String.Format(ResourceController.GetMessage(MessageTitles.CancelSuccessful), orderNumber); } else { message = String.Format(ResourceController.GetMessage(MessageTitles.CancelFailed), orderNumber); } } else if (StateController.GetConversationData(ConversationState.OrderIntent) == OrderIntents.Return) { bool returned = OrderManager.ReturnOrder(orderNumber); if (returned) { message = String.Format(ResourceController.GetMessage(MessageTitles.ReturnSuccessful), orderNumber); } else { message = String.Format(ResourceController.GetMessage(MessageTitles.ReturnFailed), orderNumber); } } await PostAsyncMethod(context, message); context.Wait(MessageReceived); } else { await None(context, result); } }
public async Task Greeting(IDialogContext context, LuisResult result) { await PostAsyncMethod(context, ResourceController.GetMessage(MessageTitles.Greeting)); context.Wait(MessageReceived); }
public async Task None(IDialogContext context, LuisResult result) { await PostAsyncMethod(context, ResourceController.GetMessage(MessageTitles.Inconclusive)); context.Wait(MessageReceived); }