예제 #1
0
        private void UpdateGrid(bool isSearch)
        {
            tbl_inspect_data insData = new tbl_inspect_data();
            DataTable        dt1     = new DataTable();
            DataTable        dtFinal = new DataTable();

            if (isSearch)
            {
                insData.Search(txtBoxID.Text);
                dt1 = insData.listData.CreateDatatableFromClass <tbl_inspect_data>();
                if (dt1.Columns.Contains("inspect_date"))
                {
                    dt1.Columns.Remove("inspect_date");
                }
                if (dt1.Columns.Contains("judge"))
                {
                    dt1.Columns.Remove("judge");
                }
                dtFinal = DatatableClass.Pivot(dt1, dt1.Columns["item_no"], dt1.Columns["inspect_data"]);
            }
            tbl_inspect_master masterData = new tbl_inspect_master();

            masterData.Search(new tbl_inspect_master {
                inspect_id = 0, part_number = txtPartNumber.Text
            });
            for (int i = 0; i < dtFinal.Rows.Count; i++)
            {
                int    id      = int.Parse(dtFinal.Rows[i]["inspect_id"].ToString());
                string insName = masterData.listMaster.Where(x => x.inspect_id == id).Select(x => x.inspect_name).First();
                dtFinal.Rows[i]["inspect_id"] = insName;
            }
            dgvMain.DataSource = dtFinal;
            current            = insData.GetMaxQty(txtBoxID.Text);
            txtBoxQty.Text     = current.ToString();
        }
예제 #2
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     try
     {
         string             boxCode    = string.Empty;
         string             partCode   = string.Empty;
         tbl_part_box       boxData    = new tbl_part_box();
         tbl_inspect_data   insData    = new tbl_inspect_data();
         tbl_inspect_master masterData = new tbl_inspect_master();
         if (IsBoxMode)
         {
             if (dgvMain.SelectedRows.Count <= 0)
             {
                 CustomMessageBox.Notice("Please choose a box!" + Environment.NewLine + "Vui lòng chọn 1 box!");
                 return;
             }
             boxData  = dgvMain.SelectedRows[0].DataBoundItem as tbl_part_box;
             boxCode  = boxData.part_box_cd;
             partCode = boxData.part_number;
         }
         else
         {
             boxCode  = txtBoxID.Text;
             partCode = txtPartNumber.Text;
         }
         insData.Search(boxCode);
         boxData.Search(new tbl_part_box {
             part_box_cd = boxCode
         }, false);
         masterData.Search(new tbl_inspect_master {
             inspect_id = 0, part_number = partCode
         });
         ExcelClassnew excel = new ExcelClassnew();
         excel.exportExcelIQC(boxData.listBox[0], masterData.listMaster, insData.listData);
     }
     catch (Exception ex)
     {
         CustomMessageBox.Error(ex.Message);
     }
 }
예제 #3
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     try
     {
         tbl_part_box       boxData    = new tbl_part_box();
         tbl_inspect_data   insData    = new tbl_inspect_data();
         tbl_inspect_master masterData = new tbl_inspect_master();
         insData.Search(txtBoxID.Text);
         boxData.Search(new tbl_part_box {
             part_box_cd = txtBoxID.Text
         }, false);
         masterData.Search(new tbl_inspect_master {
             inspect_id = 0, part_number = txtPartNumber.Text
         });
         ExcelClassnew excel = new ExcelClassnew();
         excel.exportExcelIQC(boxData.listBox[0], masterData.listMaster, insData.listData);
     }
     catch (Exception ex)
     {
         CustomMessageBox.Error(ex.Message);
     }
 }
예제 #4
0
        private void UpdateGridReg()
        {
            tbl_inspect_data insData = new tbl_inspect_data()
            {
                part_box_cd = txtBoxID.Text,
                inspect_id  = insID
            };

            insData.Search(insData);
            maxNo = insData.GetMax(txtBoxID.Text, insID);
            dgvRegMeasure.DataSource = insData.listData;
            foreach (DataGridViewRow dr in dgvRegMeasure.Rows)
            {
                if (dr.Cells["judge"].Value.ToString() == "1")
                {
                    dr.DefaultCellStyle.BackColor = Color.Red;
                }
                else
                {
                    dr.DefaultCellStyle.BackColor = Color.White;
                }
            }
            currNo = maxNo;
        }