static private void FetchAll()
        {
            if (cache == null)
            {
                cache = new Dictionary <long, TravelLogUnit>();

                UserDatabase.Instance.ExecuteWithDatabase(cn =>
                {
                    List <TravelLogUnit> list = new List <TravelLogUnit>();

                    using (DbCommand cmd = cn.Connection.CreateCommand("select * from TravelLogUnit"))
                    {
                        using (DbDataReader rdr = cmd.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                TravelLogUnit sys = new TravelLogUnit(rdr);
                                cache[sys.id]     = sys;
                                list.Add(sys);
                            }
                        }
                    }
                });
            }
        }
Esempio n. 2
0
        static public List <TravelLogUnit> GetAll()
        {
            List <TravelLogUnit> list = new List <TravelLogUnit>();

            using (SQLiteConnectionUser cn = new SQLiteConnectionUser(mode: SQLLiteExtensions.SQLExtConnection.AccessMode.Reader))
            {
                using (DbCommand cmd = cn.CreateCommand("select * from TravelLogUnit"))
                {
                    using (DbDataReader rdr = cmd.ExecuteReader())
                    {
                        while (rdr.Read())
                        {
                            TravelLogUnit sys = new TravelLogUnit(rdr);
                            list.Add(sys);
                        }
                    }

                    return(list);
                }
            }
        }
Esempio n. 3
0
        static public List <TravelLogUnit> GetAll()
        {
            return(UserDatabase.Instance.ExecuteWithDatabase <List <TravelLogUnit> >(cn =>
            {
                List <TravelLogUnit> list = new List <TravelLogUnit>();

                using (DbCommand cmd = cn.Connection.CreateCommand("select * from TravelLogUnit"))
                {
                    using (DbDataReader rdr = cmd.ExecuteReader())
                    {
                        while (rdr.Read())
                        {
                            TravelLogUnit sys = new TravelLogUnit(rdr);
                            list.Add(sys);
                        }
                    }
                }

                return list;
            }));
        }
        static private void FetchAll()
        {
            if (cache == null)
            {
                cache = new Dictionary <long, TravelLogUnit>();

                UserDatabase.Instance.ExecuteWithDatabase(cn =>
                {
                    using (DbCommand cmd = cn.Connection.CreateCommand("select * from TravelLogUnit"))
                    {
                        using (DbDataReader rdr = cmd.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                TravelLogUnit sys = new TravelLogUnit(rdr);
                                System.Diagnostics.Debug.Assert(!cache.ContainsKey(sys.ID));
                                cache[sys.ID] = sys;
                            }
                        }
                    }
                });
            }
        }
Esempio n. 5
0
        static public List <TravelLogUnit> GetAll()
        {
            List <TravelLogUnit> list = new List <TravelLogUnit>();

            using (SQLiteConnectionUser cn = new SQLiteConnectionUser(mode: EDDbAccessMode.Reader))
            {
                using (DbCommand cmd = cn.CreateCommand("select * from TravelLogUnit"))
                {
                    DataSet ds = SQLiteDBClass.SQLQueryText(cn, cmd);
                    if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                    {
                        return(list);
                    }

                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        TravelLogUnit sys = new TravelLogUnit(dr);
                        list.Add(sys);
                    }

                    return(list);
                }
            }
        }
Esempio n. 6
0
 public static bool TryGet(long id, out TravelLogUnit tlu)
 {
     tlu = Get(id);
     return(tlu != null);
 }
Esempio n. 7
0
 public static bool TryGet(string name, out TravelLogUnit tlu)
 {
     tlu = Get(name);
     return(tlu != null);
 }