Ejemplo n.º 1
0
        public static List <Location> getLocations(Location.LocationType type)
        {
            List <Location> p       = new List <Location>();
            SQLiteCommand   command = new SQLiteCommand(
                "SELECT name, ID, ParentID FROM " + type.ToString(),
                dbConnection);
            SQLiteDataReader reader = command.ExecuteReader();

            System.Console.Out.WriteLine(command.ToString());
            while (reader.Read())
            {
                p.Add(new Location(reader.GetString(0), type, reader.GetInt32(1), reader.GetInt32(2)));
            }
            return(p);
        }
Ejemplo n.º 2
0
        public static List <Location> getLocationsInLocation(Location.LocationType type, int parentID)
        {
            List <Location> p       = new List <Location>();
            SQLiteCommand   command = new SQLiteCommand(
                "SELECT name, ID, ParentID FROM " + type.ToString() + " " +
                " WHERE ParentID = @ParentID",
                dbConnection);

            command.Parameters.AddWithValue("ParentID", parentID);
            SQLiteDataReader reader = command.ExecuteReader();

            System.Console.Out.WriteLine(command.ToString());
            while (reader.Read())
            {
                p.Add(new Location(reader.GetString(0), type, reader.GetInt32(1), reader.GetInt32(2)));
            }
            return(p);
        }