コード例 #1
0
ファイル: Program.cs プロジェクト: zwsmith/Auto_Lot_Locator
        static void Main(string[] args)
        {
            var vehInfo = new VehicInfo();//Create an object to use properties and methods


            Console.WriteLine("Please enter Customer's vehicle requirements");

            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Yellow;//Color borders_____________________________________________________

                Console.Write("Please select number for catagory:");
                var vehCate = Enum.GetNames(typeof(VehCate));
                for (var i = 0; i < vehCate.Length; i++)
                {
                    Console.Write($" {i + 1}. {vehCate[i]}     ");
                }

                Console.WriteLine();
                Console.Write("You've entered: ");
                var vehCateg  = Convert.ToInt32(Console.ReadLine());
                var vehCategs = (VehCate)Enum.Parse(typeof(VehCate), vehCate[vehCateg - 1]);

                Console.ResetColor(); //Color borders_____________________________________________________


                switch (vehCategs)

                {
                case VehCate.Exit:

                    return;

                case VehCate.Suv:
                {
                    GetVehData(vehCategs);

                    break;
                }

                case VehCate.Sedan:
                {
                    GetVehData(vehCategs);

                    break;
                }

                case VehCate.Truck:
                {
                    GetVehData(vehCategs);
                    break;
                }

                case VehCate.Print:
                {
                    Console.BackgroundColor = ConsoleColor.Blue;
                    Console.WriteLine("**********************Vehicle Selection History**************************");
                    var searches = VehFactory.GetVehicInfos();
                    foreach (var Search in searches)
                    {
                        Console.WriteLine($" Category: {Search.VehCategs}   Make: {Search.Make}   Color: {Search.Cselect}   Model: {Search.Model}   Type: {Search.TypeC} ");
                    }
                    Console.ResetColor();
                    break;
                }

                default:
                    Console.WriteLine("What happened");
                    break;
                }
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            var vehInfo = new VehicInfo();//Create an object to use properties and methods


            Console.WriteLine("Please enter Customer's vehicle requirements");


            while (true)
            {
                Console.Write("Enter Customer Name:  ");
                var cusName = Console.ReadLine();
                var name    = vehInfo.GetCusName(cusName);

                Console.ForegroundColor = ConsoleColor.Yellow;//Color borders_____________________________________________________

                Console.Write("Please select number for catagory:");
                var vehCate = Enum.GetNames(typeof(VehCate));
                for (var i = 0; i < vehCate.Length; i++)
                {
                    Console.Write($" {i + 1}. {vehCate[i]}     ");
                }

                Console.WriteLine();
                Console.Write("You've entered: ");
                var vehCateg  = Convert.ToInt32(Console.ReadLine());
                var vehCategs = (VehCate)Enum.Parse(typeof(VehCate), vehCate[vehCateg - 1]);

                Console.ResetColor(); //Color borders_____________________________________________________


                switch (vehCategs)

                {
                case VehCate.Exit:

                    return;

                case VehCate.Suv:
                {
                    GetVehData(vehCategs, name);        //Database--factory class is processing user data

                    break;
                }

                case VehCate.Sedan:
                {
                    GetVehData(vehCategs, name);
                    break;
                }

                case VehCate.Truck:
                {
                    GetVehData(vehCategs, name);
                    break;
                }

                case VehCate.Print:    // Search customer's requests by Name, if one or more queries have been requested
                {
                    Console.BackgroundColor = ConsoleColor.Blue;
                    Console.WriteLine("**********************Vehicle Selection History for Customer**************************");
                    //Console.WriteLine(vehInfo.CusName);
                    //var name = vehInfo.CusName;

                    //var mCake = vehInfo.VehCategs;
                    //var make = vehInfo.Make;

                    var searches = VehFactory.GetVehicInfos(vehInfo.CusName);
                    foreach (var Search in searches)
                    {
                        //Console.WriteLine("what DA");
                        Console.WriteLine($" Name:  {Search.CusName} Category: {Search.VehCategs}   Make: {Search.Make}   Color: {Search.Color}   Model: {Search.Model}   Type: {Search.TypeC} ");
                    }
                    Console.Write("Enter Customer's Name");
                    var budNewName = Console.ReadLine();
                    vehInfo.GetCusName(budNewName);

                    Console.Write("Enter Customer's New Budget: ");
                    var newBud = Convert.ToDecimal(Console.ReadLine());
                    vehInfo.CusBudget(newBud);

                    VehFactory.BudgetUpdate(budNewName, newBud);

                    var searches1 = VehFactory.GetVehicInfos(budNewName);
                    foreach (var Search in searches1)
                    {
                        //Console.WriteLine("what DA");
                        Console.WriteLine($" Name:  {Search.CusName} Budget: {Search.Budget} Category: {Search.VehCategs}   Make: {Search.Make}   Color: {Search.Color}   Model: {Search.Model}   Type: {Search.TypeC} ");
                    }
                    Console.ResetColor();
                    break;
                }


                case VehCate.All:     //Returns all of the requests by the customers
                    Console.BackgroundColor = ConsoleColor.Blue;
                    Console.WriteLine("**********************Vehicle Selection History**************************");

                    var allSearches = VehFactory.GetVehicInfos();
                    foreach (var Search in allSearches)
                    {
                        //Console.WriteLine("what DA");
                        Console.WriteLine($" Name:  {Search.CusName} Budget: {Search.Budget} Category: {Search.VehCategs}   Make: {Search.Make}   Color: {Search.Color}   Model: {Search.Model}   Type: {Search.TypeC} ");
                    }
                    Console.ResetColor();
                    break;


                    //case VehCate.CusRecord:
                    //    Console.ForegroundColor = ConsoleColor.DarkMagenta;
                    //    Console.WriteLine("**********************Custom Record**************************");
                    //    Console.ResetColor();

                    //    Console.BackgroundColor = ConsoleColor.Blue;


                    //    var csearch = VehFactory.GetVehRelations();

                    //    foreach (var Search in csearch)
                    //    {

                    //        Console.WriteLine($" Name:  {Search.CusName} Category: {Search.Categories}   Date: {Search.CusRecDateTime}   Budget: {Search.Budget:C} ");
                    //    }

                    //    Console.ResetColor();

                    break;


                default:
                    Console.WriteLine("What happened");
                    break;
                }
            }
        }