コード例 #1
0
        public List <MapTileInfo> TilesGetAll()
        {
            List <MapTileInfo> l  = new List <MapTileInfo>();
            DataTable          dt = db.Select("SELECT * FROM " + TilesTableName);

            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    int         _id        = System.Convert.ToInt32(row[0]);
                    int         _x         = System.Convert.ToInt32(row[1]);
                    int         _y         = System.Convert.ToInt32(row[2]);
                    int         _zoom      = System.Convert.ToInt32(row[3]);
                    int         _type      = System.Convert.ToInt32(row[4]);
                    DateTime    _cachetime = ((DateTime)row[5]).ToLocalTime();
                    MapTileInfo m          = new MapTileInfo(_id, _x, _y, _zoom, _type, _cachetime);
                    l.Add(m);
                }
            }
            return(l);
        }
コード例 #2
0
        public MapTileInfo TileFind(int id)
        {
            db.DBCommand.CommandText = "SELECT * FROM " + TilesTableName + " WHERE id = @id";
            db.DBCommand.Parameters.Clear();
            db.DBCommand.Parameters.Add(new SQLiteParameter("@id", id));
            DataTable dt = db.Select(db.DBCommand);

            if (dt != null)
            {
                DataRow     row        = dt.Rows[0];
                int         _id        = System.Convert.ToInt32(row[0]);
                int         _x         = System.Convert.ToInt32(row[1]);
                int         _y         = System.Convert.ToInt32(row[2]);
                int         _zoom      = System.Convert.ToInt32(row[3]);
                int         _type      = System.Convert.ToInt32(row[4]);
                DateTime    _cachetime = ((DateTime)row[5]).ToLocalTime();
                MapTileInfo m          = new MapTileInfo(_id, _x, _y, _zoom, _type, _cachetime);
                return(m);
            }
            return(null);
        }
コード例 #3
0
        public MapTileInfo TileFind(int x, int y, int z, int type)
        {
            db.DBCommand.CommandText = "SELECT * FROM " + TilesTableName + " WHERE X = @x AND Y = @y AND Zoom = @z AND Type = @type";
            db.DBCommand.Parameters.Clear();
            db.DBCommand.Parameters.Add(new SQLiteParameter("@x", x));
            db.DBCommand.Parameters.Add(new SQLiteParameter("@y", y));
            db.DBCommand.Parameters.Add(new SQLiteParameter("@z", z));
            db.DBCommand.Parameters.Add(new SQLiteParameter("@type", type));
            DataTable dt = db.Select(db.DBCommand);

            if (dt != null)
            {
                DataRow     row        = dt.Rows[0];
                int         _id        = System.Convert.ToInt32(row[0]);
                int         _x         = System.Convert.ToInt32(row[1]);
                int         _y         = System.Convert.ToInt32(row[2]);
                int         _zoom      = System.Convert.ToInt32(row[3]);
                int         _type      = System.Convert.ToInt32(row[4]);
                DateTime    _cachetime = ((DateTime)row[5]).ToLocalTime();
                MapTileInfo m          = new MapTileInfo(_id, _x, _y, _zoom, _type, _cachetime);
                return(m);
            }
            return(null);
        }