protected virtual void OnBeforeDataImport(QuickInputDataImportEventArgs arg) { if (_BeforeDataImport != null) { _BeforeDataImport(this, arg); } }
//数据导入处理相关... private void dataImport() { string file = MB.WinBase.ShareLib.Instance.SelectedFile("Excel 文件 (*.xls)|*.xls"); if (string.IsNullOrEmpty(file)) { return; } DataSet dsData = new DataSet(); dsData.Tables.Add(_DtSource.Clone()); foreach (DataColumn dc in dsData.Tables[0].Columns) { var eCol = getGridColumnByFieldName(gridViewMain, dc.ColumnName); if (eCol == null) { continue; } dc.Caption = eCol.Caption; } MB.WinEIDrive.Import.XlsImport xlsImport = new MB.WinEIDrive.Import.XlsImport(dsData, file); ImportEngine helper = new ImportEngine(_EditCols, grdCtlMain, xlsImport); helper.Commit(); //移除空行数据 MB.Util.DataValidated.Instance.RemoveNULLRowData(dsData); var arg = new QuickInputDataImportEventArgs(_DtSource, dsData); OnBeforeDataImport(arg); if (!arg.Handled) { dataImportByOveride(dsData); } }