private void button1_Click(object sender, EventArgs e) { if(combYear.Text.Equals("") || comYear.Text.Equals("") || combmon.Text.Equals("") || combMonth.Text.Equals("") || combday.Text.Equals("") || combD.Text.Equals("")){ MessageBox.Show("يجب تدخيل اليوم والشهر والسنه "); } else{ string fromdate2 = fromDate[0] + "/" + fromDate[1] + "/" + fromDate[2]; string todate2 = toDate[0] + "/" + toDate[1] + "/" + toDate[2]; BL.Manager manager = new BL.Manager(); dataGridView1.DataSource = null; dataGridView1.Rows.Clear(); if (manager.ShowTranscript(fromdate2, todate2, ref dt)) { dataGridView1.Rows.Clear(); dataGridView1.Columns.Add("Product_Name", "اسم المنتج"); dataGridView1.Columns.Add("quantity", " الكمية المباعة"); dataGridView1.Columns.Add("total", "السعر الكلي"); int total = 0; bool check=true; for (int i = 0; i < dt.Rows.Count; i++) { if (check) total += Convert.ToInt32(dt.Rows[i]["Quantity"]); if (i < dt.Rows.Count - 1 && dt.Rows[i]["Product_Name"].Equals(dt.Rows[i + 1]["Product_Name"])) { total += Convert.ToInt32(dt.Rows[i + 1]["Quantity"]); check = false; continue; } dataGridView1.Rows.Add(dt.Rows[i]["Product_Name"], total.ToString(),(Convert.ToInt32( dt.Rows[i]["Sales_Price"])*total).ToString()); total = 0; check = true; } } } }
private void button3_Click(object sender, EventArgs e) { BL.Manager manager = new BL.Manager(); if (MessageBox.Show("هل تريد حذف الصنف المحدد؟", "عملية الحذف", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { BL.Product pro = new BL.Product(comboBox1.Text, Convert.ToInt32(txtAvailableQuan.Text), Convert.ToInt32(txtCriticalQuan.Text), float.Parse(txtorigPric.Text), float.Parse(txtsellprice.Text)); if (manager.Delet_Product(pro)) { comboBox1.SelectedItem = null; comboBox1.Items.Clear(); reloadProduct(); txtAvailableQuan.Text = ""; txtCriticalQuan.Text = ""; txtorigPric.Text = ""; txtsellprice.Text = ""; } else { MessageBox.Show("المنتج غير موجود "); } } }