Пример #1
0
        /// <summary>
        /// User choise
        /// </summary>
        /// <param name="enm"><see cref="Category"/></param>
        public virtual void UserChoise(ref Category enm)
        {
            try
            {
                string result = Console.ReadLine();

                if (Int32.TryParse(result, out int intResult) && intResult == 10)
                {
                    SearchName();
                }
                else if (Int32.TryParse(result, out intResult) && intResult == 0)
                {
                    enterPagePL.Output();
                    enterPagePL.Choise();
                }
                else if (Int32.TryParse(result, out intResult) && intResult > 0 && intResult < 11)
                {
                    ResultedEnumerbale = funcCategoty((Category)(--intResult));
                }
                else
                {
                    UserChoise(ref enm);
                }
            }
            catch
            {
                Console.WriteLine("Wrong choise");
            }
        }
        /// <summary>
        /// Login process
        /// </summary>
        public void LoginProcess()
        {
            Output();
            StartSignIn();

            EnterPagePL enterPageView = new EnterPagePL();

            enterPageView.Output();
            enterPageView.Choise();
        }
        /// <summary>
        /// Registration result
        /// </summary>
        /// <param name="result"></param>
        public void RegistrationResult(bool result)
        {
            if (result)
            {
                Console.WriteLine("User have been regitered");
            }
            else
            {
                Console.WriteLine("User haven't been regitered");
            }

            enterPageView.Output();
            enterPageView.Choise();
        }
        /// <summary>
        /// User choise
        /// </summary>
        /// <param name="enm"><see cref="Category"/></param>
        public void UserChoise(ref Category enm)
        {
            funcCategoty += newOrderController.ChosenCategory;
            formOrder    += newOrderController.FormOrder;
            try
            {
                string result = Console.ReadLine();

                if (Int32.TryParse(result, out int intResult) && intResult == 10)
                {
                    ShowOrderedGoods(ref enm);
                }
                else if (Int32.TryParse(result, out intResult) && intResult == 11)
                {
                    SearchByName();
                    ResultedEnumerbale = new List <IItem>();
                    Console.WriteLine();
                }
                else if (Int32.TryParse(result, out intResult) && intResult == 12)
                {
                    Console.WriteLine("Your final order:");
                    formOrder(order, items);
                    ShowOrderedGoods(ref enm);
                    Console.WriteLine();
                }
                else if (Int32.TryParse(result, out intResult) && intResult == 0)
                {
                    enterPageView.Output();
                    enterPageView.Choise();
                }
                else if (Int32.TryParse(result, out intResult) && intResult > 0 && intResult < 10)
                {
                    ResultedEnumerbale = funcCategoty((Category)(--intResult));
                }
                else
                {
                    Console.WriteLine("Wrong choise");
                    BuyingItems();
                }
            }
            catch
            {
                Console.WriteLine("Wrong choise");
            }
        }
        /// <summary>
        /// Input order
        /// </summary>
        public void InputOrder()
        {
            foreach (var i in getOrders())
            {
                if (isUserRole())
                {
                    if (isUserLogined(i))
                    {
                        OutputUserData(i);
                    }
                }
                else
                {
                    OutputUserData(i);
                }
            }

            Console.ReadKey();
            enterPageView.Output();
            enterPageView.Choise();
        }