public static Dictionary <string, int> GetLibraryNames() { string module = $"{_product}.{_class}.{MethodBase.GetCurrentMethod().Name}()"; try { Dictionary <string, int> allNames = new Dictionary <string, int>(); SQLiteDataReader names = LibraryModel.GetAllNames(); while (names.Read()) { string name = names["Name"] as string; if (!string.IsNullOrEmpty(name) && name.Length > 3) { int id = int.Parse(names["ChemistryId"].ToString()); if (!allNames.ContainsKey(name)) { allNames.Add(name, id); } } } names.Close(); names.Dispose(); return(allNames); } catch (Exception ex) { new ReportError(Globals.Chem4WordV3.Telemetry, Globals.Chem4WordV3.WordTopLeft, module, ex).ShowDialog(); return(null); } }
public static Dictionary <string, int> GetLibraryNames() { Dictionary <string, int> allNames = new Dictionary <string, int>(); SQLiteDataReader names = LibraryModel.GetAllNames(); while (names.Read()) { string name = names["Name"] as string; if (!string.IsNullOrEmpty(name) && name.Length > 3) { int id = int.Parse(names["ChemistryId"].ToString()); if (!allNames.ContainsKey(name)) { allNames.Add(name, id); } } } names.Close(); names.Dispose(); return(allNames); }