Exemplo n.º 1
0
    protected void RefreshData(bool fForceRefresh)
    {
        mfbSearchForm1.Restriction.UserName = User.Identity.Name;
        mfbSearchForm1.Restriction.Refresh();

        if (fForceRefresh || CurrentVisitedAirports == null)
        {
            CurrentVisitedAirports = VisitedAirport.VisitedAirportsForQuery(mfbSearchForm1.Restriction);
        }

        gvAirports.DataSource = CurrentVisitedAirports;
        gvAirports.DataBind();

        IEnumerable <VisitedRegion> d = VisitedAirport.VisitedCountriesAndAdmins(CurrentVisitedAirports);

        rptRegions.DataSource = d;
        rptRegions.DataBind();
        lblNone.Visible = !d.Any();

        mfbGoogleMapManager1.Visible = CurrentVisitedAirports.Length > 0;   //  Avoid excessive map loads.

        AirportList alMatches = new AirportList(CurrentVisitedAirports);

        // get an airport list of the airports
        mfbGoogleMapManager1.Map.SetAirportList(alMatches);

        bool fIncludeRoutes = util.GetIntParam(Request, "path", 0) != 0;

        if (mfbGoogleMapManager1.Map.Options.fShowRoute = fIncludeRoutes)
        {
            List <AirportList> lst = new List <AirportList>();

            DBHelper dbh = new DBHelper(LogbookEntry.QueryCommand(mfbSearchForm1.Restriction, lto: LogbookEntry.LoadTelemetryOption.None));
            dbh.ReadRows((comm) => { }, (dr) =>
            {
                object o       = dr["Route"];
                string szRoute = (string)(o == System.DBNull.Value ? string.Empty : o);

                if (!String.IsNullOrEmpty(szRoute))
                {
                    lst.Add(alMatches.CloneSubset(szRoute));
                }
            });
            mfbGoogleMapManager1.Map.Airports = lst;
        }

        lnkZoomOut.NavigateUrl = mfbGoogleMapManager1.ZoomToFitScript;
        lnkZoomOut.Visible     = (CurrentVisitedAirports.Length > 0);

        lblNumAirports.Text = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.VisitedAirportsNumAirports, CurrentVisitedAirports.Length);
    }
        protected void RefreshVisitedAirports()
        {
            if (CurrentVisitedAirports == null)
            {
                CurrentVisitedAirports = VisitedAirport.VisitedAirportsForQuery(Restriction);
            }
            lblNumAirports.Text = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.VisitedAirportsNumAirports, CurrentVisitedAirports.Length);

            gvAirports.DataSource = CurrentVisitedAirports;
            gvAirports.DataBind();

            mfbGoogleMapManager1.Visible = CurrentVisitedAirports.Length > 0;   //  Avoid excessive map loads.

            AirportList alMatches = new AirportList(CurrentVisitedAirports);

            // get an airport list of the airports
            mfbGoogleMapManager1.Map.SetAirportList(alMatches);

            lnkZoomOut.NavigateUrl = mfbGoogleMapManager1.ZoomToFitScript;
            lnkZoomOut.Visible     = (CurrentVisitedAirports.Length > 0);
        }