public void AddWantedSystem(string sysName) { if (wanted == null) { PopulateLocalWantedSystems(); } WantedSystemClass entry = wanted.Where(x => x.system == sysName).FirstOrDefault(); //duplicate? if (entry == null) { WantedSystemClass toAdd = new WantedSystemClass(sysName); // make one.. toAdd.Add(); // add to db. wanted.Add(toAdd); SystemClassDB star = SystemClassDB.GetSystem(sysName); if (star == null) { star = new SystemClassDB(sysName); } var index = dataGridViewClosestSystems.Rows.Add("Local"); dataGridViewClosestSystems[1, index].Value = sysName; dataGridViewClosestSystems[1, index].Tag = star; } }
public void AddWantedSystem(string sysName) { if (wanted == null) { PopulateLocalWantedSystems(); } else { // there can be multiple instances tied to the history form so this might already exist... List <WantedSystemClass> dbCheck = WantedSystemClass.GetAllWantedSystems(); if (dbCheck != null && dbCheck.Where(s => s.system == sysName).Any()) // if we have wanted systems in the DB... and its there.. { return; } } WantedSystemClass entry = wanted.Where(x => x.system == sysName).FirstOrDefault(); //duplicate? if (entry == null) { WantedSystemClass toAdd = new WantedSystemClass(sysName); // make one.. toAdd.Add(); // add to db. wanted.Add(toAdd); ISystem star = SystemCache.FindSystem(sysName); if (star == null) { star = new SystemClass(sysName); } var index = dataGridViewClosestSystems.Rows.Add("Local"); dataGridViewClosestSystems[1, index].Value = sysName; dataGridViewClosestSystems[1, index].Tag = star; } }