/// <summary>
        /// prompts the user to save account and travel log
        /// </summary>
        /// <param name="salesperson"></param>
        /// <param name="maxAttemptsExceeded"></param>
        /// <returns></returns>
        public bool DisplaySaveAccountInfo(Salesperson salesperson, out bool maxAttemptsExceeded)
        {
            string userResponse;

            maxAttemptsExceeded = false;

            ConsoleUtil.HeaderText = "Save Account";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("The current account information.");
            DisplayAccountDetail(salesperson);

            ConsoleUtil.DisplayMessage("");
            userResponse = ConsoleValidator.GetYesNoFromUser(MAXIMUM_ATTEMPTS, "Save the account information?", out maxAttemptsExceeded);

            if (maxAttemptsExceeded)
            {
                ConsoleUtil.DisplayMessage("It appears you are having difficulties. You will return to the main menu.");
                return(false);
            }
            else
            {
                // note use of ternary operator (takes three arguments)
                return(userResponse == "YES" ? true : false);
            }
        }
Пример #2
0
        /// <summary>
        /// load account information
        /// </summary>
        private void DisplayLoadAccountInfo()
        {
            bool maxAttemptsExceeded = false;
            bool loadAccountInfo     = false;

            //
            // note: rather than pass null value, method is overloaded
            //
            if (_salesperson.AccountID != "")
            {
                loadAccountInfo = _consoleView.DisplayLoadAccountInfo(_salesperson, out maxAttemptsExceeded);
            }
            else
            {
                loadAccountInfo = _consoleView.DisplayLoadAccountInfo(out maxAttemptsExceeded);
            }
            if (loadAccountInfo && !maxAttemptsExceeded)
            {
                XmlServices xmlServices = new XmlServices(DataSettings.dataFilePathXml);

                _salesperson = xmlServices.ReadSalespersonFromDataFile();

                _consoleView.DisplayConfirmLoadAccountInfo(_salesperson);
            }
        }
        /// <summary>
        /// Get type of product from user. Checks if product already exist in invetory
        /// </summary>
        /// <param name="salesperson"></param>
        /// <param name="notInStock"></param>
        /// <returns></returns>
        public Product.ProductType GetTypeOfProduct(Salesperson salesperson, string buyOrSell, out bool inStock)
        {
            Product.ProductType productType;
            inStock = false;

            ConsoleUtil.DisplayPromptMessage("Enter the type of product you wish to " + buyOrSell + ":");

            // new variable for product type
            if (Enum.TryParse <Product.ProductType>(UppercaseFirst(Console.ReadLine()), out productType))
            {
                foreach (Product product in salesperson.CurrentStock)
                {
                    if (product.Type == productType)
                    {
                        inStock = true;
                    }
                }
            }
            else
            {
                // sets type of current stock to "none" product type
                ConsoleUtil.DisplayMessage("It appears you are having difficulty selecting a product.");
                ConsoleUtil.DisplayMessage("By default, no items will be added.");

                productType = Product.ProductType.None;

                DisplayContinuePrompt();
            }

            return(productType);
        }
Пример #4
0
        /// <summary>
        /// setup the new salesperson object with the initial data
        /// Note: To maintain the pattern of only the Controller changing the data this method should
        ///       return a Salesperson object with the initial data to the controller. For simplicity in
        ///       this demo, the ConsoleView object is allowed to access the Salesperson object's properties.
        /// </summary>
        public Salesperson DisplaySetupAccount()
        {
            Salesperson salesperson = new Salesperson();

            ConsoleUtil.HeaderText = "Account Setup";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Setup your account now.");
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayPromptMessage("Enter your first name: ");
            salesperson.FirstName = Console.ReadLine();
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayPromptMessage("Enter your last name: ");
            salesperson.LastName = Console.ReadLine();
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayPromptMessage("Enter your account ID: ");
            salesperson.AccountID = Console.ReadLine();
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Your account is setup");

            DisplayContinuePrompt();

            return(salesperson);
        }
