/// <summary> /// Same as BFREvents except that if BFREvents is null it hits the database first. /// </summary> private ProfileEvent[] CachedBFREvents() { if (BFREvents == null) { BFREvents = ProfileEvent.GetBFREvents(CurrentUser.UserName, LastBFREvent); } return(BFREvents); }
protected static IDictionary <string, object> PilotInfo(Profile pf) { if (pf == null) { throw new ArgumentNullException(nameof(pf)); } return(new Dictionary <string, object> { ["Given Name"] = String.IsNullOrEmpty(pf.UserFirstName) ? string.Empty : pf.UserFirstName, ["Family Name"] = String.IsNullOrEmpty(pf.UserLastName) ? string.Empty : pf.UserLastName, ["Email"] = String.IsNullOrEmpty(pf.Email) ? string.Empty : pf.Email, ["Address"] = String.IsNullOrEmpty(pf.Address) ? string.Empty : pf.Address, ["CFICertificate"] = String.IsNullOrEmpty(pf.CFIDisplay) ? string.Empty : pf.CFIDisplay, ["Certificate"] = String.IsNullOrEmpty(pf.LicenseDisplay) ? string.Empty : pf.LicenseDisplay, ["Last Medical"] = pf.LastMedical.HasValue() ? pf.LastMedical.YMDString() : string.Empty, ["Medical Duration (months)"] = pf.LastMedical.HasValue() ? pf.MonthsToMedical.ToString(CultureInfo.InvariantCulture) : string.Empty, ["English Proficiency"] = pf.EnglishProficiencyExpiration.HasValue() ? pf.EnglishProficiencyExpiration.YMDString() : string.Empty, ["Flight Reviews"] = ProfileEvent.AsPublicList(ProfileEvent.GetBFREvents(pf.UserName, pf.LastBFREvent)), ["IPCs"] = ProfileEvent.AsPublicList(ProfileEvent.GetIPCEvents(pf.UserName)), ["Ratings"] = new Achievements.UserRatings(pf.UserName).AsKeyValuePairs() }); }
private void InitPilotInfo() { dateMedical.Date = m_pf.LastMedical; cmbMonthsMedical.SelectedValue = m_pf.MonthsToMedical.ToString(CultureInfo.CurrentCulture); rblMedicalDurationType.SelectedIndex = m_pf.UsesICAOMedical ? 1 : 0; txtCertificate.Text = m_pf.Certificate; txtLicense.Text = m_pf.License; mfbTypeInDateCFIExpiration.Date = m_pf.CertificateExpiration; mfbDateEnglishCheck.Date = m_pf.EnglishProficiencyExpiration; UpdateNextMedical(m_pf); BasicMedManager.RefreshBasicMedEvents(); gvIPC.DataSource = ProfileEvent.GetIPCEvents(User.Identity.Name); gvIPC.DataBind(); MyFlightbook.Achievements.UserRatings ur = new MyFlightbook.Achievements.UserRatings(m_pf.UserName); gvRatings.DataSource = ur.Licenses; gvRatings.DataBind(); ProfileEvent[] rgpfeBFR = ProfileEvent.GetBFREvents(User.Identity.Name, m_pf.LastBFREvent); gvBFR.DataSource = rgpfeBFR; gvBFR.DataBind(); if (rgpfeBFR.Length > 0) // we have at least one BFR event, so the last one should be the most recent. { lblNextBFR.Text = m_pf.NextBFR(rgpfeBFR[rgpfeBFR.Length - 1].Date).ToShortDateString(); pnlNextBFR.Visible = true; } string szPane = Request["pane"]; if (!String.IsNullOrEmpty(szPane)) { for (int i = 0; i < accordianPilotInfo.Panes.Count; i++) { switch (szPane) { case "medical": if (accordianPilotInfo.Panes[i] == acpMedical) { accordianPilotInfo.SelectedIndex = i; } break; case "certificates": if (accordianPilotInfo.Panes[i] == acpCertificates) { accordianPilotInfo.SelectedIndex = i; } break; case "flightreview": if (accordianPilotInfo.Panes[i] == acpFlightReviews) { accordianPilotInfo.SelectedIndex = i; } break; case "ipc": if (accordianPilotInfo.Panes[i] == acpIPCs) { accordianPilotInfo.SelectedIndex = i; } break; default: break; } } } }
public void InitPilotInfo() { mfbEASATip.BodyContent = Branding.ReBrand(Resources.Preferences.MedicalEASATip); dateMedical.Date = m_pf.LastMedical; dateMedical.TextControl.ValidationGroup = "valPilotInfo"; MonthsToMedical = m_pf.MonthsToMedical; MedicalType mt = new ProfileCurrency(m_pf).TypeOfMedical; SelectedMedicalType = mt; dateDOB.Date = m_pf.DateOfBirth ?? DateTime.MinValue; UpdateForMedicalType(mt); UsesICAOMedical = m_pf.UsesICAOMedical; UpdateNextMedical(); txtCertificate.Text = m_pf.Certificate; txtLicense.Text = m_pf.License; txtLicense.Attributes["dir"] = txtCertificate.Attributes["dir"] = "auto"; txtMedicalNotes.Text = m_pf.GetPreferenceForKey(MFBConstants.keyMedicalNotes) ?? string.Empty; mfbTypeInDateCFIExpiration.Date = m_pf.CertificateExpiration; mfbDateEnglishCheck.Date = m_pf.EnglishProficiencyExpiration; BasicMedManager.RefreshBasicMedEvents(); gvIPC.DataSource = ProfileEvent.GetIPCEvents(Page.User.Identity.Name); gvIPC.DataBind(); Achievements.UserRatings ur = new Achievements.UserRatings(m_pf.UserName); gvRatings.DataSource = ur.Licenses; gvRatings.DataBind(); ProfileCurrency mc = new ProfileCurrency(m_pf); ProfileEvent[] rgpfeBFR = ProfileEvent.GetBFREvents(Page.User.Identity.Name, mc.LastBFREvent); gvBFR.DataSource = rgpfeBFR; gvBFR.DataBind(); if (rgpfeBFR.Any()) // we have at least one BFR event, so the first one should be the most recent. { lblNextBFR.Text = ProfileCurrency.NextBFR(rgpfeBFR[0].Date).ToShortDateString(); pnlNextBFR.Visible = true; } string szPane = Request["pane"]; if (!String.IsNullOrEmpty(szPane)) { for (int i = 0; i < accordianPilotInfo.Panes.Count; i++) { switch (szPane) { case "medical": if (accordianPilotInfo.Panes[i] == acpMedical) { accordianPilotInfo.SelectedIndex = i; } break; case "certificates": if (accordianPilotInfo.Panes[i] == acpCertificates) { accordianPilotInfo.SelectedIndex = i; } break; case "flightreview": if (accordianPilotInfo.Panes[i] == acpFlightReviews) { accordianPilotInfo.SelectedIndex = i; } break; case "ipc": if (accordianPilotInfo.Panes[i] == acpIPCs) { accordianPilotInfo.SelectedIndex = i; } break; default: break; } } } }