Пример #1
0
        private async Task <DialogTurnResult> AskForAgreementStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await _helper.SendTypingActivity(stepContext.Context, cancellationToken);

            // Create an object in which to collect the user's information within the dialog.
            stepContext.Values[USER_PROFILE_STEP] = new UserProfileDTO();

            // WaterfallStep always finishes with the end of the Waterfall or with another dialog; here it is a Prompt Dialog.
            return(await stepContext.PromptAsync(nameof(CustomConfirmPrompt), new PromptOptions
            {
                Prompt = MessageFactory.Text("Para começarmos, eu preciso que você me autorize a salvar os seus dados em nossa base de dados. Tudo bem?"),
                RetryPrompt = MessageFactory.Text("Na verdade eu espero SIM ou NÃO como resposta!")
            }, cancellationToken));
        }
Пример #2
0
        private async Task <DialogTurnResult> AskForMonthlyIncomeStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await _helper.SendTypingActivity(stepContext.Context, cancellationToken);

            stepContext.Values[USER_SOCIOECONOMIC_STEP] = new UserSocioEconomicDTO();

            var promptOptions = new PromptOptions
            {
                Prompt = MessageFactory.Text("Qual é a renda mensal da sua empresa?")
                         // RetryPrompt = MessageFactory.Text("Por favor, Verifique os campos obrigatórios!")
            };

            return(await stepContext.PromptAsync(MONTHLY_INCOME_VALIDATION, promptOptions, cancellationToken));
        }
Пример #3
0
        private async Task <DialogTurnResult> AskForPersonsNameStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await _helper.SendTypingActivity(stepContext.Context, cancellationToken);

            // Continue using the same selection list, if any, from the previous iteration of this dialog.
            var listOfIncomes = stepContext.Options as List <FamilyIncomeDTO> ?? new List <FamilyIncomeDTO>();

            stepContext.Values[LIST_OF_INCOMES_STEP] = listOfIncomes;
            stepContext.Values[CURRENT_INCOME_STEP]  = new FamilyIncomeDTO();

            var promptOptions = new PromptOptions
            {
                Prompt      = MessageFactory.Text($"Qual é o nome do {string.Concat((listOfIncomes.Count + 1), "º")} membro da sua família?"),
                RetryPrompt = MessageFactory.Text("O nome da pessoa precisa ter apenas letras, contendo entre 3 e 100 caracteres.")
            };

            return(await stepContext.PromptAsync(NAME_VALIDATION, promptOptions, cancellationToken));
        }
Пример #4
0
        private async Task <DialogTurnResult> AskForTaxIdentificationNumberStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            await _helper.SendTypingActivity(stepContext.Context, cancellationToken);

            // Create an object in which to collect the user's information within the dialog.
            stepContext.Values[USER_COMPANY_STEP] = new UserCompanyDTO();

            var conversation = await _helper.UserAccessor.GetAsync(stepContext.Context, () => new UserConversationDTO());

            var promptOptions = new PromptOptions
            {
                Prompt      = MessageFactory.Text($"{conversation?.UserProfile?.Name}, qual é o CNPJ da sua empresa?"),
                RetryPrompt = MessageFactory.Text("Este não é um CNPJ válido! Tente novamente.")
            };

            // Ask the user to enter their name.
            return(await stepContext.PromptAsync(CNPJ_VALIDATION, promptOptions, cancellationToken));
        }