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); } }
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); } }