Пример #5
0
        /// <summary>
        /// calls the method to display load account info from the ConsoleView and
        /// reads salesperson and travel log infor from data file
        /// </summary>
        private void DisplayLoadAcoountInfo()
        {
            bool maxAttemptsExceeded = false;
            bool loadAccountInfo     = false;

            // the DisplayLoadAccountInfo method is overloaded so a null value is not passed
            // the if/else checks to see of there is an account ID
            if (_salesperson.AccountID != "")
            {
                loadAccountInfo = _consoleView.DisplayLoadAccountInfo(_salesperson, out maxAttemptsExceeded);
            }
            else
            {
                loadAccountInfo = _consoleView.DisplayLoadAccountInfo(out maxAttemptsExceeded);
            }

            if (loadAccountInfo && !maxAttemptsExceeded)
            {
                XmlServices xmlServices = new XmlServices(DataSettings.dataFilePathXml);

                _salesperson = xmlServices.ReadSalespersonFromDataFile();

                _consoleView.DisplayConfirmLoadAccountInfo(_salesperson);
            }
        }
Пример #6
0
        /// <summary>
        /// setup new user account
        /// </summary>
        private City SetupAccount()
        {
            _salesperson = _consoleView.DisplaySetupAccount(out City city);

            // method returns a new city object
            return(city);
        }
Пример #7
0
        /// <summary>
        /// display confirmation that a salesperson account was successfully loaded
        /// </summary>
        public bool DisplayLoadAccountInfo(Salesperson salesperson, out bool maxAttemptsExceeded)
        {
            string userResponse;

            maxAttemptsExceeded = false;

            ConsoleUtil.HeaderText = "Load Account";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("");
            userResponse = ConsoleValidator.GetYesNoFromUser(MAXIMUM_ATTEMPTS,
                                                             "Load the account information?", out maxAttemptsExceeded);

            if (maxAttemptsExceeded)
            {
                ConsoleUtil.DisplayMessage("It appears you are having difficulty.  You will " +
                                           "return to the main menu.");
                return(false);
            }
            else
            {
                //
                // note use of ternary operator
                //
                return(userResponse == "YES" ? true : false);
            }
        }
        /// <summary>
        /// setup the new salesperson object with the initial data
        /// </summary>
        public Salesperson DisplaySetupAccount(out City city)
        {
            // instantiate a new salesperson object
            Salesperson salesperson = new Salesperson();

            // instantiayte a new city object
            city           = new City();
            city.SalesInfo = new List <Product>();

            ConsoleUtil.HeaderText = "Account Setup";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Setup your account now.");
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayPromptMessage("Enter your first name: ");
            salesperson.FirstName = Console.ReadLine();
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayPromptMessage("Enter your last name: ");
            salesperson.LastName = Console.ReadLine();
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayPromptMessage("Enter your account ID: ");
            salesperson.AccountID = Console.ReadLine();
            ConsoleUtil.DisplayMessage("");

            ConsoleUtil.DisplayPromptMessage("Enter your starting city: ");
            city.CityName = Console.ReadLine();

            // get products from user
            DisplayAvailableProducts();
            ConsoleUtil.DisplayMessage("");

            salesperson.CurrentStock = DisplayGetProducts(salesperson);


            foreach (Product item in salesperson.CurrentStock)
            {
                city.SalesInfo.Add(new Product(item.Type, item.NumberOfUnits, 0));
            }

            // add city object to salesperson
            salesperson.CitiesVisited.Add(city);

            ConsoleUtil.DisplayMessage("Your account is setup");
            ConsoleUtil.DisplayMessage("");

            // display account details to user
            DisplayAccountDetail(salesperson);
            ConsoleUtil.DisplayMessage("Starting city: " + city.CityName);
            ConsoleUtil.DisplayMessage("Your current inventory:");
            ConsoleUtil.DisplayMessage("");
            CurrentInventory(salesperson);

            DisplayContinuePrompt();

            return(salesperson);
        }
        /// <summary>
        /// display the current account information
        /// </summary>
        public void DisplayAccountInfo(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Account Information";
            ConsoleUtil.DisplayReset();

            DisplayAccountDetail(salesperson);

            DisplayContinuePrompt();
        }
