public static bool GetAllSystemNotes() { try { using (SQLiteConnectionUser cn = new SQLiteConnectionUser(mode: EDDbAccessMode.Reader)) { using (DbCommand cmd = cn.CreateCommand("select * from SystemNote")) { DataSet ds = SQLiteDBClass.SQLQueryText(cn, cmd); if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { return(false); } globalSystemNotes.Clear(); foreach (DataRow dr in ds.Tables[0].Rows) { SystemNoteClass sys = new SystemNoteClass(dr); globalSystemNotes.Add(sys); //System.Diagnostics.Debug.WriteLine("Global note " + sys.Journalid + " " + sys.SystemName + " " + sys.Note); } return(true); } } } catch { return(false); } }
public static SystemNoteClass GetSystemNote(long journalid, bool fsd, ISystem sys) { SystemNoteClass systemnote = SystemNoteClass.GetNoteOnJournalEntry(journalid); if (systemnote == null && fsd) // this is for older system name notes { systemnote = SystemNoteClass.GetNoteOnSystem(sys.Name, sys.EDSMID); if (systemnote != null) // if found.. { if (sys.EDSMID > 0 && systemnote.EdsmId <= 0) // if we have a system id, but snc not set, update it for next time. { systemnote.EdsmId = sys.EDSMID; systemnote.Dirty = true; } } } if (systemnote != null) { // System.Diagnostics.Debug.WriteLine("HE " + Journalid + " Found note " + +snc.Journalid + " " + snc.SystemName + " " + snc.Note); } return(systemnote); }
public static SystemNoteClass MakeSystemNote(string text, DateTime time, string sysname, long journalid, bool fsdentry) { SystemNoteClass sys = new SystemNoteClass(); sys.Note = text; sys.Time = time; sys.SystemName = sysname; sys.Journalid = journalid; // any new ones gets a journal id, making the Get always lock it to a journal entry sys.FSDEntry = fsdentry; sys.AddToDbAndGlobal(); // adds it to the global cache AND the db System.Diagnostics.Debug.WriteLine("made note " + sys.Journalid + " " + sys.SystemName + " " + sys.Note); return(sys); }