Exemplo n.º 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);
        }
Exemplo n.º 2
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);
            }
        }