Ejemplo n.º 1
0
 private void loadDialog(String strFormular)
 {
     Dialog.frmDialogFormular frm = new Dialog.frmDialogFormular(strFormular);//เรียกหน้าเพิ่มสูตรผลิต
     //Dialog.frmDialogFormular frm = new Dialog.frmDialogFormular(1);
     frm.dataGridView2.Visible = false;
     frm.dataGridView1.Dock = DockStyle.Fill;
     frm.tableLayoutPanel1.SetColumnSpan(frm.dataGridView1, 2);
     //frm.toolStrip1.Enabled = false;
     frm.dataGridView1.MultiSelect = true;
     frm.ShowDialog();
     if (frm.DialogResult == DialogResult.OK)
     {
         for (int s = 0; s < frm.getStatusList().Count; s++ )
         {
             if (frm.getStatusList()[s] == "อนุมัติ")
             {
                 String t = "";
                 if (radioButton1.Checked)
                 {
                     t = "อวนดี";
                 }
                 else if (radioButton2.Checked)
                 {
                     t = "อวนซ่อมเรือนจำ";
                 }
                 else
                 {
                     t = "อวนซ่อมบริษัท";
                 }
                 if (dataGridView2.Rows.Count == 0)
                 {
                     last_pallet_id = Class.Function.ReturnId("ProductionWaitDetailId", "ProductionWaitDetail");
                     dataGridView2.Rows.Add(last_pallet_id, frm.getFormularIdList()[s], frm.getFormularNameList()[s], "", "", frm.getUnitList()[s], "", "", "", "", "", "", "", "",t);
                     //เก็บข้อมูลรายการสินค้า
                 }
                 else
                 {
                     dataGridView2.Rows.Add(++last_pallet_id, frm.getFormularIdList()[s], frm.getFormularNameList()[s], "", "", frm.getUnitList()[s], "", "", "", "", "", "", "","",t);
                     //เก็บข้อมูลรายการสินค้า
                 }
                 if (t == "อวนดี") dataGridView2.Rows[dataGridView2.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Black;
                 if (t == "อวนซ่อมเรือนจำ") dataGridView2.Rows[dataGridView2.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Blue;
                 if (t == "อวนซ่อมบริษัท") dataGridView2.Rows[dataGridView2.Rows.Count - 1].DefaultCellStyle.ForeColor = Color.Chocolate;
             }
             else
             {
                 MessageBox.Show("สูตรที่เลือกยังไม่อนุมัติ");
             }
         }
     }
 }