コード例 #1
0
    protected void UpdateForUser(string szUser)
    {
        FlightQuery r = Restriction;

        mfbTotalSummary.Username = mfbCurrency.UserName = mfbLogbook.User = szUser;

        if (CurrentShareKey.CanViewTotals)
        {
            mfbTotalSummary.CustomRestriction = mfbLogbook.Restriction = r;
        }

        bool fRestrictionIsDefault = r.IsDefault;

        mfbQueryDescriptor.DataSource = fRestrictionIsDefault ? null : r;
        mfbQueryDescriptor.DataBind();
        apcFilter.LabelControl.Font.Bold = !fRestrictionIsDefault;
        apcFilter.IsEnhanced             = !fRestrictionIsDefault;
        pnlFilter.Visible = !fRestrictionIsDefault;

        if (CurrentShareKey.CanViewFlights)
        {
            mfbLogbook.RefreshData();
        }

        mfbChartTotals.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook.Data, r.UserName);
        mfbChartTotals.Refresh();

        if (CurrentShareKey.CanViewVisitedAirports)
        {
            RefreshVisitedAirports();
        }
    }
コード例 #2
0
        protected void Refresh()
        {
            bool fRestrictionIsDefault = Restriction.IsDefault;

            mfbLogbook1.DetailsParam = fRestrictionIsDefault ? string.Empty : "fq=" + HttpUtility.UrlEncode(Restriction.ToBase64CompressedJSONString());
            mfbLogbook1.User         = Page.User.Identity.Name;
            mfbLogbook1.Restriction  = Restriction;
            mfbLogbook1.RefreshData();
            if (mfbChartTotals1.Visible)
            {
                mfbChartTotals1.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook1.Data, Restriction.UserName);
                mfbChartTotals1.Refresh();
            }
            if (mfbTotalSummary1.Visible)
            {
                mfbTotalSummary1.CustomRestriction = Restriction;
            }
            ResolvePrintLink();
            pnlFilter.Visible = !fRestrictionIsDefault && IsNewFlight;
            mfbQueryDescriptor1.DataSource   = fRestrictionIsDefault ? null : Restriction;
            apcFilter.LabelControl.Font.Bold = !fRestrictionIsDefault;
            apcFilter.IsEnhanced             = !fRestrictionIsDefault;

            if (!IsNewFlight)
            {
                mfbLogbook1.GetNeighbors(FlightID, out int prevFlightID, out int nextFlightID);
                mfbEditFlight1.SetPrevFlight(prevFlightID);
                mfbEditFlight1.SetNextFlight(nextFlightID);
            }

            mfbQueryDescriptor1.DataBind();
        }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.SelectedTab = tabID.tabTraining;

        if (!IsPostBack)
        {
            hdnStudent.Value = Page.User.Identity.Name; //default
            string            szStudent = util.GetStringParam(Request, "student");
            CFIStudentMap     sm        = new CFIStudentMap(Page.User.Identity.Name);
            InstructorStudent student   = CFIStudentMap.GetInstructorStudent(sm.Students, szStudent);
            if (student == null)
            {
                lblErr.Text = Resources.SignOff.ViewStudentNoSuchStudent;
            }
            else
            {
                if (!student.CanViewLogbook)
                {
                    lblErr.Text = Master.Title = Resources.SignOff.ViewStudentLogbookUnauthorized;
                }
                else
                {
                    // If we're here, we are authorized
                    lblHeader.Text   = String.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.SignOff.ViewStudentLogbookHeader, student.UserFullName);
                    hdnStudent.Value = student.UserName;
                    Restriction      = new FlightQuery(student.UserName);

                    if (mfbLogbook1.CanResignValidFlights = student.CanAddLogbook)
                    {
                        mfbEditFlight.FlightUser = student.UserName;
                        mfbEditFlight.SetUpNewOrEdit(LogbookEntry.idFlightNew);
                    }
                    else
                    {
                        apcNewFlight.Visible = false;
                    }

                    if (!String.IsNullOrEmpty(hdnStudent.Value))
                    {
                        UpdateForUser(hdnStudent.Value);
                    }

                    mfbSearchForm.Username = printOptions.UserName = student.UserName;
                    ResolvePrintLink();
                }
            }

            pnlLogbook.Visible = (lblErr.Text.Length == 0);
        }

        if (pnlLogbook.Visible && mfbChartTotals.Visible)
        {
            mfbChartTotals.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook1.Data, hdnStudent.Value);   // do this every time, since charttotals doesn't persist its data.
        }
    }
