private void btnAddInvoice_Click(object sender, EventArgs e) { if (txtInvoiceAmount.Text == "") { MessageBox.Show("أدخل ثمن الفاتوره"); return; } double result = 0; if (!double.TryParse(txtInvoiceAmount.Text, out result)) { MessageBox.Show("أدخل ثمن الفاتوره ارقام وليس حروف"); return; } if (btnAddInvoice.Text == "Add Invoice") { int i = Invoices.CreateNewInvoice(CustomerId, Convert.ToDecimal(txtInvoiceAmount.Text)); if (i > 0) { MessageBox.Show("تم اضافة الفاتوره بنجاح"); SelectAllInvoices(); this.Close(); } else { MessageBox.Show("حدثت مشكله اثناء عملية الاضافه حاول مره اخرى"); } } else if (btnAddInvoice.Text == "Update Invoice") { int i = Invoices.UpdateInvoice(CustomerId, Convert.ToDecimal(txtInvoiceAmount.Text), Convert.ToInt32(InvoiceID)); if (i > 0) { MessageBox.Show("تم تعديل الفاتوره بنجاح"); SelectAllInvoices(); this.Close(); } else { MessageBox.Show("حدثت مشكله اثناء عملية التعديل حاول مره اخرى"); } } }