private void delete_Click(object sender, EventArgs e) { if (MessageBox.Show("هل أنت متأكد من الحذف", "حذف", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK) { if (id.Text != string.Empty && Cus_id.Text != string.Empty && priceText.Text != string.Empty) { try { pro.DeleteMoney(Convert.ToInt32(id.Text), Convert.ToInt32(Cus_id.Text), Convert.ToDouble(priceText.Text)); MessageBox.Show("تم الحذف بنجاح", "حذف", MessageBoxButtons.OK, MessageBoxIcon.Information); Cus_id.Clear(); id.Clear(); priceText.Clear(); order_id.Clear(); ClientName.Clear(); NoteText.Clear(); date.Value = DateTime.Now; position = pro.ShowAllGetMoney().Rows.Count - 1; Navigate(position); } catch { return; } } else { MessageBox.Show("خطأ! لايوجد بيانات لحذفها", "حذف", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void button4_Click(object sender, EventArgs e) { newbtn.Enabled = false; edit.Enabled = false; delete.Enabled = false; choosCust.Enabled = true; chooseOrder.Enabled = true; priceText.Enabled = true; date.Enabled = true; NoteText.Enabled = true; save.Enabled = true; status = "add"; int ids = Convert.ToInt32(pro.GetMoneyLastId().Rows[0][0].ToString()); Cus_id.Clear(); priceText.Clear(); order_id.Clear(); ClientName.Clear(); NoteText.Clear(); date.Value = DateTime.Now; id.Text = ids.ToString(); id.Focus(); }