Beispiel #1
0
        static void Main(string[] args)
        {
            TsqlCrud crud      = new TsqlCrud();
            var      customers = crud.ShowCustomers();

            foreach (var cust in customers)
            {
                Console.WriteLine(cust.custid + "||" + cust.contactname);
            }
        }
Beispiel #2
0
        public void InsertResturantTest()
        {
            resturant_info testResturant = new resturant_info
            {
                rest_name = "Burger King"
            };
            string   restTestName  = testResturant.rest_name;
            TsqlCrud testeTsqlCrud = new TsqlCrud();

            testResturant = testeTsqlCrud.AddResturant(testResturant);
            Assert.AreEqual(restTestName, testResturant.rest_name);
        }
Beispiel #3
0
        public void Execution()
        {
            var libHelper    = new TsqlCrud();
            int intSelection = CheckInput();

            while (intSelection != 4)
            {
                switch (intSelection)
                {
                case 1:
                    Console.Clear();
                    IEnumerable <resturant_info> sortedList3 = libHelper.SortingByName();
                    for (int i = 0; i < 3; i++)
                    {
                        Console.WriteLine(sortedList3.ElementAt(i).rest_name);
                    }
                    Console.WriteLine("Press Enter to return to Menu");
                    Console.ReadLine();
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine("How would you like to display the Resturants?");
                    Console.WriteLine("1) Display as: A-Z");
                    Console.WriteLine("2) Display as: Z-A");
                    Console.WriteLine("3) Display by: Rating");
                    intSelection = CheckInput();
                    Console.Clear();
                    if (intSelection == 1)
                    {
                        IEnumerable <resturant_info> sortedList = libHelper.SortingByName();
                        foreach (var x in sortedList)
                        {
                            Console.WriteLine(x.rest_name);
                        }
                        Console.WriteLine("Press Enter to Continue");
                        Console.ReadKey();
                    }
                    else if (intSelection == 2)
                    {
                        IEnumerable <resturant_info> sortedListDesc = libHelper.SortingByNameDesc();
                        foreach (var x in sortedListDesc)
                        {
                            Console.WriteLine(x.rest_name);
                        }
                        Console.WriteLine("Press Enter to Continue");
                        Console.ReadKey();
                    }

                    else if (intSelection == 3)
                    {
                        Console.Clear();
                        IEnumerable <resturant_info> sortedList = libHelper.SortingByRating().Reverse();
                        foreach (var x in sortedList)
                        {
                            Console.WriteLine(x.rest_name + " ||  Rating:" + x.rest_rating);
                        }
                        Console.WriteLine("Press Enter to Continue");
                        Console.ReadKey();
                    }
                    else
                    {
                        Console.WriteLine("Command Not Recognized");
                    }
                    break;

                case 3:
                    //WORK ON SEARCHING THROUGH WITH CASE INSESITIVE
                    Console.Clear();
                    Console.WriteLine("Enter resturant name to view information");
                    string lookUpResturant = Console.ReadLine();
                    Log.Info(lookUpResturant);
                    IEnumerable <resturant_info> sortedLookUp   = libHelper.SortingByName();
                    IEnumerable <resturant_info> restruantFound = sortedLookUp.Where(x => x.rest_name.Contains(lookUpResturant));
                    Console.Clear();
                    foreach (var rest in restruantFound)
                    {
                        Console.WriteLine(rest.rest_name);
                        Console.WriteLine(rest.rest_address);
                        Console.WriteLine(rest.city);
                        Console.WriteLine(rest.rest_zipcode);
                        Console.WriteLine(rest.state);
                        Console.WriteLine(rest.rest_phoneNumber);
                        Console.WriteLine("=========================================");
                    }
                    Console.WriteLine("Press Enter to Continue.");
                    Console.ReadKey();
                    break;

                case 4:
                    Console.WriteLine("Should end...");
                    break;

                default:
                    Console.WriteLine("Command not recognized.");
                    break;
                }
                Console.Clear();
                Selection();
                intSelection = CheckInput();
            }
        }