public override async Task <DialogTurnResult> BeginDialogAsync(
            DialogContext dc,
            object options = default,
            CancellationToken cancellationToken = default)
        {
            var text       = dc.Context.GetTextWithoutCommand(BotCommands.CandidateSummaryDialog);
            var candidates = await _candidateService.Search(text, 15, cancellationToken);

            var templateModel = new CandidateTemplateModel
            {
                BotCommand    = BotCommands.CandidateSummaryDialog,
                ListCardTitle = "Please select candidate:",
                Items         = candidates,
                NoItemsLabel  = "You don't have such candidates."
            };

            await _candidatesTemplate.ReplyWith(dc.Context, TemplateConstants.CandidateAsFileConsentCardWithMultipleItems, templateModel);

            return(await dc.EndDialogAsync(cancellationToken : cancellationToken));
        }
        public override async Task <DialogTurnResult> BeginDialogAsync(
            DialogContext dc,
            object options = null,
            CancellationToken cancellationToken = default)
        {
            var text      = dc.Context.GetTextWithoutCommand(BotCommands.TopCandidatesDialogCommand);
            var positions = await _positionService.Search(text, 15, cancellationToken);

            if (positions.Count == 1)
            {
                var candidates   = positions[0].Candidates;
                var interviewers = await _recruiterService.GetAllInterviewers(cancellationToken);

                CandidateTemplateModel templateModel = new CandidateTemplateModel
                {
                    ListCardTitle = "Top candidates who have recently applied to your position:",
                    BotCommand    = BotCommands.CandidateDetailsDialogCommand,
                    Items         = candidates,
                    Interviewers  = interviewers,
                    AppSettings   = _appSettings,
                    NoItemsLabel  = $"There are no candidates for position ID: {positions[0].PositionExternalId}"
                };

                await _candidatesTemplate.ReplyWith(dc.Context, TemplateConstants.CandidateAsAdaptiveCardWithMultipleItems, templateModel);
            }
            else
            {
                PositionTemplateModel positionsTemplate = new PositionTemplateModel
                {
                    ListCardTitle = "I found several positions. Please specify:",
                    Items         = positions,
                    BotCommand    = BotCommands.TopCandidatesDialogCommand,
                    NoItemsLabel  = "You don't have open position with such ID."
                };

                await _positionsTemplate.ReplyWith(dc.Context, TemplateConstants.PositionAsAdaptiveCardWithMultipleItems, positionsTemplate);
            }

            return(await dc.EndDialogAsync(cancellationToken : cancellationToken));
        }
Пример #3
0
        public override async Task <DialogTurnResult> BeginDialogAsync(
            DialogContext dc,
            object options = null,
            CancellationToken cancellationToken = default)
        {
            var text       = dc.Context.GetTextWithoutCommand(BotCommands.CandidateDetailsDialogCommand);
            var candidates = await _candidateService.Search(text, 15, cancellationToken);

            var interviewers = await _recruiterService.GetAllInterviewers(cancellationToken);

            var templateModel = new CandidateTemplateModel
            {
                ListCardTitle = "I found following candidates:",
                BotCommand    = string.Empty,
                Items         = candidates,
                Interviewers  = interviewers,
                AppSettings   = _appSettings,
                NoItemsLabel  = "You don't have such candidates."
            };

            await _candidatesTemplate.ReplyWith(dc.Context, TemplateConstants.CandidateAsAdaptiveCardWithMultipleItems, templateModel);

            return(await dc.EndDialogAsync(cancellationToken : cancellationToken));
        }