protected virtual void ImportExcel(GlobalEnums.MappingTaskID mappingTaskID) { try { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Filter = "Excel File (.xlsx)|*.xlsx"; if (openFileDialog.ShowDialog() == DialogResult.OK) { string fileName = openFileDialog.FileName; ColumnMappings columnMappings = new ColumnMappings(mappingTaskID, fileName); if (columnMappings.ShowDialog() == DialogResult.OK) { this.DoImportExcel(fileName); } columnMappings.Dispose(); } openFileDialog.Dispose(); } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
private string GetExcelSheet(GlobalEnums.MappingTaskID mappingTaskID, string excelFile) { string sheetName = null; ExcelSheets excelSheets = new ExcelSheets(mappingTaskID, excelFile); if (excelSheets.ShowDialog() == DialogResult.OK) { sheetName = excelSheets.Tag.ToString(); } excelSheets.Dispose(); return(sheetName); }
public ColumnMappings(GlobalEnums.MappingTaskID mappingTaskID, string excelFile) { InitializeComponent(); try { this.oleDbAPIs = new OleDbAPIs(CommonNinject.Kernel.Get <IOleDbAPIRepository>(), mappingTaskID); this.excelFile = excelFile; this.mappingTaskID = mappingTaskID; this.Text = "Mapping for " + this.excelFile; } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
public ExcelSheets(GlobalEnums.MappingTaskID mappingTaskID, string excelFile) { InitializeComponent(); try { OleDbAPIs oleDbAPIs = new OleDbAPIs(CommonNinject.Kernel.Get <IOleDbAPIRepository>(), mappingTaskID); List <string> excelSheets = oleDbAPIs.GetExcelSheets(excelFile); if (excelSheets != null) { this.combexSheetName.Items.AddRange(excelSheets.ToArray()); } } catch (Exception exception) { ExceptionHandlers.ShowExceptionMessageBox(this, exception); } }
public OleDbAPIs(IOleDbAPIRepository oleDbAPIRepository, GlobalEnums.MappingTaskID mappingTaskID) { this.oleDbAPIRepository = oleDbAPIRepository; this.oleDbAPIRepository.MappingTaskID = mappingTaskID; }