예제 #1
0
        //cheapest bars
        public async Task CheapestBars(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 Bars 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(CheapestBars);
                }
                else
                {
                    await context.PostAsync("Here is the cheapest bars in order.....");

                    while (reader.Read())
                    {
                        String msg = " Bar Name: " + reader[1].ToString() + "\nAddress :" + reader[2].ToString() + "\nCity: " +
                                     reader[3].ToString() + "\nPricing rate: " + reader[6].ToString() + "/5";


                        await context.PostAsync(msg);
                    }
                    await Task.Delay(4000);

                    await context.PostAsync("Do you want any other district??");

                    context.Wait(CheapestBars);
                }
            }
        }
예제 #2
0
        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??");
                }
            }
        }
예제 #3
0
        //*********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);
                }
            }
        }
예제 #4
0
        //current location function
        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" || message.Text == "yeah")
            {
                await context.PostAsync("Choose one of the two categories: \n--> Distances \n-->Nearest places ");

                SpeechSynthesizer sound = new SpeechSynthesizer(); //Add System.Speech Reference First In Order To Creating It.
                sound.Speak("Choose one of the two categories:");
                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();

                if (reader.Read())
                {
                    await context.PostAsync("Here is your Coordinates\n Use them when it requires.....");

                    SpeechSynthesizer sound = new SpeechSynthesizer(); //Add System.Speech Reference First In Order To Creating It.
                    sound.Speak("Here is your Coordinates\n Use them when it requires");

                    String msg = "Your Latitude is: '" + reader[3] + "' \n Your Longitude is: '" + reader[4];
                    await context.PostAsync(msg);

                    Slat = Convert.ToDouble(reader[3].ToString());
                    Slng = Convert.ToDouble(reader[4].ToString());


                    await Task.Delay(3000);

                    await context.PostAsync("Do you want use them now?");

                    SpeechSynthesizer sound1 = new SpeechSynthesizer(); //Add System.Speech Reference First In Order To Creating It.
                    sound1.Speak("Do you want use them now?");
                }

                else if (!reader.Read())
                {
                    await context.PostAsync("Sorry you provide false Town!!\n Please try again");

                    context.Wait(LocationsCoordinates);
                }
            }
        }