Пример #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()
        {
            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);
            }
        }
Пример #3
0
        public List <WantedSystemClass> GetAllWantedSystems()
        {
            try
            {
                using (SQLiteConnection cn = new SQLiteConnection(ConnectionString))
                {
                    using (SQLiteCommand cmd = new SQLiteCommand())
                    {
                        DataSet ds = null;
                        cmd.Connection     = cn;
                        cmd.CommandType    = CommandType.Text;
                        cmd.CommandTimeout = 30;
                        cmd.CommandText    = "select * from wanted_systems";

                        ds = SqlQueryText(cn, cmd);
                        if (ds.Tables.Count == 0)
                        {
                            return(null);
                        }
                        //
                        if (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);
            }
        }
Пример #4
0
        public void AddWantedSystem(string sysName)
        {
            if (wanted == null) wanted = new List<WantedSystemClass>();
            WantedSystemClass entry = wanted.Where(x => x.system == sysName).FirstOrDefault();
            if (entry == null)
            {
                WantedSystemClass toAdd = new WantedSystemClass(sysName);
                wanted.Add(toAdd);
                SystemClass star = SystemClass.GetSystem(sysName);
                if (star == null)
                    star = new SystemClass(sysName);

                var index = dataGridViewClosestSystems.Rows.Add("Local");
                dataGridViewClosestSystems[1, index].Value = sysName;
                dataGridViewClosestSystems[1, index].Tag = star;
            }
        }
Пример #5
0
        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);

                SystemClass star = SystemClass.GetSystem(sysName);
                if (star == null)
                    star = new SystemClass(sysName);

                var index = dataGridViewClosestSystems.Rows.Add("Local");
                dataGridViewClosestSystems[1, index].Value = sysName;
                dataGridViewClosestSystems[1, index].Tag = star;
            }
        }