private void btn_delete_category_Click(object sender, EventArgs e) { string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "books.sqlite"); var db = new SQLiteConnection(dpPath); var subitem = new Tbl_Books(); subitem.Cid = Convert.ToInt32(txtviewid.Text); var data_s = db.Query <Tbl_Books>("select * from Tbl_Books where Cid=" + Convert.ToInt32(txtviewid.Text)); if (data_s.Count > 0) { Toast.MakeText(this, "Record Will not deleted as Book Exists...,", ToastLength.Short).Show(); } else { var item = new Tbl_Books_Category(); item.Id = Convert.ToInt32(txtviewid.Text); var data = db.Delete(item); Toast.MakeText(this, "Record Deleted Successfully...,", ToastLength.Short).Show(); txt_category.Text = ""; load_spiner_category(); } }
private void btn_save_category_Click(object sender, EventArgs e) { string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "books.sqlite"); var db = new SQLiteConnection(dpPath); db.CreateTable <Tbl_Books_Category>(); Tbl_Books_Category tbl = new Tbl_Books_Category(); tbl.BooksCategory = txt_category.Text; db.Insert(tbl); Toast.MakeText(this, "Record Added Successfully...,", ToastLength.Short).Show(); txt_category.Text = ""; load_spiner_category(); }
private void btn_update_category_Click(object sender, EventArgs e) { string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "books.sqlite"); var db = new SQLiteConnection(dpPath); var item = new Tbl_Books_Category(); item.Id = Convert.ToInt32(txtviewid.Text); item.BooksCategory = txt_category.Text; db.Update(item); Toast.MakeText(this, "Record Updated Successfully...,", ToastLength.Short).Show(); load_spiner_category(); }