Exemplo n.º 1
0
        private async Task Change(IDialogContext context)
        {
            List <string> List = new List <string>();

            List = SqlOperations.GetList("OptionsForChangingWiser");
            PromptDialog.Choice(context, CaptureChangeRequest, List, "Which change are you requesting?", "Please select from given Options");
        }
Exemplo n.º 2
0
        public async Task AskForPinAndName(IDialogContext context, IAwaitable <object> result)
        {
            List <string> ListOfQusetions = new List <string>();

            ListOfQusetions = SqlOperations.GetList("OptionsForFaultWiser");

            context.ConversationData.TryGetValue(StateKeys.ChangeRequest, out message);

            SqlOperations.ForConversationLog(message, ListOfQusetions[1]);
            await context.PostAsync(ListOfQusetions[1]);

            context.Wait(CapturePinAndRegistrant);
        }
Exemplo n.º 3
0
        private async Task MessageReceivedAsync(IDialogContext context)
        {
            try
            {
                if (Intents.SmallTalkHelpWhatCanYouDo == Luis.intent)
                {
                    SqlOperations.ForConversationLog(RootDialog.message, "Carousel");
                    List <string> List = new List <string>();
                    List = SqlOperations.GetList("OptionsForThingsDoneByBot");
                    string message = List[0].Replace("{Name}", RootDialog.Name);
                    List.RemoveAt(0);
                    await context.PostAsync(message);
                    await HeroCard(context, List);
                }
                else
                {
                    RootDialog.BotResponse = SqlOperations.ForBotReply(Luis.intent);
                    if (RootDialog.message == "Morning" || RootDialog.message == "Afternoon" || RootDialog.message == "Evening" || RootDialog.message == "Night")
                    {
                        await context.PostAsync(RootDialog.message + " " + RootDialog.BotResponse);

                        SqlOperations.ForConversationLog(RootDialog.message, RootDialog.BotResponse);
                    }
                    else if (RootDialog.BotResponse.Contains("{Name}"))
                    {
                        string message = RootDialog.BotResponse.Replace("{Name}", RootDialog.Name);

                        await context.PostAsync(message);
                    }
                    else
                    {
                        await context.PostAsync(RootDialog.BotResponse);

                        SqlOperations.ForConversationLog(RootDialog.message, RootDialog.BotResponse);
                    }
                    RootDialog rootDialog = new RootDialog();
                    await rootDialog.StartAsync(context);
                }
            }
            catch (Exception e)
            {
                ExceptionLog.LogFile(e);
            }
        }
        private async Task AdaptiveCards(IDialogContext context, IAwaitable <object> result)
        {
            ListOfQusetions = SqlOperations.GetList("OptionsForFaultWiser");
            {
                try
                {
                    var replyActivity = context.MakeMessage();
                    replyActivity.Attachments.Add(new Microsoft.Bot.Connector.Attachment()
                    {
                        ContentType = "application/vnd.microsoft.card.adaptive",
                        Content     = JObject.Parse($@"
                                                    {{
                                                      ""$schema"": ""http://adaptivecards.io/schemas/adaptive-card.json"",
                                                      ""type"": ""AdaptiveCard"",
                                                      ""version"": ""1.0"",
                                                      ""body"": [
                                                        {{
                                                                                ""type"": ""ColumnSet"",
                                                                                ""columns"": [
                                                                                                {{
                                                                                                    ""type"": ""Column"",
                                                                                                    ""items"": 
                                                                                                                [                                                                                                                   
                                                                                                                    {{
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""size"": ""Medium"",
                                                                                                                        ""weight"": ""Bolder"",
                                                                                                                        ""text"": ""{ListOfQusetions[0]}""
                                                                                                                    }},
                                                                                                                    {{
                        
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ ListOfQusetions[1] }"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""PinAndFullName"",
                                                                                                                    }},
                                                                                                                    {{  
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[2]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""TaskAttemptedWhileIssue"",
                                                                                                                    }},
                                                                                                                    {{    
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[3]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""DisplayedErrorMessage"",
                                                                                                                    }},
                                                                                                                    {{                                                                                                              
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[4]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""NosOfUserImpacted"",
                                                                                                                    }},
                                                                                                                    {{                                                                                                              
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[5]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""AdditionalInfo"",
                                                                                                                    }},
                                                                                                                ]
                                                                                                }}
                                                                                             ]
                                                        }}       
                                                                ],
                                                          ""actions"": [
                                                            {{
                                                                ""type"": ""Action.Submit"",
                                                                ""id"": ""submit""
                                                                ""title"": ""Submit"",
                                                                ""data"":{"action":""FaultInfo""}
                                                            }}
                                                                       ]
                                                    }}")
                    });


                    await context.PostAsync(replyActivity);

                    //await ReadDataFromAdaptiveCard(context,result);
                    context.Wait(ReadDataFromAdaptiveCard);
                    //WiserRootDialog wiserRootDialog = new WiserRootDialog();
                    //await wiserRootDialog.RiseTicketForFault(context, result);
                    //context.Wait(wiserRootDialog.RiseTicketForFault);
                }
                catch (Exception e)
                {
                }
            }
        }