コード例 #4
0
    protected void apcAnalysis_ControlClicked(object sender, EventArgs e)
    {
        apcAnalysis.LazyLoad = false;
        int idx = mfbAccordionProxyExtender.IndexForProxyID(apcAnalysis.ID);

        mfbAccordionProxyExtender.SetJavascriptForControl(apcAnalysis, true, idx);
        AccordionCtrl.SelectedIndex = idx;

        mfbChartTotals.Visible          = true;
        mfbChartTotals.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook1.Data, hdnStudent.Value);
        mfbChartTotals.Refresh();
    }
コード例 #5
0
    protected void UpdateQuery()
    {
        Restriction = mfbSearchForm.Restriction;
        UpdateForUser(hdnStudent.Value);
        AccordionCtrl.SelectedIndex = -1;
        apcAnalysis.LazyLoad        = true;
        mfbChartTotals.Visible      = false;
        int idx = mfbAccordionProxyExtender.IndexForProxyID(apcAnalysis.ID);

        if (idx == AccordionCtrl.SelectedIndex)
        {
            AccordionCtrl.SelectedIndex = -1;
        }
        mfbAccordionProxyExtender.SetJavascriptForControl(apcAnalysis, false, idx);
        mfbChartTotals.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook1.Data, hdnStudent.Value);
        mfbChartTotals.Refresh();
    }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Master.SelectedTab = tabID.tabLogbook;

            mfbChartTotals1.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook1.Data, User.Identity.Name);  // do this every time.

            if (!IsPostBack)
            {
                ModalPopupExtender1.OnCancelScript = String.Format(CultureInfo.InvariantCulture, "javascript:document.getElementById('{0}').style.display = 'none';", pnlWelcomeNewUser.ClientID);

                if (Request.Cookies[MFBConstants.keyNewUser] != null && !String.IsNullOrEmpty(Request.Cookies[MFBConstants.keyNewUser].Value) || util.GetStringParam(Request, "sw").Length > 0 || Request.PathInfo.Contains("/sw"))
                {
                    Response.Cookies[MFBConstants.keyNewUser].Expires = DateTime.Now.AddDays(-1);
                    ModalPopupExtender1.Show();
                }

                rblTotalsMode.SelectedValue = mfbTotalSummary1.DefaultGroupMode.ToString(CultureInfo.InvariantCulture);

                // Handle a requested tab - turning of lazy load as needed
                string szReqTab = util.GetStringParam(Request, "ft");
                if (!String.IsNullOrEmpty(szReqTab))
                {
                    if (Enum.TryParse <FlightsTab>(szReqTab, out FlightsTab ft))
                    {
                        AccordionCtrl.SelectedIndex = (int)ft - 1;
                        switch (ft)
                        {
                        case FlightsTab.Currency:
                            apcCurrency_ControlClicked(apcCurrency, null);
                            break;

                        case FlightsTab.Totals:
                            apcTotals_ControlClicked(apcTotals, null);
                            break;

                        case FlightsTab.Analysis:
                            apcAnalysis_ControlClicked(apcAnalysis, null);
                            break;

                        default:
                            break;
                        }
                    }
                }

                int idFlight = util.GetIntParam(Request, szParamIDFlight, LogbookEntry.idFlightNew);

                // Redirect to the non-querystring based page so that Ajax file upload works
                if (idFlight != LogbookEntry.idFlightNew)
                {
                    string szNew = Request.Url.PathAndQuery.Replace(".aspx", String.Format(CultureInfo.InvariantCulture, ".aspx/{0}", idFlight)).Replace(String.Format(CultureInfo.InvariantCulture, "{0}={1}", szParamIDFlight, idFlight), string.Empty).Replace("?&", "?");
                    Response.Redirect(szNew, true);
                    return;
                }

                if (Request.PathInfo.Length > 0 && Int32.TryParse(Request.PathInfo.Substring(1), out int id))
                {
                    idFlight = id;
                }

                SetUpForFlight(idFlight);

                InitializeRestriction();

                // Expand the New Flight box if we're editing an existing flight
                if (idFlight != LogbookEntry.idFlightNew || !String.IsNullOrEmpty(util.GetStringParam(Request, "src")))
                {
                    AccordionCtrl.SelectedIndex = 0;
                }

                string szTitle = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.LogbookForUserHeader, MyFlightbook.Profile.GetUser(User.Identity.Name).UserFullName);
                lblUserName.Text = Master.Title = HttpUtility.HtmlEncode(szTitle);

                // See if we just entered a new flight and scroll to it as needed
                if (Session[keySessLastNewFlight] != null)
                {
                    mfbLogbook1.ScrollToFlight((int)Session[keySessLastNewFlight]);
                    Session[keySessLastNewFlight] = null;
                }
            }
        }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ShareKey sk = CurrentShareKey;  // set in Page_Init
            Profile  pf = Profile.GetUser(sk.Username);

            lblHeader.Text = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.LogbookForUserHeader, pf.UserFullName);

            // Indicate success.
            sk.FUpdateAccess();

            int privCount = sk.PrivilegeCount;

            apcAnalysis.Container.Style["display"]   = apcCurrency.Container.Style["display"] = apcTotals.Container.Style["display"] =
                apcFilter.Container.Style["display"] = apcAchievements.Container.Style["display"] = apcAirports.Container.Style["display"] = "none";

            if (sk.CanViewCurrency)
            {
                apcCurrency.Container.Style["display"] = "inline-block";
                mfbCurrency.Visible  = true;
                mfbCurrency.UserName = sk.Username;
                mfbCurrency.RefreshCurrencyTable();
                if (privCount == 1) // if ONLY showing currency, expand it and hide the accordion
                {
                    pnlAccordionMenuContainer.Visible = false;
                    SetAccordionPane(acpPaneCurrency.ID);
                }
            }

            if (sk.CanViewTotals)
            {
                apcTotals.Container.Style["display"] = "inline-block";
                mfbTotalSummary.Visible           = true;
                mfbTotalSummary.Username          = sk.Username;
                mfbTotalSummary.CustomRestriction = new FlightQuery(sk.Username); // will call bind

                if (privCount == 1)                                               // if ONLY showing totals, expand it and hide the accordion
                {
                    pnlAccordionMenuContainer.Visible = false;
                    SetAccordionPane(acpPaneTotals.ID);
                }
            }

            if (sk.CanViewFlights)
            {
                apcAnalysis.Container.Style["display"] = apcFilter.Container.Style["display"] = "inline-block";
                mfbLogbook.Visible     = true;
                mfbSearchForm.Username = mfbLogbook.User = sk.Username;
                mfbLogbook.RefreshData();

                mfbChartTotals.Visible = true;
            }

            if (sk.CanViewAchievements)
            {
                apcAchievements.Container.Style["display"] = "inline-block";
                mfbRecentAchievements.Visible = mvBadges.Visible = true;

                List <Badge> lst = new Achievement(sk.Username).BadgesForUser();
                if (lst == null || lst.Count == 0)
                {
                    mvBadges.SetActiveView(vwNoBadges);
                }
                else
                {
                    mvBadges.SetActiveView(vwBadges);
                    rptBadgeset.DataSource = BadgeSet.BadgeSetsFromBadges(lst);
                    rptBadgeset.DataBind();
                }
                mfbRecentAchievements.AutoDateRange = true;
                mfbRecentAchievements.Refresh(sk.Username, DateTime.MaxValue, DateTime.MinValue, false);
                lblRecentAchievementsTitle.Text = mfbRecentAchievements.Summary;
                if (privCount == 1) // if ONLY showing achievements, expand it
                {
                    SetAccordionPane(acpPaneAchievements.ID);
                }
            }

            if (sk.CanViewVisitedAirports)
            {
                apcAirports.Container.Style["display"] = "inline-block";
                Restriction.UserName = mfbSearchForm.Username = mfbLogbook.User = sk.Username;
                if (privCount == 1) // if ONLY showing airports, expand it
                {
                    SetAccordionPane(acpPaneAirports.ID);
                }
            }
        }

        if (mfbLogbook.Visible && apcAnalysis.Visible)
        {
            mfbChartTotals.HistogramManager = LogbookEntryDisplay.GetHistogramManager(mfbLogbook.Data, CurrentShareKey.Username);   // do this every time, since charttotals doesn't persist its data.
            mfbChartTotals.Refresh();
        }

        if (CurrentShareKey.CanViewVisitedAirports)
        {
            RefreshVisitedAirports();
        }
    }