private async Task CheckForUserExistance(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; Email = activity.Text; SqlOperations.GetStaticResponse(StateKeys.ProcForUserName, Email, "Email", "UserName"); // validating Email Name = SqlOperations.Result; // If the User Existence if (SqlOperations.IsSuccess) { context.UserData.SetValue(StateKeys.UserEmail, Email); context.UserData.SetValue(StateKeys.UserName, Name); BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, MessageType.WiserWelcome); message = BotResponse.Replace("Name", Name); SqlOperations.ForConversationLog(activity.Text, message); await context.PostAsync(message); context.Wait(Luis.IdentifyUserQueryUsingLuis); } else { BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "IncorrectEmail"); await context.PostAsync(BotResponse); } }
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <string> result) { string activity = await result; if (activity == "Yes") { RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "AskingForFaultOrChange"); SqlOperations.ForConversationLog(activity, RootDialog.BotResponse); PromptDialog.Choice(context, FaultOrChange, new List <string>() { "Fault", "Change" }, RootDialog.BotResponse, " Please select the given option ", 3); } else if (activity == "No") { RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "AskingForProblem"); SqlOperations.ForConversationLog(activity, RootDialog.BotResponse); await context.PostAsync(RootDialog.BotResponse); context.Wait(Proceed); } }
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); }
private async Task WiserChangeForm(IDialogContext context) { RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "EndOfWiser"); SqlOperations.ForConversationLog(UserInput, RootDialog.BotResponse); await context.PostAsync(RootDialog.BotResponse); await rootDialog.StartAsync(context); }
private async Task CaptureUserIssue(IDialogContext context, IAwaitable <object> result) { var UserInput = await result as Activity; context.ConversationData.SetValue(StateKeys.UserIssue, UserInput); SqlOperations.ForConversationLog(message, "User's Issue"); await Proceed(context, result); }
internal async Task RiseTicketForFault(IDialogContext context, IAwaitable <object> result) { RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "EndForFault"); await context.PostAsync(RootDialog.BotResponse); Email.SendEmail(RootDialog.Email); SqlOperations.ForConversationLog(RootDialog.BotResponse, "Email has been sent"); context.Wait(Luis.IdentifyUserQueryUsingLuis); }
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); }
private async Task Proceed(IDialogContext context, IAwaitable <object> result) { if (UserRequest == "Change") { context.ConversationData.TryGetValue(StateKeys.PinAndName, out string message); RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "AskingToProceed"); SqlOperations.ForConversationLog(message, RootDialog.BotResponse); } PromptDialog.Choice(context, EndOfFlow, new List <string>() { "Yes", "No" }, RootDialog.BotResponse, "Please select from given Options"); }
private async Task FaultOrChange(IDialogContext context, IAwaitable <string> result) { UserRequest = await result; if (UserRequest == "Fault") { context.Call(new WiserFaultDialog(), RiseTicketForFault); } else if (UserRequest == "Change") { SqlOperations.ForConversationLog(UserRequest, "Options for change"); context.Call(new WiserChangeDialog(), AskForPinAndName); } }
internal async Task InCaseOfValidation(IDialogContext context, IAwaitable <object> result) { var Input = await result as Activity; if (String.IsNullOrEmpty(PinAndFullName)) { PinAndFullName = Input.Text; SqlOperations.ForConversationLog("these are * required", ListOfQusetions[1]); await context.PostAsync(ListOfUnAnsweredQuestion[index]); index++; context.Wait(InCaseOfValidation); } else if (String.IsNullOrEmpty(TaskAttemptedWhileIssue)) { TaskAttemptedWhileIssue = Input.Text; SqlOperations.ForConversationLog(PinAndFullName, ListOfQusetions[2]); await context.PostAsync(ListOfUnAnsweredQuestion[index]); index++; context.Wait(InCaseOfValidation); } else if (String.IsNullOrEmpty(DisplayedErrorMessage)) { DisplayedErrorMessage = Input.Text; SqlOperations.ForConversationLog(DisplayedErrorMessage, ListOfQusetions[3]); await context.PostAsync(ListOfUnAnsweredQuestion[index]); index++; context.Wait(InCaseOfValidation); } else if (String.IsNullOrEmpty(NosOfUserImpacted)) { NosOfUserImpacted = Input.Text; SqlOperations.ForConversationLog(NosOfUserImpacted, ListOfQusetions[4]); WiserRootDialog.UserIncomplete = true; WiserRootDialog wiserRootDialog = new WiserRootDialog(); await wiserRootDialog.RiseTicketForFault(context, result); } }
private async Task EndOfFlow(IDialogContext context, IAwaitable <string> result) { UserInput = await result; if (UserInput == "Yes") { await WiserChangeForm(context); } if (UserInput == "No") { SqlOperations.ForConversationLog(UserInput, "Ok thank you"); await context.PostAsync("Ok thank you"); await rootDialog.StartAsync(context); } }
public async Task StartAsync(IDialogContext context) { string Name; context.UserData.TryGetValue(StateKeys.UserName, out Name); RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "CheckForWiserLogin"); message = RootDialog.BotResponse.Replace("Name", Name); SqlOperations.ForConversationLog(RootDialog.message, message); PromptDialog.Choice(context, MessageReceivedAsync, new List <string>() { "Yes", "No" }, message, " Please select the given option ", 3); }
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); } }
internal async Task AssignValue(IDialogContext context, IAwaitable <object> result) { if (String.IsNullOrEmpty(PinAndFullName)) { PinAndFullName = Data.PinAndFullName; ListOfAnswer.Add(PinAndFullName); SqlOperations.ForConversationLog(WiserRootDialog.UserRequest, ListOfQusetions[0]); SqlOperations.ForConversationLog(PinAndFullName, ListOfQusetions[1]); } if (String.IsNullOrEmpty(TaskAttemptedWhileIssue)) { TaskAttemptedWhileIssue = Data.TaskAttemptedWhileIssue; ListOfAnswer.Add(TaskAttemptedWhileIssue); SqlOperations.ForConversationLog(TaskAttemptedWhileIssue, ListOfQusetions[2]); } if (String.IsNullOrEmpty(DisplayedErrorMessage)) { DisplayedErrorMessage = Data.DisplayedErrorMessage; ListOfAnswer.Add(DisplayedErrorMessage); SqlOperations.ForConversationLog(DisplayedErrorMessage, ListOfQusetions[3]); } if (String.IsNullOrEmpty(NosOfUserImpacted)) { NosOfUserImpacted = Data.NosOfUserImpacted; ListOfAnswer.Add(NosOfUserImpacted); SqlOperations.ForConversationLog(NosOfUserImpacted, ListOfQusetions[4]); } if (String.IsNullOrEmpty(AdditionalInfo)) { AdditionalInfo = Data.AdditionalInfo; SqlOperations.ForConversationLog(AdditionalInfo, ListOfQusetions[5]); await Validation(context, result); } }
public async Task AskForPinAndName(IDialogContext context, IAwaitable <object> result) { string PinAndName; if (!context.ConversationData.TryGetValue(StateKeys.PinAndName, out PinAndName)) { //if (UserRequest == "Fault") //{ // // RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "FaultQuestion1"); // //SqlOperations.ForConversationLog(UserRequest, RootDialog.BotResponse); //} //else { //context.EndConversation("200"); context.ConversationData.TryGetValue(StateKeys.ChangeRequest, out message); RootDialog.BotResponse = SqlOperations.GetResponseFromBot("ToFetchBotsReply", Intents.FootPrintsWiserIssueTicketing, "FaultQuestion1"); SqlOperations.ForConversationLog(message, RootDialog.BotResponse); } await context.PostAsync(RootDialog.BotResponse); context.Wait(CapturePinAndRegistrant); } }