public void delete( int id) { var db = new SQLiteConnection(dbPath); var newDepartments = new Departments(); newDepartments.Id = id; db.Delete(newDepartments); // db.Execute(""); }
/// <summary> /// Deletes the account from all tables. /// </summary> /// <param name="id">Identifier for the account..</param> public void DeleteAccountFromAllTables(int id) { SQLiteConnection con = new SQLiteConnection(ServerConstants.DB_PATH); con.Delete<TableAccount>(id); con.Delete<TableBuilding>(id); con.Delete<TableResource>(id); con.Delete<TableUnit>(id); }
public int DeleteLottery(int id) { lock (Connection) { //return the number of items deleted return(_connection.Delete <Lottery>(id)); //this will be more complicated need to delete fk first i imagine } }
private async void deleteselected(object sender, RoutedEventArgs e) { try { var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "data.db3"); using (var db = new SQLite.SQLiteConnection(dbpath)) { db.Delete <person>(list1.SelectedItem.ToString()); var d = from x in db.Table <person>() select x; list1.Items.Clear(); foreach (var sd in d) { list1.Items.Add(sd.name.ToString()); //list1.Items.Add(sd.address.ToString()); //list1.Items.Add(sd.phone.ToString()); } db.Dispose(); db.Close(); } var line = new MessageDialog("Selected Item Deleted"); await line.ShowAsync(); } catch { } }
public void DeleteLogEntry(LogEntry selectedLogEntry) { using (var dbConn = new SQLiteConnection(App.DB_PATH)) { dbConn.Delete(selectedLogEntry); } }
private async Task AccountStore(ObservableCollection <AccountsModel> account) { try { var dbpath = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "data.db3"); using (var db = new SQLite.SQLiteConnection(dbpath)) { foreach (AccountsModel accountM in Accounts) { var accountInDB = db.Find <AccountsModel>(accountM.Accountid); if (accountInDB != null) { db.Delete(accountM); } db.Insert(accountM); } db.Commit(); db.Dispose(); db.Close(); } } catch (SQLiteException) { } }
public void DeletePlayerWithName(FootballPlayer player) { using (SQLite.SQLiteConnection database = DependencyService.Get <ISQLite> ().GetConnection()) { database.Delete(player); } }
public void DeleteWeighingEntry(Weighing selectedWeighing) { using (var dbConn = new SQLiteConnection(App.DB_PATH)) { dbConn.Delete(selectedWeighing); } }
public override void CommitEditingStyle(UITableView tableView, UITableViewCellEditingStyle editingStyle, Foundation.NSIndexPath indexPath) { switch (editingStyle) { case UITableViewCellEditingStyle.Delete: using (var connection = new SQLite.SQLiteConnection(pathToDatabase)) { connection.Delete(SavedLocations[indexPath.Row]); } var annotations = Map.Annotations; foreach (IMKAnnotation pin in annotations) { if (pin.Coordinate.Latitude == SavedLocations[indexPath.Row].Latitude && pin.Coordinate.Longitude == SavedLocations[indexPath.Row].Longitude) { Map.RemoveAnnotation(pin); } } // remove the item from the underlying data source SavedLocations.RemoveAt(indexPath.Row); // delete the row from the table tableView.DeleteRows(new NSIndexPath[] { indexPath }, UITableViewRowAnimation.Fade); break; case UITableViewCellEditingStyle.None: Console.WriteLine("CommitEditingStyle:None called"); break; } }
public async void DeleteTerm() { var yes = await DisplayAlert("DELETE", "Are you sure you want to delete this term and all of its courses?", "Yes", "No"); if (yes) { using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection(App.DBPath)) { connection.CreateTable <Term>(); connection.Delete(term); } //delete each course associated with that Term. using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection(App.DBPath)) { List <Course> courses = new List <Course>(); connection.CreateTable <Course>(); courses = connection.Table <Course>().ToList(); for (var i = 0; i < courses.Count; i++) { if (courses[i].TermId == term.Id) { connection.Delete(courses[i]); } } } await Navigation.PopAsync(); } }
public void DeleteExercise(Exercise myExercise) { using (var dbConn = new SQLiteConnection(App.DB_PATH)) { dbConn.Delete(myExercise); } }
public void DeletePassword(PasswordItem _selectedPasswordItem) { using (SQLiteConnection context = new SQLiteConnection(_connectionString)) { context.Delete(_selectedPasswordItem); } }
//public int Delete(T entity) //{ // lock (m_lock) { // return _db.Delete<T>(entity); // } //} public int Delete(long Id) { lock (m_lock) { return(_db.Delete <T>(Id)); } }
private void DeleteOnClick(object sender, EventArgs e) { // Get button and product var btn = sender as NSButton; var balance = DataSource.Balances[(int)btn.Tag]; // Configure alert var alert = new NSAlert() { AlertStyle = NSAlertStyle.Informational, InformativeText = $"你真的要删掉我吗?>.<", MessageText = $"Delete?", }; alert.AddButton("取消"); alert.AddButton("删除"); alert.BeginSheetForResponse(Controller.View.Window, (result) => { // Should we delete the requested row? if (result == 1001) { // Remove the given row from the dataset var conn = new SQLite.SQLiteConnection(Controller.GetDbPath()); conn.Delete(DataSource.Balances[(int)btn.Tag]); Controller.ReloadTable(); } }); }
public static void DeleteItem <T>(T item) where T : new() { lock (_locker) { _db.Delete(item); } }
//Delete public int DeleteNote(int id) { lock (locker) { return(conn.Delete <CartRecord>(id)); } }
public int EemaldaKontakt(int id, SQLiteConnection c) { Kontakt[] k = this.otsiKontaktid(new Kontakt() { Id = id }, c); if (k.Length > 0) { return c.Delete(k[0]); } return 0; }
public int DeleteExpense() { using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.DatabasePath)) { conn.CreateTable(typeof(Expense)); Analytics.TrackEvent("Delete expense"); return(conn.Delete(this)); } }
public ResponseStatus RemoveMovie(int movieId) { using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.DB_PATH)) { int nb = conn.Delete <ApiMovie>(movieId); return(nb > 0 ? ResponseStatus.OK : ResponseStatus.NOT_OK); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.strDatabasePath)) { conn.CreateTable <Teams>(); conn.Delete(teams); //ToDo Delete existing contact } Close(); }
//delete selected item from list public void Delete(Object Sender, EventArgs args) { var journal = journalsListView.SelectedItem; using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.DB_PATH)) { conn.Delete(journal); } Navigation.PushAsync(new MainPage()); }
public void removePersonne(SQLiteConnection connection, Personne p) { connection.Delete(p); //select ex1: // List<Personne> personnes = conn.Table<Personne>().Where(x => x.LastName == "TOTO").ToList(); //select ex2: //IEnumerable<Personne> personnes = conn.Query<Personne>("SELECT * FROM People WHERE ...", r1.Id) }
public virtual void Delete(IPersistentQueueItem item) { if (item is QueueItemType) { store.Delete(item); } else { throw new QueueStorageMismatchException(this, item); } }
public void DeleteObject(Notes note) { using (var db = new SQLiteConnection(dbPath)) { var existing = db.Query<Notes>("select * from Notes where id = " + note.ID).FirstOrDefault(); db.RunInTransaction(() => { db.Delete(note); }); } }
private void ButtonDelete_Click(object sender, EventArgs e) { if (DeleteButton.Text == "Delete") { DeleteButton.Text = "Confirm?"; DateContent.BackgroundColor = Color.Red; RatingContent.BackgroundColor = Color.Red; GoalsContent.BackgroundColor = Color.Red; AssistsContent.BackgroundColor = Color.Red; TacklesContent.BackgroundColor = Color.Red; DribblesContent.BackgroundColor = Color.Red; KeyPassesContent.BackgroundColor = Color.Red; StaminaContent.BackgroundColor = Color.Red; } else { using (var con = new SQLite.SQLiteConnection(App.FilePath)) { training = (TrainingData)TrainingViews.SelectedItem; var trainingToDelete = con.Find <TrainingData>(training.TrainingId); con.Delete <TrainingData>(trainingToDelete.TrainingId); TrainingViews.ItemsSource = null; sessions = con.Table <TrainingData>().ToList(); TrainingViews.ItemsSource = sessions; } DeleteButton.Text = "Delete"; DateContent.BackgroundColor = Color.Black; RatingContent.BackgroundColor = Color.Black; GoalsContent.BackgroundColor = Color.Black; AssistsContent.BackgroundColor = Color.Black; TacklesContent.BackgroundColor = Color.Black; DribblesContent.BackgroundColor = Color.Black; KeyPassesContent.BackgroundColor = Color.Black; StaminaContent.BackgroundColor = Color.Black; DateContent.Text = " "; RatingContent.Text = " "; GoalsContent.Text = " "; AssistsContent.Text = " "; TacklesContent.Text = " "; DribblesContent.Text = " "; KeyPassesContent.Text = " "; StaminaContent.Text = " "; } }
//Delete Data public static bool Delete(Transaction data) { using (var conn = new SQLite.SQLiteConnection(my_db_path)) { if (conn.Delete(data) != 0) { return(true); } } return(false); }
void DeleteItem(Invoice inv) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <Invoice>().Where(x => x.invno == inv.invno).ToList <Invoice>(); var list2 = db.Table <InvoiceDtls>().Where(x => x.invno == inv.invno).ToList <InvoiceDtls>(); if (list.Count > 0) { db.Delete(list [0]); db.Delete(list2); var arrlist = listData.Where(x => x.invno == inv.invno).ToList <Invoice>(); if (arrlist.Count > 0) { listData.Remove(arrlist [0]); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <Invoice> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
private void BtnDel_Clicked(object sender, EventArgs e) { var id = int.Parse(txId.Text); string strPath = GetDbPath(); using (var con = new SQLite.SQLiteConnection(strPath)) { con.Delete <TUser>(id); } GetUserList(); }
public int DeleteRecord(Record record) { int rowAffected = 0; using (var db = new SQLite.SQLiteConnection(dbPath)) { rowAffected = db.Delete(record); Console.WriteLine("Row affected: " + rowAffected.ToString()); } return(rowAffected); }
public int DeleteScore(Scoreboard scoreInstance) { if (scoreInstance.Id != 0) { lock (collisionLock) { database.Delete <Scoreboard>(scoreInstance.Id); } } //this.Scores.Remove(scoreInstance); return(scoreInstance.Id); }
public void DeleteLogEntriesByExerciseId(int id) { using (var dbConn = new SQLiteConnection(App.DB_PATH)) { ObservableCollection<LogEntry> lstLogEntries = GetLogEntries(id); foreach (var item in lstLogEntries) { dbConn.Delete(item); } } }
// function to remove task item from database when it is removed from list. public void removeTaskfromDB(int ID) { using (var connection = new SQLite.SQLiteConnection(pathToDB)) { // remove item from database and refresh tableview. connection.Delete <TaskItem>(primaryKey: ID); TableView.ReloadData(); Console.WriteLine("Successfully removed item from GetItDone List!"); } }
//Delete a Beacon public static int DeleteBeacon(int bID) { try { var db = new SQLiteConnection(dbPath); var result = db.Delete<Beacons>(bID); return result; } catch (Exception exc) { return -1; } }
private void BtnDeleteText_Click(object sender, EventArgs e) { if (dgvShowTexts.CurrentRow != null) { var databasePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "MyNote.csv"); var db = new SQLiteConnection(databasePath); if (MessageBox.Show("آیا از حذف یادداشت خود مطمعن هستید؟", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { int selectedId = int.Parse(dgvShowTexts.CurrentRow.Cells[0].Value.ToString()); db.Delete <Note>(selectedId); } dgvShowTexts.DataSource = db.Table <Note>().ToList(); } }
public void usunPrzepis(int id) { if (conn == null) { restoreDatabase(); } try{ conn.Delete <TabelaPrzepisy> (id); } catch (Exception ex) { Toast.MakeText(applicationContext, applicationContext.GetString(Resource.String.databaseDeleteError) + ex.Message, ToastLength.Short); } przeladujPrzepisy(); }
public static void DeleteRowsInDBIfNeed(string deletedDB) { //Check if DB has already been extracted if (File.Exists(destinationPath)) { using (var conn = new SQLite.SQLiteConnection(Path.Combine(WorkingInetAndSQL.destinationPath, deletedDB))) { //var query = conn.Table<EventsShort>().Where(v => v.EventID.Equals(0)); for (int i = 1; i < 100; i++) { var rowcount = conn.Delete <EventsShort>(i); } } } }
public int DeleteUser(User user) { int rs = -1; using (var db = new SQLiteConnection(this.Path, this.State)) { var existing = db.Query<User>("SELECT * FROM User WHERE ID=?", user.Id).FirstOrDefault(); if (existing != null) { db.RunInTransaction(() => { rs = db.Delete(existing); }); } } return rs; }
public int DeleteTactic(Tactic tactic) { int rs = -1; using (var db = new SQLiteConnection(this.Path, this.State)) { var existing = db.Query<Tactic>("SELECT * FROM Tactic WHERE ID=?", tactic.Id).FirstOrDefault(); if (existing != null) { db.RunInTransaction(() => { rs = db.Delete(existing); }); } } return rs; }
private void DeleteBuild_Click(object sender, RoutedEventArgs e) { Build build = (Build)lv_builds.SelectedItem; if (MessageBox.Show("Are you sure you want to delete: " + build.Name + "?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { } else { using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(DatabasePath.databasePath)) { conn.Delete((Build)lv_builds.SelectedItem); ReadDatabase(); } } }
public void Move(int GroceryId, string GroceryName, int GroceryNumber) { Stock stock = new Stock() { Name = GroceryName, Number = GroceryNumber }; using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection((App.DB_PATH))) { connection.CreateTable <Stock>(); connection.Insert(stock); } // Delete uit huidige lijst using (SQLite.SQLiteConnection connection = new SQLite.SQLiteConnection((App.DB_PATH))) connection.Delete <Grocery>(GroceryId); }
void DeleteItem(DelOrder doorder) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table <DelOrder>().Where(x => x.dono == doorder.dono).ToList <DelOrder>(); if (list.Count > 0) { db.Delete(list [0]); var arrlist = listData.Where(x => x.dono == doorder.dono).ToList <DelOrder>(); if (arrlist.Count > 0) { listData.Remove(arrlist [0]); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter <DelOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
public void DeleteFromTable(int id) { try { Item item = new Item() { Id = id, }; var conn = new SQLite.SQLiteConnection(databaseFileName); conn.Delete(item); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("getexception: " + e); System.Diagnostics.Debug.WriteLine("delet exception: ", databaseFileName); } }
public void SetUp() { //var pathToDb = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "sessions.db"); //var conn = new SQLiteConnection(pathToDb); //if (!File.Exists(pathToDb)) //{ // File.Copy("sessions.db", pathToDb); //} db = new DatabaseFactory().InitDb(); // Empty test Tasks var tasks = (from t in db.Table<Task>() select t); foreach (var task in tasks) { db.Delete(task); } }
//-----------sets an fake user for recognizing if welcome screen should be ignored or not---------// protected void createSystemUser() { var db = new SQLiteConnection (dbPath); var rowCount = db.Table<User> ().Count (); if (rowCount > 2) { db.DeleteAll<User> (); } if (!hasInserted) { Log.Info (Tag, "libber"); var result = insertUpdateData(new User{ ID = 2, FirstName = string.Format("SystemUser", System.DateTime.Now.Ticks), LastName = "Mr.Anderson", }, db); hasInserted = true; } else { var rowcount = db.Delete(new User(){ID=2}); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button button = FindViewById<Button> (Resource.Id.myButton); string folder = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); var db = new SQLiteConnection (System. IO. Path. Combine (folder, "myDb. db")); button.Click += delegate{ Person Person = new Person{ Name = FindViewById<EditText> (Resource.Id.editText1).Text }; int id = db.Insert(Person); FindViewById<TextView> (Resource.Id.textView2).Text = "Inserted with success: id "+id; }; Button deleteButton = FindViewById<Button> (Resource.Id.button2); deleteButton.Click += delegate { var DeletedId = db.Delete<Person> (Convert.ToInt32(FindViewById<EditText> (Resource.Id.editText1).Text)); FindViewById<TextView> (Resource.Id.textView2).Text = "Id " + Dele tedId + "Deleted With Success"; }; db.Commit(); db.Rollback(); }
public FootballPlayerViewModel() { this.SaveCommand = new Command (() => { }); this.FavouriteCommand = new Command<FootballPlayerViewModel> (execute: (FootballPlayerViewModel theplayer) => { using ( SQLiteConnection connection = new SQLiteConnection (Path.Combine (App.folderPath, "FootballPlayerDB.db3"))) { List<FootballPlayer> newplayerlist = connection.Query<FootballPlayer> ("SELECT * FROM FootballPlayer WHERE FirstName = ? and LastName = ?", theplayer.FirstName, theplayer.LastName); newplayerlist [0].Isfavourite = !(newplayerlist [0].Isfavourite); connection.Update (newplayerlist [0]); } MessagingCenter.Send(this,"DBChanged"); }); this.DeleteCommand = new Command<FootballPlayerViewModel> (execute: (FootballPlayerViewModel theplayer) => { using (SQLiteConnection connection = new SQLiteConnection (Path.Combine (App.folderPath, "FootballPlayerDB.db3"))) { List<FootballPlayer> newplayerlist = connection.Query<FootballPlayer> ("SELECT * FROM FootballPlayer WHERE FirstName = ? and LastName = ?", theplayer.FirstName, theplayer.LastName); connection.Delete (newplayerlist [0]); } MessagingCenter.Send(this,"DBChanged"); }); }
public async Task<bool> DeletePerson() { MessageDialog msgbox = new MessageDialog("Do you want to delete this person?"); msgbox.Commands.Clear(); msgbox.Commands.Add(new UICommand { Label = "Yes", Id = 0 }); msgbox.Commands.Add(new UICommand { Label = "No", Id = 1 }); var res = await msgbox.ShowAsync(); if ((int)res.Id == 0) { SQLiteConnection dbConnection = new SQLiteConnection(new SQLitePlatformWinRT(), Path.Combine(ApplicationData.Current.LocalFolder.Path, "Storage.sqlite")); dbConnection.Delete(this); return true; } if ((int)res.Id == 1) { return false; } return false; }
//지출 카테고리 삭제 public void deleteExpenseCategoryQueryHandling(ExpenseCategoryForm inExpenseCategoryForm) { try { //db연결 SQLiteConnection conn = new SQLiteConnection(dbPath, true); //해당하는 카테고리 이름에 해당하는 ID를 얻어온다. List<ExpenseCategoryForm> resultList = conn.Query<ExpenseCategoryForm>("SELECT * FROM ExpenseCategoryTable WHERE categoryName ='" + inExpenseCategoryForm.categoryName + "';"); //delete Async로 연결해서 찾은 아이디들을 삭제한다. foreach (var er in resultList) { conn.Delete(er); } } catch (Exception ex) { ex.Message.ToString(); } }
public bool DeleteAllCategoryOffline() { bool result = false; try { using (var db = new SQLite.SQLiteConnection(_dbPath)) { var CategoryOffline = db.Query<PointePayApp.Model.CategoryOffline>("select * from CategoryOffline").ToList(); if (CategoryOffline != null) { foreach (var itm in CategoryOffline) { //Dlete row db.RunInTransaction(() => { db.Delete(itm); }); } } }//using result = true; }//try catch (Exception ex) { }//catch return result; }
/// <summary> /// Deletes the unit. /// </summary> /// <param name="id">Identifier for the account..</param> public void DeleteUnit(int id) { SQLiteConnection con = new SQLiteConnection(ServerConstants.DB_PATH); con.Delete<TableUnit>(id); }
//돈삭제 public bool DeleteQueryHandling(int dataID) { bool checkResult = false; try { //연결 SQLiteConnection conn = new SQLiteConnection(dbPath, true); int deleteResult = conn.Delete<MoneyDBForm>(dataID); //쿼리문 날려서 결과 얻어오기 if (deleteResult > 0) { checkResult = true; } } catch (Exception ex) { ex.Message.ToString(); } return checkResult; }
public void RemoveWordAt(int idx) { using (var conn = new SQLite.SQLiteConnection(mDatabasePath)) { conn.RunInTransaction(() => { var wordID = mWordsList[idx].ID; var theWaves = conn.Table<WaveModel>().Where(wave => wave.WordID == wordID); foreach (var wave in theWaves) { conn.Delete(wave); File.Delete(Path.Combine ("file://", GetSoundsDirectory(), wave.WaveFileName)); } conn.Delete(mWordsList[idx]); }); RefreshWordsList(conn); } }
//Delete specific contact public void DeleteContact(int Id) { using (var dbConn = new SQLiteConnection(App.DB_PATH)) { var existingconact = dbConn.Query<GhiChu>("select * from GhiChu where Id =" + Id).FirstOrDefault(); if (existingconact != null) { dbConn.RunInTransaction(() => { dbConn.Delete(existingconact); }); } } }
public void DeleteAccountTest() { int res = 0; var dbPath = Path.Combine(ApplicationData.Current.LocalFolder.Path, "testDB.db"); using (var db = new SQLiteConnection(dbPath)) { // Работа с БД var ids = db.Query<AccountTable>("SELECT * FROM AccountTable"); foreach (AccountTable aid in ids) { db.Delete<AccountTable>(aid._account_Id); res++; } } Assert.IsTrue(res > 0, res.ToString()); }
public void Elimina() { var db = new SQLiteConnection (dbPath); db.Delete (this); }
void ComWebService () { //récupération des données dans la BDD string dbPath = System.IO.Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "ormDMS.db3"); var db = new SQLiteConnection (dbPath); var table = db.Query<TableStatutPositions> ("Select * FROM TableStatutPositions"); foreach (var item in table) { try { string _url = "http://dms.jeantettransport.com/api/livraisongroupage"; var webClient = new WebClient (); webClient.Headers [HttpRequestHeader.ContentType] = "application/json"; //TODO webClient.UploadString (_url, item.datajson); //Sup pde la row dans statut pos var row = db.Get<TableStatutPositions>(item.Id); db.Delete(row); } catch (Exception e) { Console.WriteLine (e); Insights.Report(e); File.AppendAllText(log_file,"["+DateTime.Now.ToString("t")+"]"+"[ERROR] ComWebService : "+e+" à "+DateTime.Now.ToString("t")+"\n"); } } Console.WriteLine ("\nTask ComWebService done"); //File.AppendAllText(Data.log_file, "Task ComWebService done"+DateTime.Now.ToString("t")+"\n"); }
void DeleteItem(DelOrder doorder) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table<DelOrder>().Where(x=>x.dono==doorder.dono&&x.CompCode==compCode&&x.BranchCode==branchCode).ToList<DelOrder>(); if (list.Count > 0) { db.Delete (list [0]); var arrlist= listData.Where(x=>x.dono==doorder.dono).ToList<DelOrder>(); if (arrlist.Count > 0) { listData.Remove (arrlist [0]); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<DelOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
//-----------sets the tag in the user.cs for further utilization in the application---------// protected void settingTags() { using (var connection = new SQLiteConnection (dbPath)) { var rowCount = connection.Table<User> ().Count (); var presentUser = connection.Get<User> (1); Log.Info (Tag, "rowCount: " + rowCount.ToString ()); if (rowCount > 2) { Log.Info (Tag, "Database cleared"); for (int i = rowCount; i > 0-1; i--) { var del = connection.Delete<User> (i); //var deleted = connection.Query<User> ("DELETE FROM User WHERE ID = ?", i); Log.Info (Tag, "for loop i: " + i.ToString ()); Log.Info (Tag, "Rows deleted: " + del.ToString ()); } } rowCount = connection.Table<User> ().Count (); if (rowCount <= 2) { presentUser.VacationTarget = vacationTarget; connection.Update (presentUser); //var Users = connection.Query<User>("UPDATE User SET Persons = ? WHERE ID = 1", persons); Log.Info (Tag, "User Data Updated"); } } }
void DeleteItem(SaleOrder inv) { using (var db = new SQLite.SQLiteConnection(pathToDatabase)) { var list = db.Table<SaleOrder>().Where(x=>x.sono==inv.sono).ToList<SaleOrder>(); if (list.Count > 0) { db.Delete (list [0]); var arrlist= listData.Where(x=>x.sono==inv.sono).ToList<SaleOrder>(); if (arrlist.Count > 0) { listData.Remove (arrlist [0]); SetViewDlg viewdlg = SetViewDelegate; listView.Adapter = new GenericListAdapter<SaleOrder> (this, listData, Resource.Layout.ListItemRow, viewdlg); } } } }
/// <summary> /// Deletes the building. /// </summary> /// <param name="id">Identifier for the account..</param> public void DeleteBuilding(int id) { SQLiteConnection con = new SQLiteConnection(ServerConstants.DB_PATH); con.Delete<TableBuilding>(id); }