public LocalisationDetailForm(CollectionEventLocalisation ceLoc) : this(true) { if (ceLoc != null) { this._ceLoc = ceLoc; Cursor.Current = Cursors.WaitCursor; LocalisationSystem locSystem = null; try { locSystem = DataFunctions.Instance.RetrieveLocalisationSystem((int)_ceLoc.LocalisationSystemID); } catch (ConnectionCorruptedException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); this.Close(); } // fill Form if (locSystem != null) this.labelCaption.Text = locSystem.LocalisationSystemName; if (_ceLoc.LocationAccuracy != null) this.textBoxLocAccuracy.Text = _ceLoc.LocationAccuracy; if (_ceLoc.Location1 != null) { this.textBoxLocation1.Text = _ceLoc.Location1; } if (_ceLoc.Location2 != null) { this.textBoxLocation2.Text = _ceLoc.Location2; } if (_ceLoc.ResponsibleName != null) this.textBoxResponsibleName.Text = _ceLoc.ResponsibleName; if (_ceLoc.DeterminationDate > DateTime.MinValue) { if (_ceLoc.DeterminationDate.CompareTo(this.dateTimePickerDeterminationDate.MinDate) >= 0) { try { if (!UserProfiles.Instance.Current.Context.Equals("ManagementMobile")) { this.dateTimePickerDeterminationDate.Visible = true; } } catch (ConnectionCorruptedException) { this.dateTimePickerDeterminationDate.Visible = false; } this.buttonNewDate.Visible = false; this.dateTimePickerDeterminationDate.Value = _ceLoc.DeterminationDate; } } else { this.dateTimePickerDeterminationDate.Visible = false; try { if (!UserProfiles.Instance.Current.Context.Equals("ManagementMobile")) { this.buttonNewDate.Visible = true; } } catch (ConnectionCorruptedException) { this.dateTimePickerDeterminationDate.Visible = false; } } // Altitude Localisation if (this._ceLoc.LocalisationSystemID == 4) { this.textBoxLocation2.Enabled = false; this.buttonShowMap.Enabled = false; } if (_ceLoc.AverageLongitudeCache != null) { this.labelLongitude.Text = ((double)_ceLoc.AverageLongitudeCache).ToString("F"); } if (_ceLoc.AverageLatitudeCache != null) { this.labelLatitude.Text = ((double)_ceLoc.AverageLatitudeCache).ToString("F"); } if (_ceLoc.AverageAltitudeCache != null) { this.labelAltitude.Text = ((double)_ceLoc.AverageAltitudeCache).ToString("F"); } Cursor.Current = Cursors.Default; } else this.Close(); }
public void parameterizeCollectionEventLocalisationNode(CollectionEventLocalisation ceLoc, TreeNode node) { if (ceLoc != null && node != null) { IRestriction res = RestrictionFactory.Eq(typeof(LocalisationSystem), "_LocalisationSystemID", ceLoc.LocalisationSystemID); LocalisationSystem loc = this.con.Load<LocalisationSystem>(res); if (loc != null) { StringBuilder sb = new StringBuilder(); if (loc.LocalisationSystemID == 8) { try { String latD = ""; String lonD = ""; double lat = Double.Parse(ceLoc.Location2, System.Globalization.NumberStyles.AllowDecimalPoint); double lon = Double.Parse(ceLoc.Location1, System.Globalization.NumberStyles.AllowDecimalPoint); if (lat >= 0) latD = "N "; else latD = "S "; if (lon >= 0) lonD = "O "; else lonD = "W "; sb.Append(TreeViewOperations.dec2degree(lat)).Append(latD).Append(@";").Append(TreeViewOperations.dec2degree(lon)).Append(lonD); } catch (Exception) { sb.Append(ceLoc.Location1).Append(@";").Append(ceLoc.Location2); } } else if (loc.LocalisationSystemID == 4) { try { double alt = Double.Parse(ceLoc.Location1); sb.Append(alt.ToString("F")); sb.Append(" mNN"); } catch (Exception) { sb.Append(ceLoc.Location1).Append(@";").Append(ceLoc.Location2); } } else { sb.Append(ceLoc.Location1).Append(@";").Append(ceLoc.Location2); } node.Text = sb.ToString(); node.ImageIndex = node.SelectedImageIndex = (int)TreeViewIconIndex.Location; node.Tag = new TreeViewNodeData((int)ceLoc.LocalisationSystemID, TreeViewNodeTypes.LocalisationNode); } } }
public NewGPSLocalisationForm(CollectionEventLocalisation alt, CollectionEventLocalisation gps) : this(true) { this._start = true; Cursor.Current = Cursors.WaitCursor; if (alt != null) { this.locAlt = alt; } if (gps != null) { this.locGPS = gps; } // fill Form if (locGPS != null) { this.textBoxLongitude.Text = locGPS.Location1; this.textBoxLatitude.Text = locGPS.Location2; } if (locAlt != null) this.textBoxAltitude.Text = locAlt.Location1; Cursor.Current = Cursors.Default; this._start = false; }
public EventLocalisationVM(CollectionEventLocalisation l) : base(l) { }