private void deletebtn_Click(object sender, EventArgs e) { int id = Int32.Parse(prodidtxt.Text); using (var form = new Confirmation()) { var result = form.ShowDialog(); if (result == DialogResult.OK) { if (DatabaseOperation.DeleteItem(id, "Product") == false) { MessageBox.Show("ID doesn't exist, can't delete."); } } } Update_Dataset(); }
private void Purchasebtn_Click(object sender, EventArgs e) { using (Confirmation form = new Confirmation("Are you sure you want to make this purchase?")) { var result = form.ShowDialog(); if (result == DialogResult.OK) { invoice = calculations.CalculateInvoice(customer, invoice, userewardschkbx.Checked); invoice.DateOfInvoice = DateTime.Now; if (DatabaseOperation.AddItem(invoice)) { MessageBox.Show("Successfully added the item into the database."); this.Close(); } else { MessageBox.Show("Something went wrong, please try again"); } } } }