public static void PopulateAirport(Control plc, airport ap, MatchStatus ms, airport aicBase) { if (ap == null) { return; } if (plc == null) { throw new ArgumentNullException(nameof(plc)); } Panel p = new Panel(); plc.Controls.Add(p); Label lbl = new Label(); p.Controls.Add(lbl); lbl.Text = ap.ToString(); p.Controls.Add(new LiteralControl("<br />")); if (!StatusIsOK(ms)) { p.CssClass = "notOK"; Label lblStatus = new Label(); p.Controls.Add(lblStatus); lblStatus.Text = String.Format(CultureInfo.CurrentCulture, Resources.Admin.ImportAirportStatusTemplate, ms.ToString()); lblStatus.ForeColor = System.Drawing.Color.Red; if (aicBase != null && ap.LatLong != null && aicBase.LatLong != null) { Label lblDist = new Label(); p.Controls.Add(lblDist); lblDist.Text = String.Format(CultureInfo.CurrentCulture, Resources.Admin.ImportAirportDistanceTemplate, aicBase.DistanceFromAirport(ap)); } } HyperLink h = new HyperLink(); p.Controls.Add(h); h.Text = ap.LatLong.ToDegMinSecString(); h.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "javascript:updateForAirport({0});", JsonConvert.SerializeObject(ap, new JsonSerializerSettings() { DefaultValueHandling = DefaultValueHandling.Ignore })); if (!String.IsNullOrEmpty(ap.UserName)) { p.Controls.Add(new LiteralControl(String.Format(CultureInfo.InvariantCulture, "{0}<br />", ap.UserName))); } }
private static void PopulateAirport(Control plc, airport ap, airportImportCandidate.MatchStatus ms, airport aicBase) { if (ap == null) { return; } Panel p = new Panel(); plc.Controls.Add(p); Label lbl = new Label(); p.Controls.Add(lbl); lbl.Text = ap.ToString(); p.Controls.Add(new LiteralControl("<br />")); if (!airportImportCandidate.StatusIsOK(ms)) { p.BackColor = System.Drawing.Color.LightGray; Label lblStatus = new Label(); p.Controls.Add(lblStatus); lblStatus.Text = String.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Admin.ImportAirportStatusTemplate, ms.ToString()); lblStatus.ForeColor = System.Drawing.Color.Red; if (aicBase != null && ap.LatLong != null && aicBase.LatLong != null) { Label lblDist = new Label(); p.Controls.Add(lblDist); lblDist.Text = String.Format(System.Globalization.CultureInfo.CurrentCulture, Resources.Admin.ImportAirportDistanceTemplate, aicBase.DistanceFromAirport(ap)); } } HyperLink h = new HyperLink(); p.Controls.Add(h); h.Text = ap.LatLong.ToDegMinSecString(); h.NavigateUrl = String.Format(CultureInfo.InvariantCulture, "javascript:updateForAirport('{0}', '{1}', '{2}', {3}, {4});", ap.Code, ap.Name.JavascriptEncode(), ap.FacilityTypeCode, ap.LatLong.Latitude, ap.LatLong.Longitude); if (!String.IsNullOrEmpty(ap.UserName)) { p.Controls.Add(new LiteralControl(String.Format(CultureInfo.InvariantCulture, "{0}<br />", ap.UserName))); } }