예제 #1
0
        /// <summary>
        /// This gives you all the planet infomation if you give it the planet id. No resource info.
        /// </summary>
        /// <param name="planet_id"></param>
        /// <returns></returns>
        public List <Planetdata> getPlanet(int planet_id)
        {
            List <Planetdata> result = new List <Planetdata>();

            if (Check())
            {
                string Query = string.Format("SELECT planet.Planet_id, planet.Title, planet.X_loc, planet.Y_loc, media.Media_id, media.file_Loc FROM planet, media, planetmedia WHERE planet.Planet_id == planetmedia.Planet_id AND planetmedia.Media_id == media.Media_id AND planet.Planet_id = {0};", planet_id);
                using (SQLiteCommand command = new SQLiteCommand(Query, dbc))
                {
                    try
                    {
                        using (SQLiteDataReader rdq = command.ExecuteReader())
                        {
                            while (rdq.Read())
                            {
                                Planetdata record = new Planetdata(rdq.GetInt32(0), rdq.GetString(1), rdq.GetInt32(2), rdq.GetInt32(3), rdq.GetInt32(4), rdq.GetString(5));
                                result.Add(record);
                            }
                        }
                    }
                    catch (Exception ex) { Console.WriteLine("Error " + ex); }
                }
            }

            return(result);
        }
예제 #2
0
        public List <Planetdata> SessionWithPlanet(int session)
        {
            Console.WriteLine("SWP sess =" + session);
            List <Planetdata> result = new List <Planetdata>();

            if (Check())
            {
                string Query = String.Format("SELECT planet.Planet_id, planet.Title, planet.X_loc, planet.Y_loc, media.Media_id, media.file_Loc FROM planet, media, planetmedia WHERE (planet.Planet_id == planetmedia.Planet_id AND planetmedia.Media_id == media.Media_id) AND planet.Planet_id IN (SELECT Planet_id FROM sessiontoplanet WHERE Session_id = {0})", session);

                using (SQLiteCommand command = new SQLiteCommand(Query, dbc))
                {
                    try
                    {
                        using (SQLiteDataReader rdq = command.ExecuteReader())
                        {
                            while (rdq.Read())
                            {
                                Planetdata line = new Planetdata(rdq.GetInt32(0), rdq.GetString(1), rdq.GetInt32(2), rdq.GetInt32(3), rdq.GetInt32(4), rdq.GetString(5));
                                result.Add(line);
                            }
                        }
                    }
                    catch (Exception ex) { Console.WriteLine("Error " + ex); }
                }
            }
            return(result);
        }
예제 #3
0
        public List <Planetdata> getPlanet(int planet_id)
        {
            List <Planetdata> result = new List <Planetdata>();
            Planetdata        record = new Planetdata(1, "planet", 3, 4, 5, "loc");

            result.Add(record);
            return(result);
        }
예제 #4
0
        public List <Planetdata> SessionWithPlanet(int session)
        {
            List <Planetdata> result = new List <Planetdata>();
            Planetdata        record = new Planetdata(1, "planet", 3, 4, 5, "loc");

            result.Add(record);
            return(result);
        }