示例#1
0
        private void DisplayAllProducts()
        {
            var            mgr      = ManagerFactory.CreateProductManagr();
            List <Product> ProdList = mgr.ListAllProducts();

            Console.WriteLine("Current SWC Corp Products:");
            Console.WriteLine("=========================");
            foreach (var element in ProdList)
            {
                Console.WriteLine("Product Type: {0}", element.ProductType);
                Console.WriteLine("Cost Per Square Foot: $" + element.CostPerSquareFoot);
            }
            Console.WriteLine("Press enter to continue.");
            Console.ReadKey();
        }
示例#2
0
        public void GetProductType()
        {
            var mgr             = ManagerFactory.CreateProductManagr();
            var validProduct    = false;
            var userProductType = "";

            do
            {
                Console.Write("Please enter a product type: ");
                userProductType         = Console.ReadLine();//.Substring(0, 1).ToUpper().Substring(1).ToLower();
                _orderToAdd.ProductType = userProductType.Substring(0, 1).ToUpper() + userProductType.Substring(1).ToLower();
                validProduct            = mgr.IsValidProduct(_orderToAdd.ProductType);
                if (validProduct == false)
                {
                    Console.WriteLine("I'm sorry, that is not a valid product. Please select again.");
                }
            } while (validProduct == false);
        }
示例#3
0
        public static string GetProductTypeForEdit(string currentProductType)
        {
            var input        = "";
            var validProduct = false;

            do
            {
                var mgr             = ManagerFactory.CreateProductManagr();
                var userProductType = "";
                Console.WriteLine("Enter a new product type or leave blank to keep old one: {0}", currentProductType);
                input = Console.ReadLine();


                if (!string.IsNullOrEmpty(input))
                {
                    if (input.Contains(","))
                    {
                        Console.WriteLine("That was an invalid entry. Press enter to continue.");
                    }
                    else if (input.Length > 2 && !input.Contains(","))
                    {
                        input        = input.Substring(0, 1).ToUpper() + input.Substring(1).ToLower();
                        validProduct = mgr.IsValidProduct(input);
                        if (validProduct)
                        {
                            return(input);
                        }
                        else
                        {
                            Console.WriteLine("That was an invalid entry. Press enter to continue.");
                            Console.ReadLine();
                        }
                    }
                }
                else
                {
                    validProduct = true;
                }
            } while (!validProduct || input.Contains(","));
            return(currentProductType);
        }
示例#4
0
        public void Execute()
        {
            Console.Clear();
            var mgr = ManagerFactory.CreateProductManagr();

            mgr.ListAllProducts();

            var orderOps = new OrderOperations();

            DisplayAllProducts();
            GetCustomerName();
            GetCustomerState();
            GetProductType();
            GetArea();
            Order orderToAdd = orderOps.NewOrderCalculations(_orderToAdd);

            PrintOrderDetails(orderToAdd);

            Console.ReadLine();
            OrderToConfirm(orderToAdd);

            Console.ReadLine();
        }