コード例 #1
0
        public static string GetStateForEdit(string currentState)
        {
            var  input      = "";
            var  Taxmgr     = ManagerFactory.CreateTaxManager();
            bool validState = false;

            do
            {
                Console.WriteLine("Enter a new state or leave blank to keep old value: {0}", currentState);
                input = Console.ReadLine();
                if (!string.IsNullOrEmpty(input))
                {
                    validState = Taxmgr.IsValidState(input);
                    if (!validState)
                    {
                        Console.WriteLine("That state is not currently supported. Please enter a valid state abbreviation.");
                    }
                    else
                    {
                        return(input.ToUpper());
                    }
                }
                else
                {
                    validState = true;
                }
            } while (!validState);
            return(currentState);
        }
コード例 #2
0
        public void GetCustomerState()
        {
            var mgr        = ManagerFactory.CreateTaxManager();
            var validState = false;

            //var userCustomerState = "";
            do
            {
                Console.Write("Please enter the two-character customer state abbreviation: ");
                var userCustomerState = Console.ReadLine();
                _orderToAdd.State = userCustomerState.ToUpper();
                validState        = mgr.IsValidState(_orderToAdd.State);

                if (validState == false)
                {
                    Console.WriteLine("I'm sorry, that state is not currently supported.");
                }
            } while (validState == false);
        }