Пример #10
0
        /// <summary>
        /// method to manage the application setup and control loop
        /// </summary>
        private void ManageApplicationLoop()
        {
            MenuOption userMenuChoice;

            _consoleView.DisplayWelcomeScreen();

            //
            // setup initial salesperson account
            //
            _salesperson = _consoleView.DisplaySetupAccount();

            //
            // application loop
            //
            while (_usingApplication)
            {
                //
                // get a menu choice from the ConsoleView object
                //
                userMenuChoice = _consoleView.DisplayGetUserMenuChoice();

                //
                // choose an action based on the user's menu choice
                //
                switch (userMenuChoice)
                {
                case MenuOption.None:
                    break;

                case MenuOption.Travel:
                    Travel();
                    break;

                case MenuOption.DisplayCities:
                    DisplayCities();
                    break;

                case MenuOption.DisplayAccountInfo:
                    DisplayAccountInfo();
                    break;

                case MenuOption.Exit:
                    _usingApplication = false;
                    break;

                default:
                    break;
                }
            }

            _consoleView.DisplayClosingScreen();

            //
            // close the application
            //
            Environment.Exit(1);
        }
        /// <summary>
        /// displays the current inventory to the user
        /// </summary>
        /// <param name="product"></param>
        public void DisplayInventory(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Current Inventory";
            ConsoleUtil.DisplayReset();

            // calls method to display inventory
            CurrentInventory(salesperson);

            DisplayContinuePrompt();
        }
Пример #12
0
        /// <summary>
        /// Write Salesperson account to Data File
        /// </summary>
        /// <param name="salesperson"></param>
        public void WriteSalespersonToDataFile(Salesperson salesperson)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Salesperson));

            StreamWriter sWriter = new StreamWriter(_dataFilePath); //Data File = Data.xml

            using (sWriter)
            {
                serializer.Serialize(sWriter, salesperson);
            }
        }
        /// <summary>
        /// notifies user of a successful load of the account and travel log info,
        /// and displays the loaded info
        /// </summary>
        /// <param name="salesperson"></param>
        public void DisplayConfirmLoadAccountInfo(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Load Account Information";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Account information loaded sucessfully.");

            DisplayAccountDetail(salesperson);

            DisplayContinuePrompt();
        }
Пример #14
0
        /// <summary>
        /// display the current account information
        /// </summary>
        public void DisplayAccountInfo(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Account Info";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("First Name: " + salesperson.FirstName);
            ConsoleUtil.DisplayMessage("Last Name: " + salesperson.LastName);
            ConsoleUtil.DisplayMessage("Account ID: " + salesperson.AccountID);

            DisplayContinuePrompt();
        }
 /// <summary>
 /// loops through and displays the current inventory
 /// </summary>
 /// <param name="salesperson"></param>
 public void CurrentInventory(Salesperson salesperson)
 {
     foreach (Product item in salesperson.CurrentStock)
     {
         if (item.Type != Product.ProductType.None)
         {
             ConsoleUtil.DisplayMessage("Product type: " + item.Type.ToString());
             ConsoleUtil.DisplayMessage("Number of units: " + item.NumberOfUnits.ToString());
             ConsoleUtil.DisplayMessage("");
         }
     }
 }
Пример #16
0
        /// <summary>
        /// display a list of the cities traveled
        /// </summary>
        public void DisplayCitiesTraveled(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Cities Visited";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Cities Visited:");
            Console.WriteLine();
            foreach (var city in salesperson.CitiesVisited)
            {
                ConsoleUtil.DisplayMessage(city);
            }
            DisplayContinuePrompt();
        }
Пример #17
0
        /// <summary>
        /// get the next city to travel to from the user
        /// </summary>
        /// <returns>string nextCity</returns>
        public string DisplayGetNextCity(Salesperson salesperson)
        {
            string nextCity = "";

            ConsoleUtil.HeaderText = "Travel";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayPromptMessage("Where would you like to travel to?");
            salesperson.CitiesVisited.Add(Console.ReadLine());


            return(nextCity);
        }
Пример #18
0
        /// <summary>
        /// display a list of the cities traveled
        /// </summary>
        public void DisplayCitiesTraveled(Salesperson salesperson)
        {
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("You have traveled to the following cities.");
            ConsoleUtil.DisplayMessage("");

            foreach (string city in salesperson.CitiesVisited)
            {
                ConsoleUtil.DisplayMessage(city);
            }

            DisplayContinuePrompt();
        }
        /// <summary>
        /// create a dummy Salesperson
        /// </summary>
        /// <returns>Salesperson</returns>
        private static Salesperson InitializeSalesperson()
        {
            Salesperson salesperson = new Salesperson()
            {
                FirstName     = "Charles",
                LastName      = "Koop",
                CurrentStock  = new Product(Product.ProductType.Spotted, 20, false),
                CitiesVisited = new List <string>()
                {
                    "Detroit",
                    "Grand Rapids",
                    "Traverse City"
                }
            };

            return(salesperson);
        }
