void ImportMapModify_Loaded(object sender, RoutedEventArgs e) { if (DataScript.FileType == "mdb") { AccessImportHelper helper = new AccessImportHelper(sourceFile); columnConnection.Source = helper.getDataTable(); } else if (DataScript.FileType == "db") { columnConnection.Source = SQLiteImportHelper.GetDataTable(sourceFile); } else if (DataScript.FileType == "xls/xlsx") { columnConnection.Source = ExcelImportHelper.GetDataTable(sourceFile); } else { columnConnection.Source = TextImportHelper.GetDataTable(sourceFile, this.DataScriptRule.getColSeperatorChar()); } columnConnection.Target = TableDAL.getTableStructure(this.DataScriptRule.DesTable); columnConnection.BusinessPK = DataScriptRule.DesBusinessPk; columnConnection.FID = FID; columnConnection.ShowComplete += columnConnection_ShowComplete; }
void DataScriptMapModify_Loaded(object sender, RoutedEventArgs e) { // columnConnection.Source = TextImportHelper.GetDataTable(@"G:\workspace\动控实现数据管理\src\TestData\data.txt", ','); //columnConnection.Target = TableDAL.getTableStructure("MDS_IMP_DATA_TEST"); if (DataScript.FileType == "mdb") { AccessImportHelper helper = new AccessImportHelper(this.DataScriptRule.DesFile); columnConnection.Source = helper.getDataTable(); } else if (DataScript.FileType == "db") { columnConnection.Source = SQLiteImportHelper.GetDataTable(this.DataScriptRule.DesFile); } else if (DataScript.FileType == "xls/xlsx") { columnConnection.Source = ExcelImportHelper.GetDataTable(this.DataScriptRule.DesFile); } else { columnConnection.Source = TextImportHelper.GetDataTable(this.DataScriptRule.DesFile, this.DataScriptRule.getColSeperatorChar()); } columnConnection.FID = FID; columnConnection.BusinessPK = this.DataScriptRule.DesBusinessPk; columnConnection.Target = TableDAL.getTableStructure(this.DataScriptRule.DesTable); }
private DataTable GetDataTable(string fileName) { DataTable dt; if (FileType.SelectedValue.ToString() == "mdb") { AccessImportHelper helper = new AccessImportHelper(fileName); dt = helper.getDataTable(); } else if (FileType.SelectedValue.ToString() == "xls/xlsx") { dt = ExcelImportHelper.GetDataTable(fileName); } else if (FileType.SelectedValue.ToString() == "db") { dt = SQLiteImportHelper.GetDataTable(fileName); } else { dt = TextImportHelper.GetDataTable(fileName, DataScriptRule.getColSeperatorChar(GetColSperator())); } return(dt); }
private void openTemplateFile_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { dataScript = ScriptName.SelectedItem as DataScript; dataRule = DataScriptRuleDAL.getInfo(dataScript.FID); System.Windows.Forms.OpenFileDialog dialog = new System.Windows.Forms.OpenFileDialog(); if (FileType.SelectedValue.ToString() == "xls/xlsx") { dialog.Filter = "(Excel 文件)|*.xls;*.xlsx"; } else if (FileType.SelectedValue.ToString() == "dat") { dialog.Filter = "(dat 文件)|*.dat"; } else if (FileType.SelectedValue.ToString() == "db") { dialog.Filter = "(sqlite 文件)|*.db"; } else if (FileType.SelectedValue.ToString() == "mdb") { dialog.Filter = "(mdb 文件)|*.mdb"; } else if (FileType.SelectedValue.ToString() == "fws10") { dialog.Filter = "(fws10 文件)|*.fws10"; } else { dialog.Filter = "(文本文件)|*.txt"; } System.Windows.Forms.DialogResult result = dialog.ShowDialog(); DataTable dt = new DataTable(); if (result == System.Windows.Forms.DialogResult.OK) { txtTemplageFile.Text = dialog.FileName; if (FileType.SelectedValue.ToString() == "mdb") { AccessImportHelper helper = new AccessImportHelper(dialog.FileName); dt = helper.getDataTable(); } else if (FileType.SelectedValue.ToString() == "xls/xlsx") { dt = ExcelImportHelper.GetDataTable(dialog.FileName); } else if (FileType.SelectedValue.ToString() == "db") { dt = SQLiteImportHelper.GetDataTable(dialog.FileName); } else { dt = TextImportHelper.GetDataTable(dialog.FileName, dataRule.getColSeperatorChar()); } dataGrid.ItemsSource = dt.AsDataView(); importGrid.ItemsSource = dt; checkStruct(dt, dataScript); } }