Example #1
0
        public static void CreateOrder()
        {
            Count++;
            CommodityManager.ShowCommodities();
            var currentUser = AccountManager.CurrentUser as RegisteredUser;

            if (currentUser != null)
            {
                ((RegisteredUser)AccountManager.CurrentUser).orders.Add(new Order(Count, AccountManager.CurrentUser, CommodityManager.FindCommodityByID(ConsoleManager.GetID("commodity")), Statuses.New));
            }
            else
            {
                ((Administrator)AccountManager.CurrentUser).orders.Add(new Order(Count, AccountManager.CurrentUser, CommodityManager.FindCommodityByID(ConsoleManager.GetID("commodity")), Statuses.New));
            }
            Console.WriteLine("New order is created.");
            Console.WriteLine("Please, type enter to continue...)");
            Console.ReadKey();
        }
Example #2
0
        public static void EditCommodityData()
        {
            CommodityManager.ShowCommodities();
            int choice      = 0;
            int commodityID = ConsoleManager.GetID("commodity");
            Dictionary <int, Action <int> > commandsToChange = new Dictionary <int, Action <int> >()
            {
                { 1, ChangeCommodityName },
                { 2, ChangeCommodityPrice },
                { 3, ChangeCommodityWarranty },
                { 4, ChangeCommodityType }
            };

            while (choice != 5)
            {
                choice = ReadChoice();
                if (choice != 5)
                {
                    commandsToChange[choice](commodityID);
                }
            }
        }