コード例 #1
0
 private void textBox4_Click(object sender, EventArgs e)
 {
     ProductionNew.frmAddNettingRevFail fw;
     String emp = "select CustomerId from ProductionPeapleWaitHead where WaitId = '" + Wid.Trim() + "'";
     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 (productFail.Count > 0)
     {
         fw = new frmAddNettingRevFail(productFail, custid, st);
     }
     else
     {
         fw = new frmAddNettingRevFail((object)custid,st);
     }
     fw.ShowDialog();
     if (fw.DialogResult == DialogResult.OK)
     {
         productFail.Clear();
         Double sum = 0;
         foreach (DataGridViewRow r in fw.dataGridView1.Rows)
         {
             productFail.Add(new ProductListFail
             {
                 ListId = r.Cells["ListId"].Value.ToString(),
                 ListName = r.Cells["ListName"].Value.ToString(),
                 QuantityReceive = r.Cells["QuantityReceive"].Value.ToString(),
                 Quantity = r.Cells["Quantity"].Value.ToString(),
                 Id = r.Cells["Id"].Value.ToString()
             });
             sum += (r.Cells["Quantity"].Value.ToString() == "") ? 0 : Convert.ToDouble(r.Cells["Quantity"].Value.ToString());
         }
         textBox4.Text = sum.ToString();
     }
     TotalSum();
 }
コード例 #2
0
 private void textBox4_Click(object sender, EventArgs e)
 {
     ProductionNew.frmAddNettingRevFail 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 (productFail.Count > 0)
     {
         fw = new frmAddNettingRevFail(productFail, empid, st);
     }
     else
     {
         fw = new frmAddNettingRevFail(empid, st);
     }
     fw.ShowDialog();
     if (fw.DialogResult == DialogResult.OK)
     {
         productFail.Clear();
         Double sum = 0;
         foreach (DataGridViewRow r in fw.dataGridView1.Rows)
         {
             productFail.Add(new ProductListFail
             {
                 ListId = r.Cells["ListId"].Value.ToString(),//รหัสประเภทอวนเสีย
                 ListName = r.Cells["ListName"].Value.ToString(),//ชื่อประเภทอวนเสีย
                 //FmId = r.Cells["FmId"].Value.ToString(),
                 QuantityReceive = r.Cells["QuantityReceive"].Value.ToString(),//จำนวนที่รับแล้ว
                 Quantity = r.Cells["Quantity"].Value.ToString(),//จำนวน
                 Id = r.Cells["Id"].Value.ToString()//รหัสรายการ
             });
             sum += (r.Cells["Quantity"].Value.ToString() == "") ? 0 : Convert.ToDouble(r.Cells["Quantity"].Value.ToString());//รวมจำนวนสินค้า//
         }
         textBox4.Text = sum.ToString();
     }
     TotalSum();
 }