예제 #1
0
        public void Execute()
        {
            OrderManager manager = OrderManagerFactory.Create();
            Order        order   = new Order();

            string   dateInput = SystemIO.OrderDateRequest();
            DateTime orderDate = Convert.ToDateTime(dateInput);

            order.Date = orderDate;

            string input = SystemIO.EditCustName();

            order.CustomerName = input;

            string userInput = SystemIO.EditState();


            FindStateResponse stateResponse = manager.GetStateTax(userInput);

            order.State = userInput;
            if (stateResponse.Success)
            {
                order.TaxData = stateResponse.StateTax.TaxRate;
            }
            else
            {
                stateResponse.Success = false;
            }


            string                  productInput   = SystemIO.EditGetProduct();
            OrderManager            productManager = OrderManagerFactory.Create();
            FindProductTypeResponse findProduct    = productManager.GetProductData(productInput);

            order.ProductType = productInput;
            if (findProduct.Success)
            {
                order.ProductType            = findProduct.Product.ProductType;
                order.CostPerSquareFoot      = findProduct.Product.CostPerSquareFoot;
                order.LaborCostPerSquareFoot = findProduct.Product.LaborCostPerSquareFoot;
            }
            else
            {
                findProduct.Success = false;
            }


            decimal areaInput = SystemIO.EditGetArea();

            order.Area = areaInput;

            manager.SaveNewOrder(order);

            SystemIO.DisplaySingleOrderDetails(order);


            Console.ReadKey();
        }
예제 #2
0
        public FindStateResponse GetStateTax(string state)
        {
            FindStateResponse response = new FindStateResponse();

            response.StateTax = _taxRepo.State(state);

            if (response.StateTax == null)
            {
                response.Success = false;
                response.Message = $"{state} is not valid.";
            }
            else
            {
                response.Success = true;
            }
            return(response);
        }
예제 #3
0
        public void EditState(Order order)
        {
            OrderManager manager = OrderManagerFactory.Create();

            string newState = SystemIO.EditState();

            order.State = newState;
            FindStateResponse response = manager.GetStateTax(newState);

            if (response.Success)
            //edit state issue is in the following potentially
            {
                order.TaxData = response.StateTax.TaxRate;

                manager.SaveExistingOrder(order);
                SystemIO.DisplaySingleOrderDetails(order);
                Console.ReadKey();
                Console.Clear();
            }
            else
            {
                response.Success = false;
            }
        }