//private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result) //{ // RootDialog.BotResponse = SQLManager.GetVisitorBadgeQuestions(2); // PromptDialog.Text(context, this.EnterDepartment, RootDialog.BotResponse); //} public async Task EnterDepartment(IDialogContext context, IAwaitable <object> result) { var activity = await result as Activity; string departmentchoice = activity.Text; try { using (HttpClient httpClient = new HttpClient()) { LuisResponse Data = new LuisResponse(); var responseInString = await httpClient.GetStringAsync(@"https://westus.api.cognitive.microsoft.com/luis/v2.0/apps/daac86e9-b94a-4897-9f5e-3dea98dc3cde?staging=true&verbose=true&timezoneOffset=-360&subscription-key=60c884e98ad84389b452b71ed84894b4&q=" + System.Uri.EscapeDataString(departmentchoice)); Data = JsonConvert.DeserializeObject <LuisResponse>(responseInString); var intent = Data.topScoringIntent.intent; string IntentName = intent; var score = Data.topScoringIntent.score; if (IntentName == "DepartmentIntent" && score > 0.8) { UserData.Department = Data.entities[0].entity.ToString(); RootDialog.UserResponse = UserData.Department; SQLManager.GetName(UserData.UserID); if (UserData.Department == departmentchoice) { RootDialog.BotResponse = SQLManager.GetVisitorBadgeQuestions(5); await context.PostAsync(RootDialog.BotResponse); SQLManager.GetConversationData(UserData.UserID, RootDialog.UserResponse, RootDialog.BotResponse); context.Wait(EnterContactName); } else { RootDialog.BotResponse = SQLManager.GetVisitorBadgeQuestions(6); await context.PostAsync(RootDialog.BotResponse); SQLManager.GetConversationData(UserData.UserID, RootDialog.UserResponse, RootDialog.BotResponse); context.Wait(EnterDepartment); } } else { RootDialog.BotResponse = SQLManager.GetVisitorBadgeQuestions(7); await context.PostAsync(RootDialog.BotResponse); SQLManager.GetConversationData(UserData.UserID, RootDialog.UserResponse, RootDialog.BotResponse); context.Wait(EnterDepartment); } } } catch (Exception e) { SQLManager.StoreExceptionData(e.GetType().ToString(), e.Message, e.StackTrace, e.Data.ToString()); //throw e; } }