Exemple #1
0
        public override async Task HandleIncomingUserResponseAsync(ITurnContext turnContext, CancellationToken cancellationToken)
        {
            if (ConversationData.WaitingForUserInput)
            {
                var userInput = ConversationUtils.GetUserReply(turnContext);
                if (DialogUtils.IsUserInputInOptions(userInput, Constants.UserIntentSelection.ReservationPossibleSelectionValues))
                {
                    ConversationData.CurrentConversationIntent = BotSupportedIntents.MaintenanceBookingService;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.UserIntentSelection.CheckingStatusPossibleSelectionValues))
                {
                    ConversationData.CurrentConversationIntent = BotSupportedIntents.GettingUpdatesAboutCurrentRequests;
                }
                else
                {
                    await ConversationUtils.SendMessageBasedOnUserPreferredLanguage(
                        Constants.General.InvalidValueProvided,
                        this.UserProfile,
                        turnContext,
                        cancellationToken);
                }

                if (ConversationData.CurrentConversationIntent.HasValue)
                {
                    ConversationData.SetWaitingForUserInputFlag(false);
                }
            }
        }
Exemple #2
0
        public override async Task HandleIncomingUserResponseAsync(ITurnContext turnContext, CancellationToken cancellationToken)
        {
            var userInput = ConversationUtils.GetUserReply(turnContext);

            if (DialogUtils.IsUserInputInOptions(userInput, Constants.RequestedMaintenanceServiceSelection.CarpentryPossibleValues))
            {
                ConversationData.ServiceBookingForm.RequestedService = SupportedMaintenanceServices.Carpentry;
            }
            else if (DialogUtils.IsUserInputInOptions(userInput, Constants.RequestedMaintenanceServiceSelection.ElectricalMaintenancePossibleValues))
            {
                ConversationData.ServiceBookingForm.RequestedService = SupportedMaintenanceServices.ElectricalMaintenance;
            }
            else if (DialogUtils.IsUserInputInOptions(userInput, Constants.RequestedMaintenanceServiceSelection.PlumbingPossibleValues))
            {
                ConversationData.ServiceBookingForm.RequestedService = SupportedMaintenanceServices.PlumbingServices;
            }
            else if (DialogUtils.IsUserInputInOptions(userInput, Constants.RequestedMaintenanceServiceSelection.AirConditioningPossibleValues))
            {
                ConversationData.ServiceBookingForm.RequestedService = SupportedMaintenanceServices.AirConditioningMaintenance;
            }
            else if (DialogUtils.IsUserInputInOptions(userInput, Constants.RequestedMaintenanceServiceSelection.PaintingPossibleValues))
            {
                ConversationData.ServiceBookingForm.RequestedService = SupportedMaintenanceServices.PaintingServices;
            }
            else if (DialogUtils.IsUserInputInOptions(userInput, Constants.RequestedMaintenanceServiceSelection.CleaningPossibleValues))
            {
                ConversationData.ServiceBookingForm.RequestedService = SupportedMaintenanceServices.Cleaning;
            }
            else
            {
                await ConversationUtils.SendMessageBasedOnUserPreferredLanguage(
                    Constants.General.InvalidValueProvided,
                    UserProfile,
                    turnContext,
                    cancellationToken
                    );
            }

            if (ConversationData.ServiceBookingForm.RequestedService.HasValue)
            {
                ConversationData.SetWaitingForUserInputFlag(false);
            }
        }
Exemple #3
0
        public override async Task HandleIncomingUserResponseAsync(ITurnContext turnContext, CancellationToken cancellationToken)
        {
            var userInput = ConversationUtils.GetUserReply(turnContext);

            if (DialogUtils.IsUserInputInOptions(userInput, Constants.LanguageSelection.EnglishLanguagePossibleSelectionValues))
            {
                UserProfile.PreferredLanguage = SupportedLanguage.English;
            }
            else if (DialogUtils.IsUserInputInOptions(userInput, Constants.LanguageSelection.ArabicLanguagePossibleSelectionValues))
            {
                UserProfile.PreferredLanguage = SupportedLanguage.Arabic;
            }
            else
            {
                await ConversationUtils.SendMessage(Constants.General.InvalidValueProvided.CombineLanguageValues(),
                                                    turnContext,
                                                    cancellationToken);
            }

            if (UserProfile.PreferredLanguage.HasValue)
            {
                this.ConversationData.SetWaitingForUserInputFlag(false);
            }
        }
        public override async Task HandleIncomingUserResponseAsync(ITurnContext turnContext, CancellationToken cancellationToken)
        {
            var userInput = ConversationUtils.GetUserReply(turnContext);

            if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.ApprovalOptionValues))
            {
                var newMaintenanceServiceRequestId = await PostMaintenanceServiceRequestForTheUser();

                if (!string.IsNullOrWhiteSpace(newMaintenanceServiceRequestId))
                {
                    var requestIdAsOption = new string[] { newMaintenanceServiceRequestId };
                    await ConversationUtils.SendMessageBasedOnUserPreferredLanguage(
                        Constants.Confirmation.RequestSupmittedMessage,
                        this.UserProfile,
                        turnContext,
                        cancellationToken,
                        formattingValues : new MessageOption()
                    {
                        English = requestIdAsOption,
                        Arabic  = requestIdAsOption
                    }
                        );

                    this.ConversationData.NewUserMaintenanceServiceId = newMaintenanceServiceRequestId;
                    this.ConversationData.IsExpectingFeedBackFromUser = true;
                    await new GettingUserFeedBackDialog(this.ConversationData, this.UserProfile).StartAsync(turnContext, cancellationToken);

                    ClearServiceBookingForm();
                    ResetUserIntentFromDialog();
                    this.ConversationData.NewUserMaintenanceServiceId = newMaintenanceServiceRequestId;
                    this.ConversationData.SetWaitingForUserInputFlag(false);
                }
                else
                {
                    await ConversationUtils.SendMessageBasedOnUserPreferredLanguage(
                        Constants.Confirmation.FailedToSupmitRequestMessage,
                        this.UserProfile,
                        turnContext,
                        cancellationToken
                        );
                }
            }
            else
            {
                this.ConversationData.SetWaitingForUserInputFlag(false);
                if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.RequiredServicenAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.RequestedService = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.ServiceDescriptionAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.RequiredServiceDescription = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.AdressAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.DeliveryLocation = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.YearAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.Year = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.MonthAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.Month = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.DayAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.Day = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.HourAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.Hour = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.MinuteAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.Minutes = null;
                }
                else if (DialogUtils.IsUserInputInOptions(userInput, Constants.Confirmation.PartOfDayAdjustmentOptionValues))
                {
                    this.ConversationData.ServiceBookingForm.DayOrNight = null;
                }
                else
                {
                    this.ConversationData.SetWaitingForUserInputFlag();
                    await ConversationUtils.SendMessageBasedOnUserPreferredLanguage(
                        Constants.General.InvalidValueProvided,
                        this.UserProfile,
                        turnContext,
                        cancellationToken
                        );
                }
            }
        }