Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            FlightSchedule flightSched = new FlightSchedule();

            if (flightSched.Load(args[0]))
            {
                flightSched.Display();

                // get order schedule json
                string json = File.ReadAllText(args[1]);
                Dictionary <string, Order> orders = JsonConvert.DeserializeObject <Dictionary <string, Order> >(json);

                //add order IDs to objects - the given json uses the order ID as a dynamic key, so it can't be deserialized into the class directly.
                foreach (string orderID in orders.Keys)
                {
                    orders[orderID].OrderID = orderID;
                }

                OrderScheduler orderScheduler = new OrderScheduler(flightSched, orders);
                orderScheduler.Schedule();
                orderScheduler.Display();
            }
        }
Ejemplo n.º 2
0
 public OrderScheduler(FlightSchedule _flightSched, Dictionary <string, Order> _orderDict)
 {
     flightSched = _flightSched;
     orderDict   = _orderDict;
 }