コード例 #1
0
        public static List <WantedSystemClass> GetAllWantedSystems()
        {
            try
            {
                using (SQLiteConnectionUser cn = new SQLiteConnectionUser(mode: EDDbAccessMode.Reader))
                {
                    using (DbCommand cmd = cn.CreateCommand("select * from wanted_systems"))
                    {
                        DataSet ds = SQLiteDBClass.SQLQueryText(cn, cmd);
                        if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            return(null);
                        }

                        List <WantedSystemClass> retVal = new List <WantedSystemClass>();

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

                        return(retVal);
                    }
                }
            }
            catch
            {
                return(null);
            }
        }
コード例 #2
0
        public static List <WantedSystemClass> GetAllWantedSystems()     // CAN return null
        {
            try
            {
                using (SQLiteConnectionUser cn = new SQLiteConnectionUser(mode: SQLLiteExtensions.SQLExtConnection.AccessMode.Reader))
                {
                    using (DbCommand cmd = cn.CreateCommand("select * from wanted_systems"))
                    {
                        DataSet ds = cn.SQLQueryText(cmd);
                        if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                        {
                            return(null);
                        }

                        List <WantedSystemClass> retVal = new List <WantedSystemClass>();

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

                        return(retVal);
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception " + ex.ToString());
                return(null);
            }
        }
コード例 #3
0
        public static List <WantedSystemClass> GetAllWantedSystems()     // CAN return null
        {
            try
            {
                using (SQLiteConnectionUser cn = new SQLiteConnectionUser(mode: SQLLiteExtensions.SQLExtConnection.AccessMode.Reader))
                {
                    using (DbCommand cmd = cn.CreateCommand("select * from wanted_systems"))
                    {
                        List <WantedSystemClass> retVal = new List <WantedSystemClass>();

                        using (DbDataReader rdr = cmd.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                WantedSystemClass sys = new WantedSystemClass(rdr);
                                retVal.Add(sys);
                            }
                        }

                        return(retVal);
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception " + ex.ToString());
                return(null);
            }
        }
コード例 #4
0
        public static List <WantedSystemClass> GetAllWantedSystems()     // CAN return null
        {
            try
            {
                return(UserDatabase.Instance.ExecuteWithDatabase <List <WantedSystemClass> >(cn =>
                {
                    using (DbCommand cmd = cn.Connection.CreateCommand("select * from wanted_systems"))
                    {
                        List <WantedSystemClass> retVal = new List <WantedSystemClass>();

                        using (DbDataReader rdr = cmd.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                WantedSystemClass sys = new WantedSystemClass(rdr);
                                retVal.Add(sys);
                            }
                        }

                        return retVal;
                    }
                }));
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception " + ex.ToString());
                return(null);
            }
        }