public async Task CheapestRestaurants(IDialogContext context, IAwaitable <IMessageActivity> argument) { var message = await argument; string loc = ""; if (message.Text.ToLower() == "no") { await context.PostAsync("I hope i was helful \n Enjoy the rest!!!"); SpeechSynthesizer sound = new SpeechSynthesizer(); //Add System.Speech Reference First In Order To Creating It. sound.Speak("I hope i was helful \n Enjoy the rest"); context.Wait(redirect); } else if (loc != null) { EditDistance distance = new EditDistance(message.Text); loc = distance.Location(); SqlConnection connection = new SqlConnection("Data Source=CHRISTOS\\SQLEXPRESS;Initial Catalog=Tourist;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); connection.Open(); cmd = new SqlCommand(" select * from Restaurant Where City ='" + loc.ToUpper() + "' ORDER BY Price_rate ASC ", connection); SqlDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { await context.PostAsync("The district that you provide does not exist. \n Please try again!!"); context.Wait(CheapestRestaurants); } else { await context.PostAsync("Here is the cheapest restaurants in order....."); while (reader.Read()) { String msg = " Restaurant Name: " + reader[1].ToString() + "\nCity: " + reader[2].ToString() + "\nAddress: " + reader[3].ToString() + "\nPricing rate: " + reader[6].ToString() + "/5"; await context.PostAsync(msg); } await Task.Delay(5000); await context.PostAsync("Do you want any other district??"); context.Wait(CheapestRestaurants); } } }
public async Task RestaurantsInfo(IDialogContext context, IAwaitable <IMessageActivity> argument) { var message = await argument; string loc = ""; if (message.Text.ToLower() == "no") { await context.PostAsync("Have a nice day!!!"); } else if (message.Text.ToLower() == "yes") { context.Wait(RestaurantsInfo); } else if (loc != null) { EditDistance distance = new EditDistance(message.Text); loc = distance.Location(); SqlConnection connection = new SqlConnection("Data Source=CHRISTOS\\SQLEXPRESS;Initial Catalog=Tourist;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); connection.Open(); cmd = new SqlCommand("SELECT * FROM Restaurant WHERE City = '" + loc.ToLower() + "'", connection); SqlDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { await context.PostAsync("The district that you provide does not exist \n Please try again!!"); context.Wait(CheapestRestaurants); } else { await context.PostAsync("Here is my recommendations....."); while (reader.Read()) { String msg = " Restaurant Name: " + reader[1].ToString() + "\nAddress :" + reader[2].ToString() + "\nCity: " + reader[3].ToString() + "\nPhone: " + reader[4].ToString() + "\n Rate:" + reader[5].ToString() + "/5"; await context.PostAsync(msg); } await Task.Delay(6000); await context.PostAsync("Do you want any other district??"); } } }
public async Task LocationsCoordinates(IDialogContext context, IAwaitable <IMessageActivity> argument) { var message = await argument; string loc = ""; if (message.Text == "no") { await context.PostAsync("Have a nice day!!!"); } else if (message.Text == "yes") { await context.PostAsync("Choose one of the two categories: \n--> Distances \n-->Nearest places "); context.Wait(ChooseMsg); } else if (message.Text != null) { EditDistance distance = new EditDistance(message.Text); loc = distance.Location(); SqlConnection connection = new SqlConnection("Data Source=CHRISTOS\\SQLEXPRESS;Initial Catalog=Tourist;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); connection.Open(); cmd = new SqlCommand("SELECT * FROM Location WHERE Town = '" + message.Text.ToLower() + "'", connection); SqlDataReader reader = cmd.ExecuteReader(); await context.PostAsync("Here is your Coordinates\n Use them when it requires....."); while (reader.Read()) { String msg = "Your Latitude is: '" + reader[3] + "' \n Your Longitude is: '" + reader[4]; await context.PostAsync(msg); } await Task.Delay(3000); await context.PostAsync("Do you want use them now?"); } else { await context.PostAsync("Sorry you provide false Town!!\n Please try again"); context.Wait(LocationsCoordinates); } }
//*********INFORMATIONS ABOUT PLACES********* public async Task MuseumsInfo(IDialogContext context, IAwaitable <IMessageActivity> argument) { var message = await argument; string loc = ""; if (message.Text.ToLower() == "no") { await context.PostAsync("I hope i was helpful.\n Enjoy the rest!!!"); } else if (loc != null) { EditDistance distance = new EditDistance(message.Text); loc = distance.Location(); SqlConnection connection = new SqlConnection("Data Source=CHRISTOS\\SQLEXPRESS;Initial Catalog=Tourist;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); connection.Open(); cmd = new SqlCommand("SELECT * FROM Museum WHERE City = '" + loc.ToLower() + "'", connection); SqlDataReader reader = cmd.ExecuteReader(); if (!reader.Read()) { await context.PostAsync("The district that you provide does not exist. \n Please try again!!"); context.Wait(CheapestRestaurants); } else { await context.PostAsync("Here is my recommendations....."); SpeechSynthesizer sound = new SpeechSynthesizer(); //Add System.Speech Reference First In Order To Creating It. sound.Speak("Here is my recomontations"); while (reader.Read()) { String msg = " Museum Name: " + reader[1].ToString() + "\nCity :" + reader[2].ToString() + "\nAddress: " + reader[3].ToString() + "\nPhone: " + reader[4].ToString(); await context.PostAsync(msg); } await Task.Delay(6000); await context.PostAsync("Do you want any other district??"); context.Wait(MuseumsInfo); } } }