public async Task <DroneFlight> GenerateFlight()
        {
            using (FlightProcessorConnection cn = new FlightProcessorConnection()) {
                var Query = from d in cn.DroneFlight
                            where d.BBFlightID == _BBFlightID &&
                            d.DroneID == _DroneID
                            select d;
                if (await Query.AnyAsync())
                {
                    _DroneFlight = await Query.FirstAsync();

                    _FlightMapData.FlightID = _FlightID = _DroneFlight.ID;
                    await LoadFlightDetails();
                }
                else
                {
                    //Load information about the flight from
                    await SetFlightInformation();

                    //Add flight information to database
                    cn.DroneFlight.Add(_DroneFlight);
                    await cn.SaveChangesAsync();

                    _FlightMapData.FlightID = _FlightID = _DroneFlight.ID;
                }//if(await Query.AnyAsync())
                _ExtDroneFlight = new ExtDroneFight(_DroneFlight);
            }

            //Load Approvals for the Flight
            await LoadFlightApprovals();
            await LoadExtDroneFlight();

            return(_DroneFlight);
        }
Example #2
0
 public Alert(ExtDroneFight TheFlight)
 {
     _Flight      = TheFlight;
     _DroneName   = _Flight.DroneName;
     _AccountName = _Flight.AccountName;
 }