private void textBox3_Click(object sender, EventArgs e) { ProductionNew.frmAddNettingRevWell fw; String emp = "select CustomerId from ProductionPeapleWaitHead where WaitId = '" + Wid + "'"; String custid = Class.DBConnString.clsDB.QueryExecuteScalarNonAlert(emp); String st = ""; if (radioButton1.Checked == true) { st = "0"; } else if (radioButton2.Checked == true) { st = "1"; } else { st = "2"; } if (productWell.Count > 0) { fw = new frmAddNettingRevWell(productWell, custid, st); } else { fw = new frmAddNettingRevWell((object)custid, st); } fw.ShowDialog(); if (fw.DialogResult == DialogResult.OK) { productWell.Clear(); Double sum = 0; foreach (DataGridViewRow r in fw.dataGridView1.Rows) { productWell.Add(new ProductListAdd { ProductId = r.Cells["ProductId"].Value.ToString(), ProductName = r.Cells["ProductName"].Value.ToString(), QuantityReceive = r.Cells["QuantityReceive"].Value.ToString(), Quantity = r.Cells["Quantity"].Value.ToString(), UnitSaleName = r.Cells["Unit"].Value.ToString(), Id = r.Cells["Id"].Value.ToString() }); sum += Convert.ToDouble(r.Cells["Quantity"].Value.ToString()); } textBox3.Text = sum.ToString(); } TotalSum(); }
private void textBox3_Click(object sender, EventArgs e) { funcTemp.FmId = textBox1.Text; ProductionNew.frmAddNettingRevWell fw; String emp = "select employerid from productionwaithead where productionwaitid = '" + Wid + "'"; String empid = Class.DBConnString.clsDB.QueryExecuteScalarNonAlert(emp); String st = ""; if (radioButton1.Checked == true) {/*รูปแบบการรับซ่อม*/ st = "0"; } else if (radioButton2.Checked == true) { st = "1"; } else if (radioButton3.Checked == true) { st = "2"; } else if (radioButton4.Checked == true) { st = "3"; } else { st = "4"; } if (productWell.Count > 0) { fw = new frmAddNettingRevWell(productWell,empid,st); } else { fw = new frmAddNettingRevWell(empid,st); } fw.ShowDialog(); if (fw.DialogResult == DialogResult.OK) { productWell.Clear(); Double sum = 0; foreach (DataGridViewRow r in fw.dataGridView1.Rows) {/*วนเก็บรายการสินค้า*/ productWell.Add(new ProductListAdd { ProductId = r.Cells["ProductId"].Value.ToString(),//เก็บรหัสสินค้า ProductName = r.Cells["ProductName"].Value.ToString(),//เก็บชื่อสินค้า Quantity = r.Cells["Quantity"].Value.ToString(),//เก็บจำนวน QuantityReceive = r.Cells["QuantityReceive"].Value.ToString(),//เก็บจำนวนที่รับแล้ว UnitSaleName = r.Cells["Unit"].Value.ToString(),//เก็บหน่วยขาย Id = r.Cells["Id"].Value.ToString()//เก็บรหัสรายการ }); sum += Convert.ToDouble(r.Cells["Quantity"].Value.ToString());//รวมจำนวนสินค้า } textBox3.Text = sum.ToString(); } TotalSum(); }