コード例 #1
0
    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);
        }
    }
コード例 #2
0
    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();
        }
    }
コード例 #3
0
        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);
        }
コード例 #4
0
        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();
            }
        }
コード例 #5
0
ファイル: HallOfFame.cs プロジェクト: jpmac26/FinalFrontier
            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");
                }
            }
コード例 #6
0
ファイル: Leon.cs プロジェクト: ericberman/MyFlightbookWeb
        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;
                    }
                }
            }
        }
コード例 #7
0
        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());
        }
コード例 #8
0
 protected void AddSuccessRow(LogbookEntry le, int iRow)
 {
     if (le == null)
     {
         throw new ArgumentNullException("le");
     }
 }
コード例 #9
0
    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;
                }
            }
        }
    }
コード例 #10
0
    /// <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;
        }
    }
コード例 #11
0
        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);
            });
        }
コード例 #12
0
    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();
                }
            }
        }
    }
コード例 #13
0
    /// <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);
    }
コード例 #14
0
    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);
    }
コード例 #15
0
    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));
    }
コード例 #16
0
 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);
 }
コード例 #17
0
        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;
        }
コード例 #18
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));
    }
コード例 #19
0
ファイル: FlightLint.cs プロジェクト: xmas25/MyFlightbookWeb
        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);
        }
コード例 #20
0
        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");
        }
コード例 #21
0
    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;
        }
    }
コード例 #22
0
    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;
    }
コード例 #23
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));
        }
    }
コード例 #24
0
    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));
        }
    }
コード例 #25
0
 /// <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));
 }
コード例 #26
0
 public void PostPendingFlight()
 {
     if (PendingFlightToPost != null)
     {
         PostFlight(PendingFlightToPost);
         PendingFlightToPost = null;
     }
 }
コード例 #27
0
    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);
    }
コード例 #28
0
ファイル: HallOfFame.cs プロジェクト: jpmac26/FinalFrontier
 private void addLogbookEntry(LogbookEntry log, HallOfFameEntry entry)
 {
     lock (this)
     {
         logbook.Add(log);
         entry.AddLogRef(log);
     }
 }
コード例 #29
0
        /// <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()));
        }
コード例 #30
0
    protected void ClearSignature(int idFlight)
    {
        LogbookEntry le = new LogbookEntry();

        le.FlightID = idFlight;
        le.ClearPendingSignature();
        RefreshStudentsAndInstructors();
    }
コード例 #31
0
ファイル: Logbook.cs プロジェクト: j-m-b/blueharvest-web
 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;
     }
 }
コード例 #32
0
 // output line in logbook
 public override String CreateLogBookEntry(LogbookEntry entry)
 {
    Log.Error("could not add datachanges to personal logbooks");
    throw new System.InvalidOperationException();
 }
コード例 #33
0
 public override string CreateLogBookEntry(LogbookEntry entry)
 {
    return entry.Name + " returns from EVA";
 }  
コード例 #34
0
ファイル: Logbook.cs プロジェクト: j-m-b/blueharvest-web
 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
                     }
                 }
             }
         }
     }
 }
コード例 #35
0
 public override string CreateLogBookEntry(LogbookEntry entry)
 {
    return entry.Name + " has completed a contract";
 }
コード例 #36
0
 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";
    }
 }
コード例 #37
0
 public override string CreateLogBookEntry(LogbookEntry entry)
 {
    return entry.Name + " begins EVA in toxic atmosphere";
 }
コード例 #38
0
 public override string CreateLogBookEntry(LogbookEntry entry)
 {
    return entry.Name + " has returned from a mission";
 }
コード例 #39
0
 public override string CreateLogBookEntry(LogbookEntry entry)
 {
    return entry.Name + " launched a mission";
 }
コード例 #40
0
 public override string CreateLogBookEntry(LogbookEntry entry)
 {
    return entry.Name + " has docked on another spacecraft";
 }   
コード例 #41
0
 public abstract String CreateLogBookEntry(LogbookEntry entry);