コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: ColumnMappings.cs プロジェクト: Proerp/Nuti01
        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);
            }
        }
コード例 #4
0
ファイル: ExcelSheets.cs プロジェクト: Proerp/LAVIE12AUG
 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);
     }
 }
コード例 #5
0
 public OleDbAPIs(IOleDbAPIRepository oleDbAPIRepository, GlobalEnums.MappingTaskID mappingTaskID)
 {
     this.oleDbAPIRepository = oleDbAPIRepository;
     this.oleDbAPIRepository.MappingTaskID = mappingTaskID;
 }