Exemplo n.º 5
0
        private async Task AdaptiveCards(IDialogContext context)
        {
            ListOfAnswer.Clear();
            ListOfQusetions.Clear();
            ListOfUnAnsweredQuestion.Clear();


            AdditionalInfo          = string.Empty;
            NosOfUserImpacted       = string.Empty;
            DisplayedErrorMessage   = string.Empty;
            TaskAttemptedWhileIssue = string.Empty;
            PinAndFullName          = string.Empty;


            ListOfQusetions = SqlOperations.GetList("OptionsForFaultWiser");
            {
                try
                {
                    var replyActivity = context.MakeMessage();
                    replyActivity.Attachments.Add(new Microsoft.Bot.Connector.Attachment()
                    {
                        ContentType = "application/vnd.microsoft.card.adaptive",
                        Content     = JObject.Parse($@"
                                                    {{
                                                      ""$schema"": ""http://adaptivecards.io/schemas/adaptive-card.json"",
                                                      ""type"": ""AdaptiveCard"",
                                                      ""version"": ""1.0"",
                                                      ""body"": [
                                                        {{
                                                                                ""type"": ""ColumnSet"",
                                                                                ""columns"": [
                                                                                                {{
                                                                                                    ""type"": ""Column"",
                                                                                                    ""items"": 
                                                                                                                [                                                                                                                   
                                                                                                                    {{
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""size"": ""Medium"",
                                                                                                                        ""weight"": ""Bolder"",
                                                                                                                        ""text"": ""{ListOfQusetions[0]}""
                                                                                                                    }},
                                                                                                                    {{
                        
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ ListOfQusetions[1] }"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""PinAndFullName"",
                                                                                                                        ""placeholder"": "" * required"",
                                                                                                                    }},
                                                                                                                    {{  
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[2]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""TaskAttemptedWhileIssue"",
                                                                                                                        ""placeholder"": "" * required"",
                                                                                                                    }},
                                                                                                                    {{    
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[3]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""DisplayedErrorMessage"",
                                                                                                                        ""placeholder"": "" * required"",
                                                                                                                    }},
                                                                                                                    {{                                                                                                              
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[4]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""NosOfUserImpacted"",
                                                                                                                        ""placeholder"": "" * required"",
                                                                                                                    }},
                                                                                                                    {{                                                                                                              
                                                                                                                        ""type"": ""TextBlock"",
                                                                                                                        ""text"": ""{ListOfQusetions[5]}"",
                                                                                                                    }},
                                                                                                                    {{
                                                                                                                        ""type"": ""Input.Text"",
                                                                                                                        ""id"": ""AdditionalInfo"",
                                                                                                                        ""placeholder"": ""optional"",
                                                                                                                    }},
                                                                                                                ]
                                                                                                }}
                                                                                             ]
                                                        }}       
                                                                ],
                                                          ""actions"": [
                                                            {{
                                                                ""type"": ""Action.Submit"",
                                                                ""title"": ""Submit"",
                                                                   ""Id"": ""submit""                        
                                                            }},
                                                                       ]
                                                    }}")
                    });

                    await context.PostAsync(replyActivity);

                    context.Wait(ReadDataFromAdaptiveCard);
                }
                catch (Exception e)
                {
                    ExceptionLog.LogFile(e);
                }
            }
        }