protected void afuUpload_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.State != AjaxControlToolkit.AjaxFileUploadState.Success) { return; } PendingFlight pf = new PendingFlight() { User = Page.User.Identity.Name }; string szOriginal = pf.FlightData = System.Text.Encoding.UTF8.GetString(e.GetContents()); using (FlightData fd = new FlightData()) { fd.AutoFill(pf, (AutoFillOptions)Session[SessionKeyOpt]); pf.FlightData = string.Empty; LogbookEntry leEmpty = new PendingFlight() { User = Page.User.Identity.Name, FlightData = string.Empty }; if (!pf.IsEqualTo(leEmpty)) { pf.TailNumDisplay = fd.TailNumber ?? string.Empty; pf.FlightData = szOriginal; pf.Commit(); } } }
private static void AutoComplete(LogbookEntry le) { // Issue #939: autofill cross-country/night, when possible. AutoFillOptions afo = AutoFillOptions.DefaultOptionsForUser(le.User); if (afo != null && le.CrossCountry == 0.0M) { if (le.Nighttime == 0.0M) { using (FlightData fd = new FlightData()) fd.AutoFill(le, afo); } else // just do xc time based on part 121 xc { CannedQuery fq = new CannedQuery() { Distance = FlightQuery.FlightDistance.NonLocalOnly }; if (fq.IsAirportMatch(le)) { le.CrossCountry = le.TotalFlightTime; } } } }
protected void AutoFill(object sender, AutofillEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } LogbookEntry le = InitLogbookEntryFromForm(); le.FlightData = e.Telemetry; using (FlightData fd = new FlightData()) { fd.AutoFill(le, e.Options); } InitFormFromLogbookEntry(le); }