Exemplo n.º 1
0
        private async Task <DialogTurnResult> SendDateTimeCard(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            string path         = TimeOffBL.GetPath();
            string DateTimeCard = File.ReadAllText(path + "\\Cards\\PTODateTimeCard.json");
            await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(SendCards.SendAdaptiveCard(DateTimeCard)), cancellationToken);

            return(EndOfTurn);
        }
Exemplo n.º 2
0
 protected override async Task OnMembersAddedAsync(IList <ChannelAccount> membersAdded, ITurnContext <IConversationUpdateActivity> turnContext, CancellationToken cancellationToken)
 {
     foreach (var member in membersAdded)
     {
         if (member.Id != turnContext.Activity.Recipient.Id)
         {
             var    path        = TimeOffBL.GetPath();
             string WelcomeCard = File.ReadAllText(path + "\\Cards\\WelcomeMeassage.json");
             await turnContext.SendActivityAsync(MessageFactory.Attachment(SendCards.SendAdaptiveCard(WelcomeCard)), cancellationToken);
         }
     }
 }
Exemplo n.º 3
0
        private async Task <DialogTurnResult> ActionAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)

        {
            var activity = stepContext.Context.Activity;

            if (activity.Value != null)
            {
                var Value       = JsonConvert.DeserializeObject <JObject>(activity.Value.ToString());
                var ActionValue = Value["Action"];
                if (ActionValue != null)
                {
                    var state = await stepContext.ContinueDialogAsync();
                }
                else
                {
                    ImBackData imBackData = JsonConvert.DeserializeObject <ImBackData>(activity.Value.ToString());
                    activity.Text = imBackData.msteams.value;
                }
            }

            var topScoringintent = LuisData.LuisResult(activity.Text);

            switch (topScoringintent)
            {
            case "Cancel":
                await stepContext.Context.SendActivityAsync(MessageFactory.Text("Cancelling All dialogs please restart the flow"));

                return(await stepContext.CancelAllDialogsAsync(cancellationToken));

            case IntentToken.PTOApply:
                return(await stepContext.ReplaceDialogAsync(nameof(BookTimeOffDialog)));

            case IntentToken.PTOBalance:
                return(await stepContext.ReplaceDialogAsync(nameof(TimeOfBalanceDialog)));

            default:
                string path        = TimeOffBL.GetPath();
                string WelcomeCard = File.ReadAllText(path + "\\Cards\\NoneIntent.json");
                await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(SendCards.SendAdaptiveCard(WelcomeCard)), cancellationToken);

                return(await stepContext.CancelAllDialogsAsync(cancellationToken));
            }
        }