//导入数据库 private void OnImportClick(object sender, EventArgs e) { if (gridView1.RowCount == 0) { MsgBox.Warn("请先打开数据文件。"); return; } if (MsgBox.AskOK("确定要导入到系统吗?") == DialogResult.OK) { try { ImportFromExcelDal dal = new ImportFromExcelDal(); using (new WaitDialogForm("请稍等...", "正在解析数据并导入")) { // 到货通知单和销货单对应不同的函数 if (IsAsnFile) { dal.ImportASN(tOriginal, tHeader, GlobeSettings.LoginedUser.UserName); } else { dal.ImportSO(tOriginal, tHeader, GlobeSettings.LoginedUser.UserName); } } } catch (Exception ex) { MsgBox.Err(ex.Message); } } }
private void btnImport_Click(object sender, EventArgs e) { if (tHeader.Rows.Count == 0 || tDetail.Rows.Count == 0) { MsgBox.Warn("请先打开文本文件"); return; } if (MsgBox.AskOK("确定要导入到系统吗?") == DialogResult.OK) { try { ImportFromExcelDal dal = new ImportFromExcelDal(); using (new WaitDialogForm("请稍等...", "正在解析数据并导入")) { // 单据类型暂定为正常采购单 dal.ImportSO(tOriginal, tHeader, GlobeSettings.LoginedUser.UserName); } } catch (Exception ex) { MsgBox.Err(ex.Message); } } }