Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to our site. Would you like to order or repair?");
            string processOption = Console.ReadLine().ToLower().Trim();
            //PhoneOrderRepair phoneOrderRepair = new PhoneOrderRepair();
            Order           order           = new Order();
            PhoneRepair     phoneRepair     = new PhoneRepair();
            AccessoryRepair accessoryRepair = new AccessoryRepair();
            string          productDetail   = string.Empty;

            switch (processOption)
            {
            case "order":
                Console.WriteLine("Please provide the phone model name");
                productDetail = Console.ReadLine().Trim();
                //phoneOrderRepair.ProcessOrder(productDetail);
                order.ProcessOrder(productDetail);
                break;

            case "repair":
                Console.WriteLine("Is it the phone or the accessory that you want to be repaired?");
                string productType = Console.ReadLine().ToLower();
                if (productType.Equals("phone"))
                {
                    Console.WriteLine("Please provide the phone model name");
                    productDetail = Console.ReadLine().Trim();
                    //phoneOrderRepair.ProcessPhoneRepair(productDetail);
                    phoneRepair.ProcessPhoneRepair(productDetail);
                }
                else
                {
                    Console.WriteLine("Please provide the accessory detail, like headphone, tempered glass");
                    productDetail = Console.ReadLine().Trim();
                    //phoneOrderRepair.ProcessAccessoryRepair(productDetail);
                    accessoryRepair.ProcessAccessoryRepair(productDetail);
                }
                break;

            default:
                break;
            }

            Console.WriteLine("Thanks for choosing us. Have a great day.");

            Console.ReadLine();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Choose Service: Order or Repair");
            string processOption = Console.ReadLine().ToLower().Trim();
            string productDetail;

            switch (processOption)
            {
            case "order":

                Console.WriteLine("Please provide the phone model name");
                productDetail = Console.ReadLine().Trim();
                ProcessPhoneOrder P = new ProcessPhoneOrder();
                P.ProcessOrder(productDetail);
                break;

            case "repair":
                AccessoryRepair  accessory        = new AccessoryRepair();
                PhoneOrderRepair phoneOrderRepair = new PhoneOrderRepair();

                Console.WriteLine("choose: phone or accessory");
                string productType = Console.ReadLine().ToLower();
                if (productType.Equals("phone"))
                {
                    Console.WriteLine("Please provide the phone model name");
                    productDetail = Console.ReadLine().Trim();
                    phoneOrderRepair.ProcessPhoneRepair(productDetail);
                }
                else
                {
                    Console.WriteLine("Please provide the accessory detail");
                    productDetail = Console.ReadLine().Trim();
                    accessory.ProcessAccessoryRepair(productDetail);
                }
                break;

            default:
                break;
            }

            Console.WriteLine("Thanks for choosing us. Have a great day.");
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to our site. Would you like to order or repair?");
            string Option = Console.ReadLine().ToLower().Trim();

            string productDetail;

            switch (Option)
            {
            case "order":
                Console.WriteLine("Please provide the phone model name");
                productDetail = Console.ReadLine().Trim();
                var phoneOrder = new PhoneOrder();
                phoneOrder.ProcessOrder(productDetail);
                break;

            case "repair":
                Console.WriteLine("Is it a phone or an accessory that you want to get repaired?");
                string productType = Console.ReadLine().ToLower();
                if (productType.Equals("phone"))
                {
                    Console.WriteLine("Please provide the phone model name");
                    productDetail = Console.ReadLine().Trim();
                    var phoneRepair = new PhoneRepair();
                    phoneRepair.ProcessPhoneRepair(productDetail);
                }
                else
                {
                    Console.WriteLine("Please provide the accessory detail, like headphone, tempered glass");
                    productDetail = Console.ReadLine().Trim();
                    var accessoryRepair = new AccessoryRepair();
                    accessoryRepair.ProcessAccessoryRepair(productDetail);
                }
                break;

            default:
                break;
            }

            Console.WriteLine("Thank you.");
            Console.ReadKey();
        }