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 Btndeletebook_Click(object sender, EventArgs e) { var item = new Tbl_Books(); item.Id = Convert.ToInt32(txtbookid.Text); string dpPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "books.sqlite"); var db = new SQLiteConnection(dpPath); var data = db.Delete(item); Toast.MakeText(this, "Record Deleted Successfully...,", ToastLength.Short).Show(); txtbookname.Text = ""; load_spiner_category(); load_spiner_books(); }
private void Btnsavebook_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>(); Tbl_Books tbl = new Tbl_Books(); tbl.Books_Title = Convert.ToString(txtbookname.Text); tbl.Cid = Convert.ToInt32(txtcategoryid.Text); tbl.Price = Convert.ToInt32(txt_price.Text); db.Insert(tbl); Toast.MakeText(this, "Record Added Successfully...,", ToastLength.Short).Show(); txtbookname.Text = ""; load_spiner_category(); load_spiner_books(); }