Exemplo n.º 1
0
 public static EveDataSet.mapSolarSystemsRow GetSystem(long systemID)
 {
     EveDataSet.mapSolarSystemsDataTable table = new EveDataSet.mapSolarSystemsDataTable();
     EveDataSet.mapSolarSystemsRow retVal;
     table = GetSystems(systemID.ToString());
     retVal = table.FindBysolarSystemID((int)systemID);
     return retVal;
 }
Exemplo n.º 2
0
        public static EveDataSet.mapSolarSystemsRow GetSystem(string systemName)
        {
            EveDataSet.mapSolarSystemsDataTable table = new EveDataSet.mapSolarSystemsDataTable();
            EveDataSet.mapSolarSystemsRow retVal = null;

            lock (systemsTableAdapter)
            {
                systemsTableAdapter.FillByName(table, systemName);
            }

            if (table.Count == 0)
            {
                lock (systemsTableAdapter)
                {
                    systemsTableAdapter.FillByName(table, "%" + systemName + "%");
                }

                if (table.Count < 1)
                {
                    throw new EMMADataException(ExceptionSeverity.Error, "No system found matching '" + systemName + "'");
                }
                else if (table.Count > 1)
                {
                    SortedList<object, string> options = new SortedList<object, string>();
                    foreach (EveDataSet.mapSolarSystemsRow system in table)
                    {
                        options.Add(system.solarSystemID, system.solarSystemName);
                    }
                    OptionPicker picker = new OptionPicker("Select System", "Choose the specific system you " +
                        "want from those listed below.", options);
                    if (picker.ShowDialog() != System.Windows.Forms.DialogResult.Cancel)
                    {
                        retVal = table.FindBysolarSystemID((int)picker.SelectedItem);
                    }
                }
                else
                {
                    retVal = table[0];
                }
            }
            else
            {
                retVal = table[0];
            }

            return retVal;
        }