Beispiel #1
0
        public async Task <bool> DeleteFromDBAsync(FreeDiscItemDownload freeDiscDownloader)
        {
            if (freeDiscDownloader == null)
            {
                #if DEBUG
                Debug.Write("DeleteFromDBAsync: freeDiscDownloader == null");
                #endif
                return(false);
            }
            Debug.Write("DeleteFromDB: ID" + freeDiscDownloader.DBID + " Title: " + freeDiscDownloader?.Title + " Status: " + freeDiscDownloader?.ItemStatus.ToString());
            if (freeDiscDownloader.DBID == 0)
            {
                Debug.Write("DeleteFromDB: freeDiscDownloader.DBID == 0 !");
                return(false);
            }
            try
            {
                var conn = new SQLite.SQLiteAsyncConnection(App.AppSetting.DBDownloadPath);
                await conn.CreateTableAsync <FreeDiscItemDownload>();

                await conn.DeleteAsync(freeDiscDownloader);
            }
            catch (Exception e)
            {
                Debug.Write("DeleteFromDB: Delete error !");
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        public async Task DeleteAllArticlesAsync()
        {
            if (_dbConnection != null)
            {
                try
                {
                    var allArticles = await _dbConnection.Table <NewsItem>().ToListAsync();

                    foreach (var article in allArticles)
                    {
                        await _dbConnection.DeleteAsync(article);
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.ToString());
                }
            }
            else
            {
                Debug.WriteLine("failed to get sqlite connection");
            }
        }
Beispiel #3
0
 public Task<int> DeleteLogAsync(Logs log)
 {
     return DataBase.DeleteAsync(log);
 }
 private Task <int> DeleteItemAsync(DummyTable item)
 {
     return(_db.DeleteAsync(item));
 }
Beispiel #5
0
        async public Task DeleteTrashImageAsync(string imageName)
        {
            SQLite.SQLiteAsyncConnection context = new SQLite.SQLiteAsyncConnection(connectionString);
            TrashImage image = await context.Table<TrashImage>().Where(p => p.Name == imageName).FirstOrDefaultAsync();

            if (image != null)
                await context.DeleteAsync(image);
        }
Beispiel #6
0
        public async Task DeleteItemAsync(int identifier)
        {
            SQLite.SQLiteAsyncConnection context = new SQLite.SQLiteAsyncConnection(connectionString);

            List<Item> childs = await context.Table<Item>().Where(p => p.Parent == identifier).ToListAsync();

            foreach(Item child in childs)
            {
                await context.DeleteAsync(child);
            }

            Item item = await context.Table<Item>().Where(p => p.Identifier == identifier).FirstOrDefaultAsync();

            if (item != null)
                await context.DeleteAsync(item);
        }
 private async Task removeOldMessage(OldMessageSettings settings)
 {
     var db = new SQLite.SQLiteAsyncConnection(this.DBPath);
     var messagesToDelete = db.Table<OldMessageSettings>().Where(m => m.ID == settings.ID);
     foreach (var messageToDelete in await messagesToDelete.ToListAsync())
     {
         await db.DeleteAsync(messageToDelete);
     }
 }
        public async Task<bool> DeleteAccount(int accountId)
        {
            var db = new SQLite.SQLiteAsyncConnection(app.DBPath);

            var existingAccount = await (db.Table<Account>().Where(
                a => a.Id == accountId)).FirstAsync();

            return await db.DeleteAsync(existingAccount) > 0;
        }
Beispiel #9
0
 public async void Remove(Cliente cliente)
 {
     await _connection.DeleteAsync(cliente);
 }