/// <summary> /// Add a new station to the stations table with the specified ID and name. /// </summary> /// <param name="stationID"></param> /// <param name="stationName"></param> public static void AddStation(long stationID, string stationName, long solarSystemID, long corpID) { try { EveDataSet.staStationsDataTable table = new EveDataSet.staStationsDataTable(); // First make sure this station is not already in the database. lock (stationsTableAdapter) { stationsTableAdapter.FillByIDs(table, stationID.ToString()); } EveDataSet.staStationsRow data = table.FindBystationID((int)stationID); if (data == null) { EveDataSet.staStationsRow newRow = table.NewstaStationsRow(); newRow.stationID = (int)stationID; newRow.stationName = stationName; newRow.corporationID = (int)corpID; newRow.solarSystemID = (int)solarSystemID; EveDataSet.mapSolarSystemsRow systemData = SolarSystems.GetSystem(solarSystemID); newRow.constellationID = systemData.constellationID; newRow.regionID = systemData.regionID; table.AddstaStationsRow(newRow); stationsTableAdapter.Update(table); } else { bool update = false; if (!data.stationName.Equals(stationName)) { data.stationName = stationName; update = true; } if (data.IscorporationIDNull() || data.corporationID != corpID) { data.corporationID = (int)corpID; update = true; } if (update) { stationsTableAdapter.Update(data); } } } catch (Exception ex) { throw new EMMADataException(ExceptionSeverity.Error, "Problem adding station to database.", ex); } }
private void DisplayFilter() { EveDataSet.mapRegionsDataTable regions = Regions.GetAllRegions(); _stations = new EveDataSet.staStationsDataTable(); lstStations.Items.Clear(); lstStations.DisplayMember = "stationName"; lstStations.ValueMember = "stationID"; lstStations.DataSource = _stations; string[] ranges = OrderRange.GetStandardRanges(); cmbRange.Items.AddRange(ranges); cmbRange.SelectedIndex = 0; if (!_filterDetail.Name.Equals("")) { txtLocationName.Text = _filterDetail.Name; txtLocationName.Enabled = false; foreach (EveDataSet.mapRegionsRow region in regions) { chkRegions.Items.Add(new MiniRegion(region.regionID, region.regionName), _filterDetail.Regions.Contains(region.regionID)); } foreach (int station in _filterDetail.Stations) { _stations.ImportRow(Stations.GetStation(station)); } txtStation.Text = Stations.GetStationName(_filterDetail.StationID); cmbRange.SelectedIndex = cmbRange.Items.IndexOf(OrderRange.GetRangeText(_filterDetail.Range)); } else { foreach (EveDataSet.mapRegionsRow region in regions) { chkRegions.Items.Add(new MiniRegion(region.regionID, region.regionName)); } } RefreshDisplay(); }
/// <summary> /// Return a datatable containing all stations in the database /// </summary> /// <returns></returns> public static EveDataSet.staStationsDataTable GetAllStations() { EveDataSet.staStationsDataTable retVal = new EveDataSet.staStationsDataTable(); lock (stationsTableAdapter) { stationsTableAdapter.FillAll(retVal, false); } return retVal; }
/// <summary> /// Get a data table containing all the items specified in the supplied list of IDs /// </summary> /// <param name="ids"></param> /// <returns></returns> private static EveDataSet.staStationsDataTable GetStations(string ids) { EveDataSet.staStationsDataTable stations = new EveDataSet.staStationsDataTable(); lock (stationsTableAdapter) { stationsTableAdapter.FillByIDs(stations, ids); } return stations; }
/// <summary> /// Get a datatable containing all stations where transactions have taken place that /// match the specified parameters /// </summary> /// <param name="accessParams"></param> /// <returns></returns> public static EveDataSet.staStationsDataTable GetStationsTradedIn(List<FinanceAccessParams> accessParams) { StringBuilder stationIDs = new StringBuilder(""); EMMADataSet.IDTableDataTable idTable = Transactions.GetInvolvedStationIDs(accessParams); foreach (EMMADataSet.IDTableRow id in idTable) { stationIDs.Append(" "); stationIDs.Append(id.ID); } EveDataSet.staStationsDataTable retVal = new EveDataSet.staStationsDataTable(); lock (stationsTableAdapter) { stationsTableAdapter.FillByIDs(retVal, stationIDs.ToString()); } return retVal; }
/// <summary> /// Get a list of the IDs of all stations in the specified solar system. /// </summary> /// <param name="systemID"></param> /// <returns></returns> public static List<long> GetStationsInSystem(long systemID) { EveDataSet.staStationsDataTable table = new EveDataSet.staStationsDataTable(); List<long> retVal = new List<long>(); lock (stationsTableAdapter) { stationsTableAdapter.FillBySystem(table, (int)systemID); } foreach (EveDataSet.staStationsRow station in table) { retVal.Add(station.stationID); } return retVal; }
/// <summary> /// Get the specified station. stationName can be the whole name or just part of a name. /// </summary> /// <param name="itemName"></param> /// <returns></returns> public static EveDataSet.staStationsRow GetStation(string stationName) { EveDataSet.staStationsDataTable table = new EveDataSet.staStationsDataTable(); EveDataSet.staStationsRow retVal = null; lock (stationsTableAdapter) { stationsTableAdapter.FillByName(table, "%" + stationName + "%"); } if (table.Count < 1) { throw new EMMADataException(ExceptionSeverity.Error, "No station found matching '" + stationName + "'"); } else if (table.Count > 1) { SortedList<object, string> options = new SortedList<object, string>(); foreach (EveDataSet.staStationsRow station in table) { options.Add(station.stationID, station.stationName); } OptionPicker picker = new OptionPicker("Select Station", "Choose the specific station you " + "want from those listed below.", options); if (picker.ShowDialog() != System.Windows.Forms.DialogResult.Cancel) { retVal = table.FindBystationID((int)picker.SelectedItem); } } else { retVal = table[0]; } return retVal; }
public static EveDataSet.staStationsDataTable GetContractStations(List<long> ownerIDs, ContractStationType type) { StringBuilder stationIDs = new StringBuilder(""); EMMADataSet.IDTableDataTable idTable = Contracts.GetInvolvedStationIDs(ownerIDs, type); foreach (EMMADataSet.IDTableRow id in idTable) { stationIDs.Append(" "); stationIDs.Append(id.ID); } EveDataSet.staStationsDataTable retVal = new EveDataSet.staStationsDataTable(); lock (stationsTableAdapter) { stationsTableAdapter.FillByIDs(retVal, stationIDs.ToString()); } return retVal; }
/// <summary> /// Get a datatable containing all stations where assets are stored that match the /// specified parameters /// </summary> /// <param name="accessParams"></param> /// <param name="itemID"></param> /// <param name="systemID"></param> /// <returns></returns> public static EveDataSet.staStationsDataTable GetAssetStations( List<AssetAccessParams> accessParams, int itemID, long systemID) { StringBuilder stationIDs = new StringBuilder(""); EMMADataSet.IDTableDataTable idTable = Assets.GetInvolvedStationIDs(accessParams, itemID, systemID); foreach (EMMADataSet.IDTableRow id in idTable) { stationIDs.Append(" "); stationIDs.Append(id.ID); } EveDataSet.staStationsDataTable retVal = new EveDataSet.staStationsDataTable(); lock (stationsTableAdapter) { stationsTableAdapter.FillByIDs(retVal, stationIDs.ToString()); } return retVal; }
private void AutoAddConfig_Load(object sender, EventArgs e) { //cmbAddBasedOn.Text = UserAccount.CurrentGroup.Settings.AutoAddItemsBy; txtMinRequired.Text = UserAccount.CurrentGroup.Settings.AutoAddMin.ToString(); txtMinPurchases.Text = UserAccount.CurrentGroup.Settings.AutoAddBuyMin.ToString(); txtMinSales.Text = UserAccount.CurrentGroup.Settings.AutoAddSellMin.ToString(); dtpTransactionStartDate.Value = UserAccount.CurrentGroup.Settings.AutoAddStartDate; _buyStations = new EveDataSet.staStationsDataTable(); lstBuyStations.Items.Clear(); lstBuyStations.DisplayMember = "stationName"; lstBuyStations.ValueMember = "stationID"; lstBuyStations.DataSource = _buyStations; foreach (int stationID in UserAccount.CurrentGroup.Settings.AutoAddBuyStations) { _buyStations.ImportRow(Stations.GetStation(stationID)); } _sellStations = new EveDataSet.staStationsDataTable(); lstSellStations.Items.Clear(); lstSellStations.DisplayMember = "stationName"; lstSellStations.ValueMember = "stationID"; lstSellStations.DataSource = _sellStations; foreach (int stationID in UserAccount.CurrentGroup.Settings.AutoAddSellStations) { _sellStations.ImportRow(Stations.GetStation(stationID)); } }