private void btnADD_PROD_TO_CART_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textPRO_NAME.Text) && !string.IsNullOrEmpty(textITEM_PRICE.Text) && !string.IsNullOrEmpty(textITEM_COUNT.Text)) { BL.CLS_RECEIPT obj = new BL.CLS_RECEIPT(); obj.الرقم = product_id; obj.الاسم = textPRO_NAME.Text; obj.السعر = Convert.ToDouble(textITEM_PRICE.Text); obj.الكميه = Convert.ToInt32(textITEM_COUNT.Text); obj.الخصم = Convert.ToDouble(txtDiscount.Text); total += obj.السعر * obj.الكميه - obj.الخصم; discount_total += obj.الخصم; if (total > 0) { cLSRECEIPTBindingSource.Add(obj); } cLSRECEIPTBindingSource.MoveLast(); textPRO_NAME.Text = string.Empty; textITEM_PRICE.Text = string.Empty; textITEM_COUNT.Text = string.Empty; textBARCODE.Text = string.Empty; txtDiscount.Text = string.Empty; textTOTAL.Text = string.Format("{0}ج", total); txtTotalDisc.Text = string.Format("{0}ج", discount_total); } }
private void btnDELET_PROD_CART_Click(object sender, EventArgs e) { BL.CLS_RECEIPT obj = cLSRECEIPTBindingSource.Current as BL.CLS_RECEIPT; if (obj != null) { total -= obj.السعر * obj.الكميه - obj.الخصم; discount_total -= obj.الخصم; textTOTAL.Text = string.Format("{0}ج", total); txtTotalDisc.Text = string.Format("{0}ج", discount_total); cLSRECEIPTBindingSource.RemoveCurrent(); } else { MessageBox.Show("لا توجد منتجات بالفاتورة"); } }