Пример #1
0
        static void ActionAdmin(int id_Custemer)
        {
            User ADMIN = new User();

            ADMIN.Isadmin = true;
            int choose = -1;

            while (choose != 0)
            {
                Console.WriteLine("Please seclect of option: ");
                Console.WriteLine("1. Account processing");
                Console.WriteLine("2. Manage orders");
                Console.WriteLine("3. Manage all items in the store");
                Console.WriteLine("4. Logout\n");
                choose = Management.CreateInteger("choose", 1, 12);
                switch (choose)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine("        Account processing");
                    Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                    int seclect = -1;
                    while (seclect != 5)
                    {
                        Console.WriteLine("1. Create new Admin");
                        Console.WriteLine("2. Create new User ");
                        Console.WriteLine("3. Change Password");
                        Console.WriteLine("4. Show accounts");
                        Console.WriteLine("5. Exit");
                        seclect = Management.CreateInteger("seclect", 1, 5);
                        switch (seclect)
                        {
                        case 1:
                            Console.Clear();
                            Console.WriteLine("       Create new Admin");
                            Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                            Method.Create_Admin(ADMIN);
                            break;

                        case 2:
                            Console.Clear();
                            Console.WriteLine("       Create new User");
                            Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                            Method.Create_User(ADMIN);
                            break;

                        case 3:
                            int i;
                            Console.Clear();
                            Console.WriteLine("      Change password");
                            Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                            Console.Write("Enter the account name to change the password: "******"Not found account!");
                            }
                            break;

                        case 4:
                            Console.Clear();
                            Console.WriteLine("       Show all accounts");
                            Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                            Method.ShowAccounts();
                            break;

                        case 5:
                            Console.Clear();
                            ActionAdmin(id_Custemer);
                            break;
                        }
                    }
                    break;

                case 2:
                    Console.Clear();
                    Console.WriteLine("       Manage orders");
                    Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                    int seclect1 = -1;
                    while (seclect1 != 7)
                    {
                        Console.WriteLine("1. Show information of Custumer");
                        Console.WriteLine("2. View all orders ");
                        Console.WriteLine("3. Search for an order by orderId");
                        Console.WriteLine("4. Search for orders by Customer Name");
                        Console.WriteLine("5. Create orders for customers");
                        Console.WriteLine("6. Update orders according to order codes");
                        Console.WriteLine("7. Pay order");
                        Console.WriteLine("8. Exit");
                        seclect1 = Management.CreateInteger("seclect", 1, 8);
                        Console.Clear();
                        switch (seclect1)
                        {
                        case 1:
                            Console.WriteLine("      Show information of Custumer");
                            Console.WriteLine("  - - - - - - - - - - - - - - - - - -  \n");
                            Method.ShowInformationCustumer();
                            break;

                        case 2:
                            Console.WriteLine("       View all orders");
                            Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                            Method.ViewAllOrders();
                            break;

                        case 3:
                            Console.WriteLine("      Search for an order by orderId");
                            Console.WriteLine("  - - - - - - - - - - - - - - - - - - - - - \n");
                            int idorder = Management.CreateInteger("id of Order", 1);
                            Method.Find_Order_byIdOrder(idorder);
                            break;

                        case 4:
                            Console.WriteLine("      Search for orders by Customer Name");
                            Console.WriteLine("  - - - - - - - - - - - - - - - - - - - - -  \n");
                            Method.Find_Order_By_NameCustumer();
                            break;

                        case 5:
                            Console.WriteLine("      Create orders for customers");
                            Console.WriteLine("  - - - - - - - - - - - - - - - - - -  \n");
                            Method.CreateNewOrderForCUstumer();
                            break;

                        case 6:
                            Console.WriteLine("      Update orders according to order codes");
                            Console.WriteLine("  - - - - - - - - - - - - - - - - - - - - - - - \n");
                            Method.UpdateOrdersAccording();
                            break;

                        case 7:
                            Console.WriteLine("      Payment orders");
                            Console.WriteLine("  - - - - - - - - - - - - - -  \n");
                            Method.PayOrderByIdOrder();
                            break;

                        case 8:
                            ActionAdmin(id_Custemer);
                            break;
                        }
                    }
                    break;

                case 3:
                    Console.Clear();
                    Console.WriteLine("Manage all items in the store");
                    Console.WriteLine("  - - - - - - - - - - - - - -  ");
                    choose = -1;
                    while (choose != 0)
                    {
                        Console.WriteLine("\nAdministration of all items.");
                        Console.WriteLine("1. Show Product");
                        Console.WriteLine("2. Add product.");
                        Console.WriteLine("3. Update product.");
                        Console.WriteLine("4. Delete product");
                        Console.WriteLine("5. Find product by codeProduct");
                        Console.WriteLine("6. Exit");
                        choose = Management.CreateInteger("choose", 1, 6);
                        Console.Clear();
                        switch (choose)
                        {
                        case 1:
                            Console.WriteLine(" *  *  Show Product  *  *\n");
                            Management.ShowProduct();
                            break;

                        case 2:
                            Management.AddProduct();
                            break;

                        case 3:
                            Console.WriteLine(" * *  Update product  * *\n");
                            Management.ShowProduct();
                            Console.WriteLine();
                            Management.UpdateProduct();
                            break;

                        case 4:
                            Console.WriteLine("*  *   Delete product  *  *\n");
                            Management.ShowProduct();
                            Console.WriteLine();
                            Management.RemoveProduct();
                            break;

                        case 5:
                            Management.FindProduct();
                            break;

                        case 6:
                            ActionAdmin(id_Custemer);
                            break;
                        }
                    }
                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine("Logged out\n");
                    TakeAction();
                    break;
                }
            }
        }