public Station[] GetStations() { DataView _DataView = m_StationsDataSet.Tables[0].DefaultView; _DataView.Sort = "Order"; Station[] result = new Station[_DataView.Count]; int index = 0; foreach (DataRowView _Row in _DataView) { result[index] = new Station { StationID = int.Parse(_Row["StationID"].ToString()), StationIndex = int.Parse(_Row["Order"].ToString()), Name = _Row["Name"].ToString(), Latitude = Convert.ToDouble(_Row["Lat"].ToString().Replace('.', ',')), Longitude = Convert.ToDouble(_Row["Lon"].ToString().Replace('.', ',')) }; index++; } if (UseLastStation) { result[result.Length - 1].PerformAlert = true; } else { SensePanelComboItem _Cbo = (senseListCtrlAlert["Stations"] as SensePanelComboItem); SensePanelComboItem.Item _Item = (_Cbo.Items[_Cbo.SelectedIndex] as SensePanelComboItem.Item); string _StationID = _Item.Value.ToString(); //DataRowView _DataRowView = (cboStations.SelectedItem as DataRowView); //string _StationID = _DataRowView["StationID"].ToString(); var StationSelected = from _Station in result where _Station.StationID.ToString() == _StationID select _Station; if (StationSelected.SingleOrDefault() != null) { StationSelected.SingleOrDefault().PerformAlert = true; } } _DataView.Sort = "StationID"; return result; }
public Station GetStation() { Station _Station = null; DataRow _DataRow = null; SensePanelComboItem _Cbo = null; try { _Cbo = (senseListCtrlAlert[(UseLastStation ? "Routes" : "Stations")] as SensePanelComboItem); } catch { } if (null != _Cbo) { SensePanelComboItem.Item _Item = (_Cbo.Items[_Cbo.SelectedIndex] as SensePanelComboItem.Item); if (null != _Item) { string _ID = _Item.Value.ToString(); _DataRow = (UseLastStation ? m_Storage.GetLastStationForRoute(_ID) : m_Storage.GetStationByID(_ID)); if (null != _DataRow) { _Station = new Station { Name = _DataRow["Name"].ToString(), Latitude = Convert.ToDouble(_DataRow["Lat"].ToString().Replace('.', ',')), Longitude = Convert.ToDouble(_DataRow["Lon"].ToString().Replace('.', ',')) }; } } } return _Station; }