Example #1
0
        static void Main(string[] args)
        {
            PopulateDb();

            while (true)
            {
                var         choice             = new UIServices();
                var         UserChoiseCategory = choice.UserChoiceCategory();
                List <Item> products           = new List <Item>();

                User      nikola    = new User("Nikola");
                Publisher publisher = new Publisher();

                if (UserChoiseCategory == 1)
                {
                    products.AddRange(Db.Parts);
                }
                else if (UserChoiseCategory == 2)
                {
                    products.AddRange(Db.Modules);
                }
                else if (UserChoiseCategory == 3)
                {
                    products.AddRange(Db.Configurations);
                }

                while (true)
                {
                    var filterChoise = choice.UserChoiceFilter();
                    if (filterChoise == 1)
                    {
                        while (true)
                        {
                            choice.ShowProducts(products);
                            var userContinue = choice.UserContinueShopingAction();
                            if (userContinue == 1)
                            {
                                continue;
                            }
                            else if (userContinue == 2)
                            {
                                break;
                            }
                            else if (userContinue == 3)
                            {
                                ShoppingCart.ShowUserProducts();
                                Console.ReadLine();
                                int choice1 = choice.UserShopingChartAction();
                                if (choice1 == 1)
                                {
                                    string message = ShoppingCart.ShowProductPrices();
                                    // Console.WriteLine(ShoppingCart.ShowProductPrices());
                                    Console.ReadLine();
                                    choice.SendEventMenu(message, nikola, publisher);
                                    Console.ReadLine();
                                }

                                break;
                            }
                        }
                    }
                    else if (filterChoise == 2)
                    {
                        while (true)
                        {
                            choice.FilterByPrice(products);
                            var userContinue = choice.UserContinueShopingAction();
                            if (userContinue == 1)
                            {
                                continue;
                            }
                            else if (userContinue == 2)
                            {
                                break;
                            }
                            else if (userContinue == 3)
                            {
                                ShoppingCart.ShowUserProducts();

                                Console.ReadLine();
                                Console.Clear();
                                int choice1 = choice.UserShopingChartAction();
                                if (choice1 == 1)
                                {
                                    string message = ShoppingCart.ShowProductPrices();
                                    //Console.WriteLine(ShoppingCart.ShowProductPrices());
                                    Console.ReadLine();
                                    choice.SendEventMenu(message, nikola, publisher);
                                    Console.ReadLine();
                                }

                                break;
                            }
                        }
                    }
                    else if (filterChoise == 3)
                    {
                        while (true)
                        {
                            if (UserChoiseCategory == 1)
                            {
                                choice.FilterByType(Db.Parts);
                            }
                            else if (UserChoiseCategory == 2)
                            {
                                choice.filterByTypeModules(Db.Modules);
                            }
                            else if (UserChoiseCategory == 3)
                            {
                                choice.filterByTypeConfigurations(Db.Configurations);
                            }

                            var userContinue = choice.UserContinueShopingAction();
                            if (userContinue == 1)
                            {
                                continue;
                            }
                            else if (userContinue == 2)
                            {
                                break;
                            }
                            else if (userContinue == 3)
                            {
                                ShoppingCart.ShowUserProducts();
                                Console.ReadLine();
                                int choice1 = choice.UserShopingChartAction();
                                if (choice1 == 1)
                                {
                                    string message = ShoppingCart.ShowProductPrices();
                                    // Console.WriteLine(ShoppingCart.ShowProductPrices());
                                    Console.ReadLine();
                                    choice.SendEventMenu(message, nikola, publisher);
                                    Console.ReadLine();
                                }

                                break;
                            }
                        }
                    }
                    break;
                }
            }
        }