예제 #1
0
        private async Task MessageReceivedAsync(IDialogContext context)
        {
            if (Luis.intent == Intents.EmailCalendarAccess)
            {
                RootDialog.BotResponse = SqlOperations.ForBotReply(Luis.intent);
                await context.PostAsync(RootDialog.BotResponse);

                SqlOperations.ForConversationLog(RootDialog.message, RootDialog.BotResponse);
            }
            else if (Luis.intent == Intents.EmailMimecastRelease)
            {
                RootDialog.BotResponse = SqlOperations.ForBotReply(Luis.intent);
                await context.PostAsync(RootDialog.BotResponse);

                SqlOperations.ForConversationLog(RootDialog.message, RootDialog.BotResponse);
            }
            else if (Luis.intent == Intents.EmailInboxBlockSpam)
            {
                RootDialog.BotResponse = SqlOperations.ForBotReply(Luis.intent);
                await context.PostAsync(RootDialog.BotResponse);

                SqlOperations.ForConversationLog(RootDialog.message, RootDialog.BotResponse);
            }
            else if (Luis.intent == Intents.EmailOutlookSignatureCreation)
            {
                RootDialog.BotResponse = SqlOperations.ForBotReply(Luis.intent);
                await context.PostAsync(RootDialog.BotResponse);

                SqlOperations.ForConversationLog(RootDialog.message, RootDialog.BotResponse);
            }
            else if (Luis.intent == Intents.EmailAutoReplySetup)
            {
                for (int i = 0; i < Entities.EmailAutoReplySetup.Count; i++)
                {
                    if (RootDialog.Email.Contains(Entities.EmailAutoReplySetup[i]))
                    {
                        string Entity = Entities.EmailAutoReplySetup[i];
                        RootDialog.BotResponse = SqlOperations.ForBotReplywithEntity(Luis.intent, Entity);
                        string message = RootDialog.BotResponse.Replace("{Name}", RootDialog.Name);
                        await context.PostAsync(message);

                        SqlOperations.ForConversationLog(RootDialog.message, message);
                        break;
                    }
                }
            }
            else if (Luis.intent == Intents.SelfServiceRequestHardwareType)
            {
                RootDialog.BotResponse = SqlOperations.ForBotReplywithEntity(Luis.intent, Luis.entity);
                string message = RootDialog.BotResponse.Replace("{Name}", RootDialog.Name);
                await context.PostAsync(message);

                SqlOperations.ForConversationLog(RootDialog.message, message);
            }

            RootDialog rootDialog = new RootDialog();
            await rootDialog.StartAsync(context);
        }
예제 #2
0
        private async Task HeroCard(IDialogContext context, List <string> List)
        {
            try
            {
                var resultMessage = context.MakeMessage();
                resultMessage.AttachmentLayout = AttachmentLayoutTypes.Carousel;
                resultMessage.Attachments      = new List <Attachment>();

                foreach (var message in List)
                {
                    HeroCard heroCard = new HeroCard()
                    {
                        Title  = message,
                        Images = new List <CardImage>()
                        {
                            new CardImage()
                            {
                                Url = StateKeys.Img
                            }
                        },
                        //Buttons = new List<CardAction>()
                        //{
                        //    new CardAction()
                        //    {
                        //        Title = "Ready To Hepl",
                        //        Type = ActionTypes.ImBack,
                        //        Value = "",
                        //    }
                        //}
                    };
                    resultMessage.Attachments.Add(heroCard.ToAttachment());
                }

                await context.PostAsync(resultMessage);

                await context.PostAsync("How can I Help you");

                RootDialog rootDialog = new RootDialog();
                await rootDialog.StartAsync(context);
            }
            catch (Exception e)
            {
                ExceptionLog.LogFile(e);
            }
        }
예제 #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);
            }
        }