Пример #20
0
        /// <summary>
        /// save a Salesperson to the persistent data file
        /// </summary>
        /// <param name="salesperson"></param>
        public void WriteSalespersonToDataFile(Salesperson salesperson)
        {
            if (salesperson.FirstName == null & salesperson.LastName == null)
            {
                InitializeDataFileXml.SeedDataFile();
            }
            else
            {
                XmlSerializer serializer = new XmlSerializer(typeof(Salesperson), new XmlRootAttribute("Salesperson"));

                StreamWriter sWriter = new StreamWriter(_dataFilePath);

                using (sWriter)
                {
                    serializer.Serialize(sWriter, salesperson);
                }
            }
        }
Пример #21
0
        /// <summary>
        /// retrieve a Salesperson from the persistent data file
        /// </summary>
        /// <returns>Salesperson</returns>
        public Salesperson ReadSalespersonFromDataFile()
        {
            Salesperson salesperson = new Salesperson();

            // initialize a FileStream object for reading
            StreamReader sReader = new StreamReader(_dataFilePath);

            // initialize an XML serializer object
            XmlSerializer deserializer = new XmlSerializer(typeof(Salesperson));

            using (sReader)
            {
                object xmlObject = deserializer.Deserialize(sReader);
                Console.WriteLine(xmlObject);
                salesperson = (Salesperson)xmlObject;
            }

            return(salesperson);
        }
        //
        // declare ConsoleView and Salesperson objects for the Controller to use
        // Note: There is no need for a Salesperson or ConsoleView property given only the Controller
        //       will access the ConsoleView object and will pass the Salesperson object to the ConsoleView.
        //


        #endregion

        #region PROPERTIES


        #endregion

        #region CONSTRUCTORS

        public Controller()
        {
            InitializeController();

            //
            // instantiate a Salesperson object
            //
            _salesperson = new Salesperson();

            //
            // instantiate a ConsoleView object
            //
            _consoleView = new ConsoleView();

            //
            // begins running the application UI
            //
            ManageApplicationLoop();
        }
