protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Master.SelectedTab = tabID.tabUnknown; int id = util.GetIntParam(Request, "id", -1); if (id >= 0) { LogbookEntry le = new LogbookEntry(); if (le.FLoadFromDB(id, User.Identity.Name)) { ViewState[keyFlightEntry] = le; } else { pnlShareOrNot.Visible = false; pnlNotYours.Visible = true; } } } mfbMiniFacebook.FlightEntry = (LogbookEntry)ViewState[keyFlightEntry]; if (mfbMiniFacebook.FlightEntry != null && mfbMiniFacebook.FlightEntry.fIsPublic) { Response.Redirect(mfbMiniFacebook.FBRedirURL.OriginalString); } }
protected void btnSendFlight_Click(object sender, EventArgs e) { Page.Validate("valSendFlight"); if (Page.IsValid) { LogbookEntry le = new LogbookEntry(Convert.ToInt32(hdnFlightToSend.Value, CultureInfo.InvariantCulture), Page.User.Identity.Name); MyFlightbook.Profile pfSender = MyFlightbook.Profile.GetUser(Page.User.Identity.Name); string szRecipient = txtSendFlightEmail.Text; using (MailMessage msg = new MailMessage()) { msg.Body = Branding.ReBrand(Resources.LogbookEntry.SendFlightBody.Replace("<% Sender %>", HttpUtility.HtmlEncode(pfSender.UserFullName)) .Replace("<% Message %>", HttpUtility.HtmlEncode(txtSendFlightMessage.Text)) .Replace("<% Date %>", le.Date.ToShortDateString()) .Replace("<% Aircraft %>", HttpUtility.HtmlEncode(le.TailNumDisplay)) .Replace("<% Route %>", HttpUtility.HtmlEncode(le.Route)) .Replace("<% Comments %>", HttpUtility.HtmlEncode(le.Comment)) .Replace("<% Time %>", le.TotalFlightTime.FormatDecimal(pfSender.UsesHHMM)) .Replace("<% FlightLink %>", le.SendFlightUri(Branding.CurrentBrand.HostName, SendPageTarget).ToString())); msg.Subject = String.Format(CultureInfo.CurrentCulture, Resources.LogbookEntry.SendFlightSubject, pfSender.UserFullName); msg.From = new MailAddress(Branding.CurrentBrand.EmailAddress, String.Format(CultureInfo.CurrentCulture, Resources.SignOff.EmailSenderAddress, Branding.CurrentBrand.AppName, pfSender.UserFullName)); msg.ReplyToList.Add(new MailAddress(pfSender.Email)); msg.To.Add(new MailAddress(szRecipient)); msg.IsBodyHtml = true; util.SendMessage(msg); } modalPopupSendFlight.Hide(); } else { modalPopupSendFlight.Show(); } }
protected void mfbEditFlight_FlightUpdated(object sender, LogbookEventArgs e) { mvCheckFlight.SetActiveView(vwIssues); // Recheck the flight that was updated. if (e == null) { throw new ArgumentNullException(nameof(e)); } LogbookEntryBase le = new LogbookEntry(e.FlightID, Page.User.Identity.Name); IEnumerable <FlightWithIssues> updated = new FlightLint().CheckFlights(new LogbookEntryBase[] { le }, Page.User.Identity.Name, SelectedOptions); List <FlightWithIssues> lst = new List <FlightWithIssues>(CheckedFlights); int index = lst.FindIndex(fwi => fwi.Flight.FlightID == e.FlightID); if (updated.Any()) { lst[index] = updated.ElementAt(0); } else { lst.RemoveAt(index); } BindFlights(lst); }
public void DeleteEntry(Guid aircraftId, LogbookEntry entry) { /* Delete log file */ FileInfo logFile = GetLogbookEntryFile(aircraftId, entry.StartDateTime, "log", "json"); _logbookEntryDao.Delete(logFile); /* Delete track file */ FileInfo trackFile = GetLogbookEntryFile(aircraftId, entry.StartDateTime, "track", "csv"); _logbookEntryTrackDao.Delete(trackFile); if (entry.Type == LogbookEntryType.AcmiZip) { /* Delete imported file */ FileInfo acmiFile = GetLogbookEntryFile(aircraftId, entry.StartDateTime, "acmi", "zip"); if (acmiFile.Exists) { acmiFile.Delete(); } } if (!logFile.Directory.GetFiles().Any()) { logFile.Directory.Delete(); } }
private void changeCustomRibbon(LogbookEntry log) { string code = "X" + log.Code.Substring(2); if (Log.IsLogable(Log.LEVEL.TRACE)) { Log.Trace("changing custom ribbon for code " + code); } Ribbon ribbon = RibbonPool.Instance().GetRibbonForCode(code); if (ribbon == null) { Log.Error("invalid custom ribbon code: " + code); return; } // CustomAchievement achievement = ribbon.GetAchievement() as CustomAchievement; if (achievement == null) { Log.Error("invalid custom ribbon achievement"); return; } achievement.SetName(log.Name); achievement.SetDescription(log.Data); if (Log.IsLogable(Log.LEVEL.TRACE)) { Log.Trace("custom ribbonchanged"); } }
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; } } } }
public void Edit_UpdateTeaserImage() { var logbookEntry = new LogbookEntry { Id = new Guid("601A3EC6-2BB7-4A47-83CF-389429824CEB"), Title = "Test Title", TeaserImage = "the_orig_image", TeaserImageThumb = "the_thumb_image", }; var newOriginalPhotoIdentifier = new PhotoIdentifier(PhotoCategory.LogbookTeaser, false, "image.jpg"); var newThumbnailPhotoIdentifier = new PhotoIdentifier(PhotoCategory.LogbookTeaser, true, "image.jpg"); logbookEntry.Edit( "New Title", "New Teaser", "New Text", false, new Guid("4B3B79AE-3062-44FE-8AA1-14D425C081FA"), null, null, new PhotoAndThumbnailIdentifiers( newOriginalPhotoIdentifier, newThumbnailPhotoIdentifier) ); logbookEntry.TeaserImage.Should().Be(newOriginalPhotoIdentifier.Serialze()); logbookEntry.TeaserImageThumb.Should().Be(newThumbnailPhotoIdentifier.Serialze()); }
protected void AddSuccessRow(LogbookEntry le, int iRow) { if (le == null) { throw new ArgumentNullException("le"); } }
protected void gvFlightLogs_RowCommand(object sender, GridViewCommandEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.CommandName.CompareOrdinal("_revSig") == 0) { int idFlight = Convert.ToInt32(e.CommandArgument, CultureInfo.InvariantCulture); // Can't edit a LogbookEntryDisplay, so load a logbookentry LogbookEntry le = new LogbookEntry(); if (le.FLoadFromDB(idFlight, User)) { try { le.RevokeSignature(Page.User.Identity.Name); FlushCache(); BindData(Data); } catch (InvalidOperationException ex) { ((Label)((Control)e.CommandSource).NamingContainer.FindControl("lblErr")).Text = ex.Message; } } } }
/// <summary> /// Updates the starting flight with the specified value in the specified column /// </summary> /// <param name="sfc">The column to read</param> /// <param name="sf">The target starting flight</param> /// <param name="value">The value</param> protected void SetValueForColumn(StartingFlightColumn sfc, LogbookEntry sf, Decimal value) { if (sf == null) { throw new ArgumentNullException("sf"); } switch (sfc) { case StartingFlightColumn.CFI: sf.CFI = value; break; case StartingFlightColumn.SIC: sf.SIC = value; break; case StartingFlightColumn.PIC: sf.PIC = value; break; case StartingFlightColumn.Total: sf.TotalFlightTime = value; break; } }
private void Refresh30DayPublicFlights() { // we don't use the regular base query so that this can be super fast. As a result, not all of the properties of the Logbook entry will be filled in. const string szQuery = @" SELECT f.*, 0 AS FlightDataLength, IF (ac.tailnumber LIKE '#%', CONCAT('(', m.model, ')'), ac.tailnumber) AS TailNumberDisplay, '' AS FlightVids, 0 AS HasDigitizedSignature, 0 AS distance, '' AS flightpath, 0 AS telemetrytype, '' AS metadata FROM flights f INNER JOIN Aircraft ac ON f.idaircraft=ac.idaircraft INNER JOIN models m ON ac.idmodel=m.idmodel WHERE f.Date > ?dateMin AND f.Date < ?dateMax AND f.fPublic <> 0 ORDER BY f.date DESC, f.idflight DESC LIMIT 200"; DBHelper dbh = new DBHelper(szQuery); dbh.ReadRows( (comm) => { comm.Parameters.AddWithValue("dateMin", DateTime.Now.AddDays(-30)); comm.Parameters.AddWithValue("dateMax", DateTime.Now.AddDays(1)); }, (dr) => { LogbookEntry le = new LogbookEntry(dr, (string)dr["username"]); m_lstFlights.Add(le); }); }
protected void lnkViewKML_Click(object sender, EventArgs e) { int id = hdnID.Value.SafeParseInt(-1); if (id <= 0) { return; } LogbookEntry le = new LogbookEntry(id, User.Identity.Name, LogbookEntry.LoadTelemetryOption.LoadAll); if (le == null || String.IsNullOrEmpty(le.FlightData)) { return; } using (FlightData fd = new FlightData()) { fd.ParseFlightData(le.FlightData); if (fd.HasLatLongInfo) { { DataSourceType dst = DataSourceType.DataSourceTypeFromFileType(DataSourceType.FileType.KML); Response.Clear(); Response.ContentType = dst.Mimetype; Response.AddHeader("Content-Disposition", String.Format(CultureInfo.CurrentCulture, "attachment;filename=FlightData{0}.{1}", le.FlightID, dst.DefaultExtension)); fd.WriteKMLData(Response.OutputStream); Response.End(); } } } }
/// <summary> /// Checks to see if this is being initialized from a shared flight, returns the LogbookEntry if so /// </summary> /// <param name="le">The logbook entry to start</param> /// <returns>The updated logbook entry</returns> private LogbookEntry SharedFlight(LogbookEntry le) { string szSharedFlightKey = util.GetStringParam(Request, "src"); if (!String.IsNullOrEmpty(szSharedFlightKey)) { le = new LogbookEntry(szSharedFlightKey) { User = Page.User.Identity.Name }; UseLastTail = le.AircraftID == Aircraft.idAircraftUnknown; // use the aircraft from this, if it's not an unknown aircraft (e.g., if the flight actually exists in the db) if (le.AircraftID != Aircraft.idAircraftUnknown) { // Add this aircraft to the user's profile if needed UserAircraft ua = new UserAircraft(Page.User.Identity.Name); Aircraft ac = new Aircraft(le.AircraftID); if (!ua.CheckAircraftForUser(ac)) { ua.FAddAircraftForUser(ac); } } } return(le); }
private void FinalizeSetupForFlight(LogbookEntry le) { // if the specified id was found AND it belongs to the current user, we can edit it; else, just set up for "new" if (le.IsNewFlight) { btnAddFlight.Text = Resources.LocalizedText.EditFlightAddFlight; mfbFlightImages.Visible = false; mfbVideoEntry1.Videos.Clear(); // set the aircraft to the ID of the most recently used flight, if known. int idLastAircraft = Aircraft.LastTail; if (idLastAircraft != 0 && UseLastTail) { try { cmbAircraft.SelectedValue = idLastAircraft.ToString(CultureInfo.InvariantCulture); } catch (ArgumentOutOfRangeException) { } } int idAircraftOrigin = le.AircraftID; try { le.AircraftID = Convert.ToInt32(cmbAircraft.SelectedValue, CultureInfo.InvariantCulture); // initialize the aircraft so that the landings auto-expands based on tailwheel } catch (FormatException) { le.AircraftID = Aircraft.idAircraftUnknown; } if (idAircraftOrigin != le.AircraftID) { SetTemplatesForAircraft(le.AircraftID); } cpeFlightDetails.Collapsed = !CurrentUser.DisplayTimesByDefault; } else { btnAddFlight.Text = Resources.LocalizedText.EditFlightUpdateFlight; mfbFlightImages.Visible = true; mfbFlightImages.Key = le.FlightID.ToString(CultureInfo.InvariantCulture); mfbFlightImages.Refresh(); // Set up videos too. mfbVideoEntry1.Videos.Clear(); foreach (VideoRef vr in le.Videos) { mfbVideoEntry1.Videos.Add(vr); } cpeAltCatClass.Collapsed = (le.CatClassOverride == 0); } cpeFlightDetails.Collapsed = !CurrentUser.DisplayTimesByDefault && !(le.HobbsEnd > 0.0M || le.HobbsStart > 0.0M || le.EngineStart.HasValue() || le.EngineEnd.HasValue() || le.FlightStart.HasValue() || le.FlightEnd.HasValue() || le.HasFlightData); AutoExpandLandings(le); }
protected void lnkAddAircraft_Click(object sender, EventArgs e) { LogbookEntry le = InitLogbookEntryFromForm(); Session[keySessionInProgress] = le; Response.Redirect("~/Member/EditAircraft.aspx?id=-1&Ret=" + HttpUtility.UrlEncode(Request.Url.PathAndQuery)); }
public void UpdateManualEntry( LogbookEntry oldEntry, Guid aircraftId, DateTime startDateTime, DateTime endDateTime, TimeSpan duration, IList <LogbookLocation> track, double distanceNauticalMiles, string notes) { DeleteEntry(aircraftId, oldEntry); CreateManualEntry(aircraftId, startDateTime, endDateTime, duration, track, distanceNauticalMiles, notes); }
private void ShowMap(LogbookEntry le) { double distance = 0.0; bool fHasPath = le.Telemetry != null && le.Telemetry.HasPath; ListsFromRoutesResults result = null; if (le.Route.Length > 0 || fHasPath) // show a map. { result = AirportList.ListsFromRoutes(le.Route); MfbGoogleMap1.Map.Airports = result.Result; MfbGoogleMap1.Map.Options.fShowRoute = ckShowRoute.Checked; MfbGoogleMap1.Map.Options.fAutofillPanZoom = (result.Result.Count == 0); MfbGoogleMap1.Map.AllowDupeMarkers = false; lnkZoomOut.NavigateUrl = MfbGoogleMap1.ZoomToFitScript; lnkZoomOut.Visible = !result.MasterList.LatLongBox().IsEmpty; // display flight path, if available. if (ckShowPath.Checked && le.Telemetry.HasPath) { MfbGoogleMap1.Map.Path = le.Telemetry.Path(); distance = le.Telemetry.Distance(); rowKML.Visible = true; } } MfbGoogleMap1.Map.Images = ckShowImages.Checked ? mfbIlFlight.Images.ImageArray.ToArray() : Array.Empty <MFBImageInfo>(); bool fForceDynamicMap = util.GetIntParam(Request, "dm", 0) != 0; bool fHasGeotaggedImages = false; if (le.FlightImages != null) { foreach (MFBImageInfo mfbii in le.FlightImages) { fHasGeotaggedImages = fHasGeotaggedImages || mfbii.Location != null; } } // By default, show only a static map (cut down on dynamic map hits) if (fForceDynamicMap || fHasGeotaggedImages || fHasPath) { MfbGoogleMap1.Mode = MyFlightbook.Mapping.GMap_Mode.Dynamic; } else { MfbGoogleMap1.Mode = MyFlightbook.Mapping.GMap_Mode.Static; popmenu.Visible = false; lnkZoomOut.Visible = mfbAirportServices1.Visible = false; } if (result != null) { mfbAirportServices1.GoogleMapID = MfbGoogleMap1.MapID; mfbAirportServices1.AddZoomLink = (MfbGoogleMap1.Mode == MyFlightbook.Mapping.GMap_Mode.Dynamic); mfbAirportServices1.SetAirports(result.MasterList.GetNormalizedAirports()); } lblDistance.Text = le.GetPathDistanceDescription(distance); pnlDistance.Visible = lblDistance.Text.Length > 0; }
protected void Page_Load(object sender, EventArgs e) { // if this is a callback that is providing the twitter access token, then update with the token. if (!String.IsNullOrEmpty(Request["oauth_token"]) && Page.User.Identity.IsAuthenticated) { if (String.IsNullOrEmpty(Request["oauth_verifier"])) { throw new MyFlightbookException("oauth token passed but no oauth_verifier along with it."); } oAuthTwitter oAuth = new oAuthTwitter(); oAuth.AccessTokenGet(Request["oauth_token"], Request["oauth_verifier"]); mfbTwitter.SetUserTwitterToken(Page.User.Identity.Name, oAuth); } if (util.GetStringParam(Request, "oauth_token").Length > 0) { LogbookEntry le = mfbTwitter.PendingFlightToPost; if (le != null) { mfbTwitter.PostFlight(le); mfbTwitter.PendingFlightToPost = null; // clear it } } Response.Redirect(SocialNetworkAuthorization.PopRedirect(Master.IsMobileSession() ? SocialNetworkAuthorization.DefaultRedirPageMini : SocialNetworkAuthorization.DefaultRedirPage)); }
private void CheckMiscIssues(LogbookEntryBase le) { foreach (CustomFlightProperty cfp in le.CustomProperties) { if (cfp.PropertyType.IsExcludedFromMRU) { AddConditionalIssue(seenCheckrides.Contains(cfp.PropTypeID), LintOptions.MiscIssues, String.Format(CultureInfo.CurrentCulture, Resources.FlightLint.warningMiscMultipleRedundantCheckrides, cfp.PropertyType.Title)); seenCheckrides.Add(cfp.PropTypeID); } } int maxDescribedLandings = 0; le.CustomProperties.ForEachEvent((cfp) => { if (cfp.PropertyType.IsLanding) { maxDescribedLandings = Math.Max(maxDescribedLandings, cfp.IntValue); } }); AddConditionalIssue(maxDescribedLandings > le.Landings, LintOptions.MiscIssues, String.Format(CultureInfo.CurrentCulture, Resources.FlightLint.warningMoreDescribedLandingsThanTotal, le.Landings)); AddConditionalIssue(le.Dual > 0 && !le.CustomProperties.PropertyExistsWithID(CustomPropertyType.KnownProperties.IDPropInstructorName) && le.CFISignatureState == LogbookEntryBase.SignatureState.None, LintOptions.MiscIssues, Resources.FlightLint.warningDualLoggedButNoCFIName); LogbookEntryBase leDefault = new LogbookEntry() { Date = le.Date, AircraftID = le.AircraftID, User = le.User }; AddConditionalIssue(le.IsEqualTo(leDefault), LintOptions.MiscIssues, Resources.FlightLint.warningFlightHasNoData); AddConditionalIssue(previousFlight != null && le.IsEqualTo(previousFlight), LintOptions.MiscIssues, Resources.FlightLint.warningMiscDuplicateFlight); }
protected void wzMerge_FinishButtonClick(object sender, WizardNavigationEventArgs e) { List <LogbookEntry> lst = new List <LogbookEntry>(); // Need to use LogbookEntry, not LogbookEntryDisplay, since you can't commit LogbookEntryDisplay // Also need to do ascending so 1st element is target. DBHelper dbh = new DBHelper(LogbookEntry.QueryCommand(Query, -1, -1, true, LogbookEntry.LoadTelemetryOption.LoadAll)); dbh.ReadRows((comm) => { }, (dr) => { LogbookEntry le = new LogbookEntry(dr, Query.UserName, LogbookEntryCore.LoadTelemetryOption.LoadAll); // Note: this has no telemetry le.PopulateImages(); lst.Add(le); }); LogbookEntry target = lst[0]; lst.RemoveAt(0); foreach (LogbookEntry le in lst) { le.PopulateImages(); } target.MergeFrom(lst); Response.Redirect("~/Member/LogbookNew.aspx"); }
protected void Preview() { if (StartingFlights == null) { return; } FlightQuery fq = new FlightQuery(User.Identity.Name); // Force a refresh on "before" mfbTotalsBefore.CustomRestriction = fq; // Commit the flights CommitFlights(); // force a refresh on "after" mfbTotalsAfter.CustomRestriction = fq; // now delete those starting flights. foreach (StartingFlight sf in StartingFlights) { if (!sf.IsNewFlight) { LogbookEntry.FDeleteEntry(sf.FlightID, User.Identity.Name); } sf.FlightID = LogbookEntry.idFlightNew; } }
private void ShowMap(LogbookEntry le) { double distance = 0.0; bool fHasPath = le.Telemetry != null && le.Telemetry.HasPath; ListsFromRoutesResults result = null; if (le.Route.Length > 0 || fHasPath) // show a map. { result = AirportList.ListsFromRoutes(le.Route); MfbGoogleMap1.Map.Airports = result.Result; MfbGoogleMap1.Map.ShowRoute = ckShowRoute.Checked; MfbGoogleMap1.Map.AutofillOnPanZoom = (result.Result.Count() == 0); MfbGoogleMap1.Map.AllowDupeMarkers = false; lnkZoomOut.NavigateUrl = MfbGoogleMap1.ZoomToFitScript; lnkZoomOut.Visible = !result.MasterList.LatLongBox().IsEmpty; // display flight path, if available. if (ckShowPath.Checked && le.Telemetry.HasPath) { MfbGoogleMap1.Map.Path = le.Telemetry.Path(); distance = le.Telemetry.Distance(); lnkViewKML.Visible = true; } string szURL = Request.Url.PathAndQuery; lnkShowMapOnly.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", szURL, szURL.Contains("?") ? "&" : "?", "show=map"); } MfbGoogleMap1.Map.Images = ckShowImages.Checked ? mfbIlFlight.Images.ImageArray.ToArray() : new MFBImageInfo[0]; bool fForceDynamicMap = util.GetIntParam(Request, "dm", 0) != 0; bool fHasGeotaggedImages = false; if (le.FlightImages != null) { Array.ForEach <MFBImageInfo>(le.FlightImages, (mfbii) => { fHasGeotaggedImages = fHasGeotaggedImages || mfbii.Location != null; }); } // By default, show only a static map (cut down on dynamic map hits) if (fForceDynamicMap || fHasGeotaggedImages || fHasPath) { MfbGoogleMap1.Mode = MyFlightbook.Mapping.GMap_Mode.Dynamic; } else { MfbGoogleMap1.Mode = MyFlightbook.Mapping.GMap_Mode.Static; popmenu.Visible = false; lnkZoomOut.Visible = mfbAirportServices1.Visible = false; } if (result != null) { mfbAirportServices1.GoogleMapID = MfbGoogleMap1.MapID; mfbAirportServices1.AddZoomLink = (MfbGoogleMap1.Mode == MyFlightbook.Mapping.GMap_Mode.Dynamic); mfbAirportServices1.SetAirports(result.MasterList.GetNormalizedAirports()); } lblDistance.Text = le.GetPathDistanceDescription(distance); pnlDistance.Visible = lblDistance.Text.Length > 0; }
protected void mfbEditFlight_FlightWillBeSaved(object sender, LogbookEventArgs e) { if (e == null) { throw new ArgumentNullException("e"); } LogbookEntry le = e.Flight; if (le == null) { throw new MyFlightbookValidationException("No flight to save!"); } // Fix up the flight for the user le.User = hdnStudent.Value; // ensure that the aircraft is in their profile UserAircraft ua = new UserAircraft(le.User); if (ua.GetUserAircraftByID(le.AircraftID) == null) { ua.FAddAircraftForUser(new Aircraft(le.AircraftID)); } }
protected void onAutofill(object sender, EventArgs e) { if (this.AutoFill != null) { int takeoffSpeed = Convert.ToInt32(rblTakeOffSpeed.SelectedValue, CultureInfo.InvariantCulture); AutoFillOptions afo = new AutoFillOptions() { TimeZoneOffset = mfbTimeZone1.TimeZoneOffset, TakeOffSpeed = takeoffSpeed, LandingSpeed = AutoFillOptions.BestLandingSpeedForTakeoffSpeed(takeoffSpeed), IncludeHeliports = ckIncludeHeliports.Checked, AutoSynthesizePath = ckEstimateNight.Checked, Night = (AutoFillOptions.NightCritera)Enum.Parse(typeof(AutoFillOptions.NightCritera), rblNightCriteria.SelectedValue, true), NightLanding = (AutoFillOptions.NightLandingCriteria)Enum.Parse(typeof(AutoFillOptions.NightLandingCriteria), rblNightLandingCriteria.SelectedValue, true), RoundToTenth = ckRoundNearest10th.Checked, IgnoreErrors = true }; afo.ToCookies(Response.Cookies); string szTelemetry = Telemetry; // Load from the DB if needed if (String.IsNullOrEmpty(szTelemetry) && !LogbookEntry.IsNewFlightID(FlightID)) { szTelemetry = new LogbookEntry(FlightID, Page.User.Identity.Name, LogbookEntry.LoadTelemetryOption.LoadAll).FlightData; } this.AutoFill(this, new AutofillEventArgs(afo, szTelemetry)); } }
/// <summary> /// Returns the Uri to view a flight (useful for FB/Twitter/Etc.) /// </summary> /// <param name="le">The flight to be shared</param> /// <param name="szHost">Hostname (if not provided, uses current brand)</param> /// <returns></returns> public static Uri ShareFlightUri(LogbookEntry le, string szHost = null) { if (le == null) { throw new ArgumentNullException("le"); } return(String.Format(CultureInfo.InvariantCulture, "~/Public/ViewPublicFlight.aspx/{0}?v={1}", le.FlightID, (new Random()).Next(10000)).ToAbsoluteURL("https", szHost ?? Branding.CurrentBrand.HostName)); }
public void PostPendingFlight() { if (PendingFlightToPost != null) { PostFlight(PendingFlightToPost); PendingFlightToPost = null; } }
protected void btnAdminFixSignature_Click(object sender, EventArgs e) { LogbookEntry le = new LogbookEntry(); le.FLoadFromDB(FlightID, FlightUser, LogbookEntry.LoadTelemetryOption.None, true); le.AdminSignatureSanityFix(false); Response.Redirect(Request.Url.OriginalString); }
private void addLogbookEntry(LogbookEntry log, HallOfFameEntry entry) { lock (this) { logbook.Add(log); entry.AddLogRef(log); } }
/// <summary> /// Gets all routes ever flown, appends them together and INCLUDES any relevant navaids. /// </summary> /// <returns></returns> private static AirportList AllFlightsAndNavaids(FlightQuery fq) { DBHelper dbh = new DBHelper(LogbookEntry.QueryCommand(fq)); StringBuilder sb = new StringBuilder(); dbh.ReadRows((comm) => { }, (dr) => { sb.AppendFormat(CultureInfo.InvariantCulture, "{0} ", util.ReadNullableField(dr, "Route", string.Empty)); }); return(new AirportList(sb.ToString())); }
protected void ClearSignature(int idFlight) { LogbookEntry le = new LogbookEntry(); le.FlightID = idFlight; le.ClearPendingSignature(); RefreshStudentsAndInstructors(); }
public static bool Insert(LogbookEntry l, Guid userid, Guid logbookid) { try { using (System.Data.SqlClient.SqlConnection c = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager. ConnectionStrings["blueharvest-rds"].ConnectionString)) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand( "blueharvest.dbo.insertLogbookEntry", c)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; // input parameter(s) // id = newid() // datetime = sysutcdatetime() cmd.Parameters.Add("@title", System.Data.SqlDbType.NVarChar, 50); cmd.Parameters["@title"].Direction = System.Data.ParameterDirection.Input; cmd.Parameters["@title"].Value = l.title; cmd.Parameters.Add("@text", System.Data.SqlDbType.NVarChar, -1); cmd.Parameters["@text"].Direction = System.Data.ParameterDirection.Input; cmd.Parameters["@text"].Value = l.text; cmd.Parameters.Add("@userid", System.Data.SqlDbType.UniqueIdentifier); cmd.Parameters["@userid"].Direction = System.Data.ParameterDirection.Input; cmd.Parameters["@userid"].Value = userid; cmd.Parameters.Add("@logbookid", System.Data.SqlDbType.UniqueIdentifier); cmd.Parameters["@logbookid"].Direction = System.Data.ParameterDirection.Input; cmd.Parameters["@logbookid"].Value = logbookid; c.Open(); cmd.ExecuteNonQuery(); // open and execute } } return true; } catch { // the insert failed somehow (sql error, ids incorrect, etc.) return false; } }
// output line in logbook public override String CreateLogBookEntry(LogbookEntry entry) { Log.Error("could not add datachanges to personal logbooks"); throw new System.InvalidOperationException(); }
public override string CreateLogBookEntry(LogbookEntry entry) { return entry.Name + " returns from EVA"; }
public LogbookEntries(Guid LogbookId) { using (System.Data.SqlClient.SqlConnection c = new System.Data.SqlClient.SqlConnection(System.Configuration.ConfigurationManager. ConnectionStrings["blueharvest-rds"].ConnectionString)) { using (System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand( "blueharvest.dbo.getLogbookEntriesByLogbookId", c)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; // input parameter(s) cmd.Parameters.Add("@id", System.Data.SqlDbType.UniqueIdentifier); cmd.Parameters["@id"].Direction = System.Data.ParameterDirection.Input; cmd.Parameters["@id"].Value = LogbookId; c.Open(); // open connection using (System.Data.SqlClient.SqlDataReader r = cmd.ExecuteReader()) { if (r.HasRows) { while (r.Read()) { LogbookEntry l = new LogbookEntry(); l.id = Guid.Parse(r["id"].ToString()); l.datetime = Convert.ToDateTime(r["datetime"]); l.title = r["title"].ToString(); l.text = r["text"].ToString(); l.username = r["username"].ToString(); // user.username l.uri = r["uri"].ToString(); // user.image.uri Add(l); // add to the array } } } } } }
public override string CreateLogBookEntry(LogbookEntry entry) { return entry.Name + " has completed a contract"; }
public override string CreateLogBookEntry(LogbookEntry entry) { try { double science = Double.Parse(entry.Data); return entry.Name + " has researched " + science.ToString("0.0") + " science points"; } catch { return entry.Name + " has researched an unknown amount of science points"; } }
public override string CreateLogBookEntry(LogbookEntry entry) { return entry.Name + " begins EVA in toxic atmosphere"; }
public override string CreateLogBookEntry(LogbookEntry entry) { return entry.Name + " has returned from a mission"; }
public override string CreateLogBookEntry(LogbookEntry entry) { return entry.Name + " launched a mission"; }
public override string CreateLogBookEntry(LogbookEntry entry) { return entry.Name + " has docked on another spacecraft"; }
public abstract String CreateLogBookEntry(LogbookEntry entry);