Exemplo n.º 1
1
        public async void update()
        {
            SQLiteAsyncConnection connection = new SQLiteAsyncConnection("Test.db");
            await connection.ExecuteAsync("UPDATE Employee SET Skill=\"" + Skill + "\" WHERE BadgeId=\"" + BadgeId+"\"");

            var addmsg = new MessageDialog("Your SkillSet has been updated!");
            await addmsg.ShowAsync();
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initialise the Database connection and creates tables/default values if not existant.
 /// </summary>
 private async void ConnectionInit()
 {
     //Connection init
     var dbPath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "db.sqlite");
     Database = new SQLite.SQLiteAsyncConnection(dbPath);
     //Create tables if not exists
     await Database.CreateTablesAsync(new Account().GetType(), new DatabaseRoute().GetType(), new DatabasePOI().GetType());
     await Database.ExecuteAsync("create table if not exists \"RouteBinds\"(\"RouteID\" integer,\"WaypointID\" integer);", new object[] { });
     //Set default Admin Admin password
     var result = await Database.ExecuteScalarAsync<String>("Select Gebruikersnaam From Account WHERE Gebruikersnaam = ? AND Password = ?", new object[] { "Admin", "Admin" });
     if(result == null)
         await Database.InsertAsync(new Account("Admin", "Admin"));
 }
Exemplo n.º 3
0
 public async Task Clear()
 {
     var connection = new SQLiteAsyncConnection(DbPath);
     await connection.ExecuteAsync("DELETE FROM TracklistItem");
 }
Exemplo n.º 4
0
 public Task Remove(int trackId, int trackCollectionId)
 {
     var connection = new SQLiteAsyncConnection(DbPath);
     return connection.ExecuteAsync("DELETE FROM TracklistItem WHERE TrackCollectionId=? AND TrackId=?;", trackCollectionId, trackId);
 }
        /// <summary>
        /// Method to create tables into database.
        /// </summary>
        /// <param name="db">Database connection for async calls.</param>
        /// <returns><see cref="Task"/></returns>
        protected async Task CreateTables(SQLiteAsyncConnection db)
        {
            await Task.Run(async () =>
            {
                ///Tables:
                await db.CreateTableAsync<Zip>();


                await db.ExecuteAsync(string.Format("PRAGMA user_version = {0};", CURRENT_DB_VERSION));


            });
        }
Exemplo n.º 6
0
        public Task RemoveLocation(MapLocationModel mapLocation)
        {
            SQLiteAsyncConnection connection = new SQLiteAsyncConnection(SQLiteConfiguration.ConnectionString);

            _locations.Remove(mapLocation);

            connection.ExecuteAsync("DELETE FROM MapLocationFolders WHERE MapLocationId = ?", mapLocation.ID);

            return connection.DeleteAsync(mapLocation);
        }
Exemplo n.º 7
0
        public Task RemoveLocationFolders(List<MapLocationFolderModel> locationFolders)
        {
            string query = "DELETE FROM MapLocationFolders WHERE ID IN (" +
                locationFolders.Aggregate(string.Empty, (current, next) =>
                {
                    _locationFolders.Remove(next);
                    return current + "'" + next.ID + "',";
                }).TrimEnd(',') + ")";

            SQLiteAsyncConnection connection = new SQLiteAsyncConnection(SQLiteConfiguration.ConnectionString);

            return connection.ExecuteAsync(query);
        }