Пример #1
0
 protected void mfbLogbook1_ItemDeleted(object sender, LogbookEventArgs e)
 {
     // Turn on lazy load for any items that could be affected by the deletion, or else refresh them if already visible.
     TurnOnLazyLoad(apcTotals, () => { mfbTotalSummary1.CustomRestriction = Restriction; });
     TurnOnLazyLoad(apcCurrency, () => { mfbCurrency1.RefreshCurrencyTable(); });
     TurnOnLazyLoad(apcAnalysis, () => { mfbChartTotals1.Refresh(); });
 }
Пример #2
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);
        }
Пример #3
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 mfbFlightContextMenu_SendFlight(object sender, LogbookEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        mfbSendFlight.SendFlight(e.FlightID);
    }
    protected void mfbFlightContextMenu_DeleteFlight(object sender, LogbookEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException(nameof(e));
        }

        DeleteFlight(e.FlightID);
    }
    protected void mfbFlightContextMenu_DeleteFlight(object sender, LogbookEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        LogbookEntryDisplay.FDeleteEntry(e.FlightID, Page.User.Identity.Name);
        Response.Redirect(TargetPage);
    }
Пример #7
0
 protected void mfbEditFlight_FlightUpdated(object sender, LogbookEventArgs e)
 {
     Refresh();
     mvPendingFlights.SetActiveView(vwList);
     if (e.IDNextFlight >= 0)
     {
         List <PendingFlight> lst = new List <PendingFlight>(Flights);
         PendingFlight        pf  = lst[e.IDNextFlight];
         EditPendingFlightInList(pf, lst);
     }
 }
 protected void mfbEditFlight_FlightUpdated(object sender, LogbookEventArgs e)
 {
     if (e == null)
     {
         throw new ArgumentNullException(nameof(e));
     }
     Refresh();
     mvPendingFlights.SetActiveView(vwList);
     if (e.IDNextFlight >= 0)
     {
         List <PendingFlight> lst = new List <PendingFlight>(Flights);
         PendingFlight        pf  = lst[e.IDNextFlight];
         EditPendingFlightInList(pf, lst);
     }
 }
Пример #9
0
    protected void mfbFlightContextMenu_DeleteFlight(object sender, LogbookEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        LogbookEntryDisplay.FDeleteEntry(e.FlightID, this.User);
        FlushCache();
        BindData(Data);
        RefreshNumFlights();
        if (ItemDeleted != null)
        {
            ItemDeleted(this, new LogbookEventArgs(e.FlightID));
        }
    }
Пример #10
0
        protected void GoBack(object sender, LogbookEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            if (e.IDNextFlight == LogbookEntryCore.idFlightNone)
            {
                Response.Redirect(hdnReturnURL.Value.Length > 0 ? hdnReturnURL.Value : "~/Default.aspx");
            }
            else
            {
                UriBuilder          builder = new UriBuilder(Request.Url);
                NameValueCollection nvc     = HttpUtility.ParseQueryString(Request.Url.Query);
                nvc["idFlight"] = e.IDNextFlight.ToString(CultureInfo.InvariantCulture);
                builder.Query   = nvc.ToString();
                Response.Redirect(builder.Uri.ToString());
            }
        }
Пример #11
0
    protected void mfbEditFlight1_FlightUpdated(object sender, LogbookEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        // if we had been editing a flight do a redirect so we have a clean URL
        // OR if there are pending redirects, do them.
        // Otherwise, just clean the page.
        if (Request[szParamIDFlight] != null || SocialNetworkAuthorization.RedirectList.Count > 0)
        {
            Response.Redirect(SocialNetworkAuthorization.PopRedirect(Master.IsMobileSession() ? SocialNetworkAuthorization.DefaultRedirPageMini : SocialNetworkAuthorization.DefaultRedirPage));
        }
        else if (e.IDNextFlight != LogbookEntry.idFlightNone)
        {
            Response.Redirect(String.Format(CultureInfo.InvariantCulture, "~/Member/LogbookNew.aspx/{0}{1}", e.IDNextFlight, Request.Url.Query), true);
        }
        else
        {
            Response.Redirect(String.Format(CultureInfo.InvariantCulture, "~/Member/LogbookNew.aspx{0}", Request.Url.Query), true);
        }
    }
Пример #12
0
        protected void mfbEditFlight1_FlightUpdated(object sender, LogbookEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            // if we had been editing a flight do a redirect so we have a clean URL
            // OR if there are pending redirects, do them.
            // Otherwise, just clean the page.
            if (e.IDNextFlight != LogbookEntry.idFlightNone)
            {
                Response.Redirect(String.Format(CultureInfo.InvariantCulture, "~/Member/LogbookNew.aspx/{0}{1}", e.IDNextFlight, SanitizedQuery), true);
            }
            else
            {
                // If this is a new flight, put its assigned ID into the session so that we can scroll to it.
                if (IsNewFlight)
                {
                    Session[keySessLastNewFlight] = e.FlightID;
                }
                Response.Redirect(String.Format(CultureInfo.InvariantCulture, "~/Member/LogbookNew.aspx{0}", SanitizedQuery), true);
            }
        }
Пример #13
0
 protected void mfbEditFlight_FlightUpdated(object sender, LogbookEventArgs e)
 {
     mfbEditFlight.SetUpNewOrEdit(LogbookEntry.idFlightNew);
     AccordionCtrl.SelectedIndex = -1;
     mfbLogbook1.RefreshData();
 }