private void btnaction_Click(object sender, EventArgs e) { if (combotypes.SelectedIndex == -1 || combocompany.SelectedIndex == -1) { MessageBox.Show("الرجاء تحديد التاجر و الصنف", "خطأ ادخال بيانات", MessageBoxButtons.OK); return; } if (txtamount.Text == "0" || (string.IsNullOrEmpty(txtamount.Text))) { MessageBox.Show("الرجاء تحديد الكمية ", "خطأ ادخال بيانات", MessageBoxButtons.OK); return; } BLL.Types tp = BLL.Types.GetTypeByID((int)combotypes.SelectedValue); if (BLL.Store.GetStoreByTypeID(tp.ID).Amount < double.Parse(txtamount.Text)) { MessageBox.Show("لا تستطيع ارجاع كمية ليست متوفرة في المخزن"); return; } BLL.BusinesReturns cl = new WeightsOrganizer.BLL.BusinesReturns(0, (int)combotypes.SelectedValue, (int)combocompany.SelectedValue, double.Parse(txtamount.Text), tp.BusinessPrice, tp.ClientPrice, 0, "مجموعة", MyDateTime.Now, combocompany.Text, combotypes.Text); List <BLL.BusinesReturns> allz = new List <WeightsOrganizer.BLL.BusinesReturns>(); allz = alloo; bool s = false; if (allz.Count > 0) { foreach (BLL.BusinesReturns bd in allz) { if (bd.TypeId == cl.TypeId) { bd.Amount += cl.Amount; s = false; break; } else { s = true; } } if (s) { alloo.Add(cl); } } else { alloo.Add(cl); } ALlPrice += cl.ToTalPrice; numbertextbox1.Text = ALlPrice.ToString(); numbertextbox2.Text = ALlPrice.ToString(); txtamount.Text = "20"; combotypes.SelectedIndex = -1; combotypes.Text = "اختر صنف.. "; dataGridView1.DataSource = new object(); dataGridView1.DataSource = alloo; combocompany.Enabled = false; }
void goo() { if (combotypes.SelectedIndex == -1 || combocompany.SelectedIndex == -1) { MessageBox.Show("الرجاء تحديد التاجر و الصنف", "خطأ ادخال بيانات", MessageBoxButtons.OK); return; } if (txtamount.Text == "0" || (string.IsNullOrEmpty(txtamount.Text))) { MessageBox.Show("الرجاء تحديد الكمية ", "خطأ ادخال بيانات", MessageBoxButtons.OK); return; } BLL.Types tp = BLL.Types.GetTypeByID((int)combotypes.SelectedValue); BLL.BusinesReturns cl = new WeightsOrganizer.BLL.BusinesReturns(0, (int)combotypes.SelectedValue, (int)combocompany.SelectedValue, double.Parse(txtamount.Text), tp.BusinessPrice, tp.ClientPrice, 0, "", MyDateTime.Now, combocompany.Text, combotypes.Text); alloo.Add(cl); ALlPrice += cl.ToTalPrice; numbertextbox1.Text = ALlPrice.ToString(); numbertextbox2.Text = ALlPrice.ToString(); txtamount.Text = ""; combotypes.SelectedIndex = -1; combotypes.Text = "اختر صنف.. "; dataGridView1.DataSource = new object(); dataGridView1.DataSource = alloo; combocompany.Enabled = false; }