protected void Page_Load(object sender, EventArgs e) { if (ViewState[szKeyVSAircraftInProgress] != null) { m_ac = (Aircraft)ViewState[szKeyVSAircraftInProgress]; } if (!IsPostBack) { cmbCountryCode.DataSource = CountryCodePrefix.CountryCodes(); cmbCountryCode.DataBind(); List <AircraftInstance> lst = new List <AircraftInstance>(AircraftInstance.GetInstanceTypes()); lst.RemoveAll(aic => aic.IsRealAircraft); rblTrainingDevices.DataSource = lst; rblTrainingDevices.DataBind(); rblTrainingDevices.SelectedIndex = 0; InitFormForAircraft(); } else { // If it's an existing aircraft and images may have been uploaded, process them if (!m_ac.IsNew) { ProcessImages(); } } SyncTailToCountry(); SetValidationGroup(mfbMaintainAircraft, "EditAircraft"); }
protected void Page_Init(object sender, EventArgs e) { // For efficiency of viewstate, we repopulate country code on each postback. cmbCountryCode.DataSource = CountryCodePrefix.CountryCodes(); cmbCountryCode.DataBind(); hdnSimCountry.Value = CountryCodePrefix.szSimPrefix; // hack, but avoids "CA1303:Do not pass literals as localized parameters" warning. }
protected void gvCountryCodes_RowCommand(object sender, CommandEventArgs e) { if (e == null) { throw new ArgumentNullException(nameof(e)); } if (e.CommandName.CompareCurrentCultureIgnoreCase("fixHyphens") == 0) { hdnLastCountryEdited.Value = e.CommandArgument.ToString(); CountryCodePrefix ccp = new List <CountryCodePrefix>(CountryCodePrefix.CountryCodes()).Find(ccp1 => ccp1.Prefix.CompareCurrentCultureIgnoreCase(hdnLastCountryEdited.Value) == 0); if (ccp != null) { hdnLastCountryResult.Value = String.Format(CultureInfo.CurrentCulture, "{0} aircraft updated", ccp.ADMINNormalizeMatchingAircraft()); gvCountryCodes.DataBind(); } } }