public static void SaveHokm(HokmModel p) { using (IDbConnection cnn = new SQLiteConnection(LoadConectionString())) { cnn.Execute("insert into Hokm (Name,Price,PersonID) values (@Name,@Price,@PersonID)", p); } }
public static void DeleteHokm(HokmModel p) { using (IDbConnection cnn = new SQLiteConnection(LoadConectionString())) { cnn.Execute("delete from Hokm where ID=@ID ", p); } }
private void button2_Click(object sender, EventArgs e) { HokmModel h = new HokmModel(); h.ID = Convert.ToInt32(dgvhokm.CurrentRow.Cells[0].Value.ToString()); SqlliteDataAccess.DeleteHokm(h); FMessageBox.Show("با موفقیت حذف شد", "پیام", FMessageBoxButtons.OK, FMessageBoxIcons.Information); InitializeBinding(); }
private void button1_Click(object sender, EventArgs e) { HokmModel h = new HokmModel(); h.Name = txtname.Text; h.Price = Convert.ToInt32(txtprice.Text); h.PersonID = p.ID; SqlliteDataAccess.SaveHokm(h); InitializeBinding(); }