Beispiel #1
0
        public void AddFlightPlan(JsonFlightPlan flight_plan)
        {
            num_of_flight_plan++;
            dict_of_json_flight_plan[GetId()] = flight_plan;

            FlightPlanModel flight_plan_model = new FlightPlanModel(flight_plan, GetId());
            flight_plan_model.ParseTheFlightPlan();
            list_flight_plans.Add(flight_plan_model);
            Console.WriteLine("");

        }
Beispiel #2
0
        /*
         * Gets an unUnique id for the flightplan and saves it in the cache and the data base.
         */
        public void SaveFlightPlan(FlightPlan flightPlan)
        {
            List <Tuple <string, FlightPlan> > list = null;

            lock (balanceLock)
                list = (List <Tuple <string, FlightPlan> >)scheduledCache.TryGetValue("FlightPlan");
            string id = getId();
            //the flightplan that being saved in the data base.
            JsonFlightPlan js = new JsonFlightPlan();

            js.Id   = id;
            js.Json = Newtonsoft.Json.JsonConvert.SerializeObject(flightPlan);
            lock (balanceLock)
            {
                //save in the data base and cache
                db.FlightPlanes.Add(js);
                db.SaveChanges();
                if (list != null)
                {
                    list.Add(new Tuple <string, FlightPlan>(id, flightPlan));
                }
            }
        }
Beispiel #3
0
 public FlightPlanModel(JsonFlightPlan flight_plan, string arg_id_flight_plan)
 {
     json_flight_plan = flight_plan;
     id_flight_plan   = arg_id_flight_plan;
 }