Пример #23
0
        private Salesperson InitializeSalesperson()
        {
            Salesperson salesperson = new Salesperson()
            {
                FirstName    = "Madeleine",
                LastName     = "Woodbury",
                AccountID    = "123",
                CurrentStock = new List <Product>()
                {
                    new Product(Product.ProductType.Bike, 100, false)
                },
                CitiesVisited = new List <City>()
                {
                    new City("Oslo")
                }
            };


            return(salesperson);
        }
        /// <summary>
        /// Display sell products
        /// </summary>
        /// <param name="salesperson"></param>
        /// <returns></returns>
        public Product.ProductType DisplaySellProducts(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Sell Inventory";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("Your current inventory:");
            ConsoleUtil.DisplayMessage("");
            CurrentInventory(salesperson);

            Product.ProductType productType = GetTypeOfProduct(salesperson, "sell", out bool inStock);

            if (!inStock)
            {
                ConsoleUtil.DisplayMessage("This product does not exist in your inventory.");

                DisplayContinuePrompt();
            }

            return(productType);
        }
        /// <summary>
        /// Display buy new products and add to the salesperson
        /// </summary>
        /// <param name="salesperson"></param>
        /// <returns></returns>
        public Product.ProductType DisplayBuyNewProducts(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Buy New Products";
            ConsoleUtil.DisplayReset();

            DisplayAvailableProducts();

            Product.ProductType productType = GetTypeOfProduct(salesperson, "buy", out bool inStock);

            // if the product already exist in the inventory, the return will be set to none
            if (inStock)
            {
                productType = Product.ProductType.None;
                ConsoleUtil.DisplayMessage("This product already exist in your inventory.");

                DisplayContinuePrompt();
            }


            return(productType);
        }
        /// <summary>
        /// setup the new salesperson object with the initial data
        /// Note: To maintain the pattern of only the Controller changing the data this method should
        ///       return a Salesperson object with the initial data to the controller. For simplicity in
        ///       this demo, the ConsoleView object is allowed to access the Salesperson object's properties.
        /// </summary>
        public Salesperson DisplaySetupAccount()
        {
            Salesperson salesperson = new Salesperson();

            ConsoleUtil.HeaderText = "Account Setup";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayPromptMessage("First Name:");
            salesperson.FirstName = Console.ReadLine();

            ConsoleUtil.DisplayPromptMessage("Last Name:", 2);
            salesperson.LastName = Console.ReadLine();

            ConsoleUtil.DisplayPromptMessage("Account ID:");
            salesperson.AccountID = Console.ReadLine();

            ConsoleUtil.DisplayPromptMessage("City: ");
            salesperson.CitiesVisited.Add(Console.ReadLine());


            return(salesperson);
        }
        /// <summary>
        /// display a list of the cities traveled
        /// </summary>
        public void DisplayCitiesTraveled(Salesperson salesperson)
        {
            ConsoleUtil.HeaderText = "Travel Log";
            ConsoleUtil.DisplayReset();

            ConsoleUtil.DisplayMessage("You have traveled to the following cities:");
            ConsoleUtil.DisplayMessage("");

            foreach (City city in salesperson.CitiesVisited)
            {
                ConsoleUtil.DisplayMessage("City: " + city.CityName.ToUpper());
                foreach (Product product in city.SalesInfo)
                {
                    ConsoleUtil.DisplayMessage("\tProduct Type: " + product.Type.ToString());
                    ConsoleUtil.DisplayMessage("\tUnits Bought: " + product.ProductsBought.ToString());
                    ConsoleUtil.DisplayMessage("\tUnits Sold: " + product.ProductsSold.ToString());
                    ConsoleUtil.DisplayMessage("");
                }
                ConsoleUtil.DisplayMessage("");
            }


            DisplayContinuePrompt();
        }
        /// <summary>
        /// method displays menu system that allow the user to update account info of their choosing
        /// </summary>
        /// <param name="salesperson"></param>
        /// <returns></returns>
        public Salesperson DisplayUpdateAccount(Salesperson salesperson)
        {
            bool usingMenu = true;

            ConsoleUtil.HeaderText = "Update Account";
            ConsoleUtil.DisplayReset();

            while (usingMenu)
            {
                // display account details to user
                DisplayAccountDetail(salesperson);

                ConsoleUtil.DisplayMessage("");
                ConsoleUtil.DisplayMessage("Type the number for which info you wish to update: ");
                ConsoleUtil.DisplayMessage("");
                Console.Write(
                    "\t" + "1. First Name" + Environment.NewLine +
                    "\t" + "2. Last Name" + Environment.NewLine +
                    "\t" + "3. Account ID" + Environment.NewLine +
                    "\t" + "E. Main Menu" + Environment.NewLine);

                //
                // get and process the user's response
                ConsoleKeyInfo userResponse = Console.ReadKey(true);
                switch (userResponse.KeyChar)
                {
                case '1':
                    ConsoleUtil.DisplayReset();
                    ConsoleUtil.DisplayMessage("");
                    ConsoleUtil.DisplayPromptMessage("Update your first name:");
                    salesperson.FirstName = Console.ReadLine();
                    ConsoleUtil.DisplayReset();
                    break;

                case '2':
                    ConsoleUtil.DisplayReset();
                    ConsoleUtil.DisplayMessage("");
                    ConsoleUtil.DisplayPromptMessage("Update your last name:");
                    salesperson.LastName = Console.ReadLine();
                    ConsoleUtil.DisplayReset();
                    break;

                case '3':
                    ConsoleUtil.DisplayReset();
                    ConsoleUtil.DisplayMessage("");
                    ConsoleUtil.DisplayPromptMessage("Update your account ID name:");
                    salesperson.AccountID = Console.ReadLine();
                    ConsoleUtil.DisplayReset();
                    break;

                case 'E':
                case 'e':
                    usingMenu = false;
                    break;

                default:
                    ConsoleUtil.DisplayMessage(
                        "It appears you have selected an incorrect choice." + Environment.NewLine +
                        "Press any key to return to continue");
                    userResponse = Console.ReadKey(true);
                    break;
                }
            }

            DisplayContinuePrompt();

            return(salesperson);
        }
        /// <summary>
        /// method to manage the application setup and control loop
        /// </summary>
        private void ManageApplicationLoop()
        {
            MenuOption userMenuChoice;

            _consoleView.DisplayWelcomeScreen();

            //
            // setup initial salesperson account
            //
            _salesperson = _consoleView.DisplaySetupAccount();

            //
            //
            // application loope
            //
            while (_usingApplication)
            {
                //
                // get a menu choice from the user
                //
                userMenuChoice = _consoleView.DisplayGetUserMenuChoice();

                //
                // choose an action based on the user menu choice
                //
                switch (userMenuChoice)
                {
                case MenuOption.None:
                {
                    break;
                }

                case MenuOption.Travel:
                {
                    Travel();
                    break;
                }

                case MenuOption.Buy:
                {
                    Buy();
                    break;
                }

                case MenuOption.Sell:
                {
                    Sell();
                    break;
                }

                case MenuOption.DisplayInventory:
                {
                    DisplayInventory();
                    break;
                }

                case MenuOption.DisplayCities:
                {
                    DisplayCities();
                    break;
                }

                case MenuOption.DisplayAccountInfo:
                {
                    DisplayAccountInfo();
                    break;
                }

                case MenuOption.Exit:
                {
                    _consoleView.DisplayExitPrompt();
                    break;
                }

                default:
                {
                    break;
                }
                }
            }
            // close the application
            //
            Environment.Exit(1);
        }
        /// <summary>
        /// This methods prompts the user for products and adds them to the list
        /// </summary>
        /// <param name="salesperson"></param>
        /// <returns></returns>
        public List <Product> DisplayGetProducts(Salesperson salesperson)
        {
            // initialize new list of products
            salesperson.CurrentStock = new List <Product>();

            bool   keepAdding = true;
            string userResponse;
            bool   maxAttemptsExceeded = false;

            Product.ProductType productType;

            while (keepAdding)
            {
                productType = GetTypeOfProduct(salesperson, "add", out bool notInStock);

                // checks to see if product already exist in inventory or is set to type none
                if (!notInStock && productType != Product.ProductType.None)
                {
                    // get number of products
                    if (ConsoleValidator.TryGetIntegerFromUser(MINIMUM_BUYSELL_AMOUNT, MAXIMUM_BUYSELL_AMOUNT, MAXIMUM_ATTEMPTS, productType.ToString(), out int numberOfUnits))
                    {
                        // add product to current stock list
                        salesperson.CurrentStock.Add(new Product(productType, numberOfUnits, false));

                        userResponse = ConsoleValidator.GetYesNoFromUser(MAXIMUM_ATTEMPTS, "Do you wish to continue adding products?", out maxAttemptsExceeded);
                        ConsoleUtil.DisplayReset();

                        if (maxAttemptsExceeded || userResponse == "NO")
                        {
                            // exit the while loop
                            keepAdding = false;
                        }
                        else
                        {
                            //display available products to user
                            DisplayAvailableProducts();
                            ConsoleUtil.DisplayMessage("");
                        }
                    }
                    else
                    {
                        ConsoleUtil.DisplayMessage("It appears you are having difficulty setting the number of products in your stock.");
                        ConsoleUtil.DisplayMessage("By default, the number of products in your inventory are now set to 0.");

                        // add product to current stock list with default number of units set to 0
                        salesperson.CurrentStock.Add(new Product(productType, 0, false));

                        userResponse = ConsoleValidator.GetYesNoFromUser(MAXIMUM_ATTEMPTS, "Do you wish to continue adding products?", out maxAttemptsExceeded);
                        ConsoleUtil.DisplayReset();

                        if (maxAttemptsExceeded || userResponse == "NO")
                        {
                            // exit the while loop
                            keepAdding = false;
                        }
                        else
                        {
                            //display available products to user
                            DisplayAvailableProducts();
                            ConsoleUtil.DisplayMessage("");
                        }
                    }
                }
                else
                {
                    ConsoleUtil.DisplayMessage(productType.ToString() + " already exist in your inventory.");

                    userResponse = ConsoleValidator.GetYesNoFromUser(MAXIMUM_ATTEMPTS, "Do you wish to continue adding products?", out maxAttemptsExceeded);
                    ConsoleUtil.DisplayReset();

                    if (maxAttemptsExceeded || userResponse == "NO")
                    {
                        // exit the while loop
                        keepAdding = false;
                    }
                    else
                    {
                        //display available products to user
                        DisplayAvailableProducts();
                        ConsoleUtil.DisplayMessage("");
                    }
                }

                if (productType == Product.ProductType.None)
                {
                    salesperson.CurrentStock.Add(new Product(Product.ProductType.None, 0, false));

                    // exit while loop
                    keepAdding = false;
                }
            }

            return(salesperson.CurrentStock);
        }