Beispiel #1
0
        private string GetEditOrderState(OperationsManager manager, OrderLookupResponse response)
        {
            bool   isCorrectStateFormat = false;
            string userInput            = "";

            do
            {
                Console.Clear();
                Console.WriteLine(pageHeader);
                Console.WriteLine("\n***Edit Order Number {0} for {1}/{2}/{3}***", response.Order.OrderNumber, _orderDate.Substring(0, 2), _orderDate.Substring(2, 2), _orderDate.Substring(4, 4));
                Console.WriteLine("\nIf you wish to edit a field, type in the new information.  If you wish to leave the field unchanged, simply press enter.");

                Console.WriteLine("\nCustomer Name ({0}): {1}", response.Order.CustomerName, nameInput);
                Console.Write("State ({0}): ", response.Order.State);
                userInput = Console.ReadLine();



                if (manager.CheckAddState(userInput).Success || userInput == "")
                {
                    isCorrectStateFormat = true;
                }
                else
                {
                    isCorrectStateFormat = false;
                    Console.WriteLine();
                    Console.WriteLine(manager.CheckAddState(userInput).Message);
                    Console.Write(ConsoleIO.anyKey);
                    Console.ReadKey();
                }
            } while (!isCorrectStateFormat);

            return(userInput);
        }
Beispiel #2
0
        public void CanCheckAddState(string stateAbbreviation, bool expectedResult)
        {
            OperationsManager manager = RepoFactory.CreateOrderRepo("");

            AddOrderResponse response = manager.CheckAddState(stateAbbreviation);

            Assert.AreEqual(expectedResult, response.Success);
        }
Beispiel #3
0
        private string GetOrderState(OperationsManager manager)
        {
            string stateInput      = "";
            bool   isStateWeSellTo = false;

            do
            {
                Console.Clear();
                Console.WriteLine(pageHeader);
                Console.WriteLine();
                Console.WriteLine(promptForOrderDetails);
                Console.WriteLine("\nCustomer Name: {0}", _customerName);
                Console.Write("State (2-letter abbreviation): ");

                stateInput = Console.ReadLine().ToUpper();

                AddOrderResponse stateResponse = new AddOrderResponse();

                stateResponse = manager.CheckAddState(stateInput);

                if (stateResponse.Success == false)
                {
                    isStateWeSellTo = false;
                    Console.WriteLine();
                    Console.WriteLine(stateResponse.Message);
                    Console.WriteLine();
                    Console.Write(ConsoleIO.anyKey);
                    Console.ReadKey();
                }
                else
                {
                    isStateWeSellTo = true;
                }
            } while (isStateWeSellTo == false);

            return(stateInput);
        }