public void Execute(object parameter) { if (specifiedImport.newBankTextbox.Text.ToString() != "") { List <string> currentFile = new List <string>(); currentFile.Add(currentFileName); new ImportReadIn("Bank", currentFile, specifiedImport.mainWindow, true); if (SpecifiedImportBank.folderPath.Count < specifiedImport.getCurrentFileIndex()) { specifiedImport.incrementNumberofFile(); string nextFileName = SpecifiedImportBank.folderPath[specifiedImport.getCurrentFileIndex()]; string[] splittedFileName = nextFileName.Split('\\'); int lastSplitIndex = nextFileName.Length - 1; specifiedImport.currentFileLabel.Content = "File: " + splittedFileName[lastSplitIndex]; StoredColumnChecker columnChecker = new StoredColumnChecker(); columnChecker.getDataTableFromSql(specifiedImport.mainWindow); columnChecker.addDistinctBanksToCB(); columnChecker.setAnalyseWorksheet(nextFileName); columnChecker.setMostMatchesRow(columnChecker.findMostMatchingRow()); columnChecker.setSpecifiedImportPageTextBoxes(); } } else//didn't typed in the new banks name { MessageBox.Show("Type in the new Bank name first, to the TextBox under the Type ComboBox!"); specifiedImport.newBankTextbox.Focus(); } }
public void Execute(object parameter) { if (buttonContent.Equals("Import Bank Transactions")) { MessageBoxResult messageBoxResult = CustomMessageBox.ShowYesNo( "\tPlease choose an import type!", "Import type alert!", "Automatized", "User specified"); if (messageBoxResult == MessageBoxResult.Yes || messageBoxResult == MessageBoxResult.No) { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.DefaultExt = ".xls,.csv"; dlg.Filter = "Excel files (*.xls)|*.xls|Excel Files (*.xlsx)|*.xlsx|Excel Files (*.xlsm)|*.xlsm|CSV Files (*.csv)|*.csv"; dlg.Multiselect = true; Nullable <bool> result = dlg.ShowDialog(); if (result == true) { List <string> fileAdresses = dlg.FileNames.ToList(); for (int i = 0; i < dlg.FileNames.ToList().Count; i++) { check_if_csv(i, ref fileAdresses); } if (messageBoxResult == MessageBoxResult.Yes) { importPageBank.getTransactions("Bank", fileAdresses); } else if (messageBoxResult == MessageBoxResult.No) { string[] fileName = dlg.FileNames.ToList()[0].Split('\\'); int lastPartIndex = fileName.Length - 1; // to see which file the user immporting first SpecifiedImportBank.getInstance(fileAdresses, importPageBank.mainWindow).setCurrentFileLabel(fileName[lastPartIndex]); //fájl felismerés SpecifiedImportBank.getInstance(null, importPageBank.mainWindow).setBoxValuesToZero(); StoredColumnChecker columnChecker = new StoredColumnChecker(); columnChecker.getDataTableFromSql(importPageBank.mainWindow); columnChecker.addDistinctBanksToCB(); columnChecker.setAnalyseWorksheet(dlg.FileNames.ToList()[0]); columnChecker.setMostMatchesRow(columnChecker.findMostMatchingRow()); columnChecker.setSpecifiedImportPageTextBoxes(); importPageBank.mainWindow.MainFrame.Content = SpecifiedImportBank.getInstance(dlg.FileNames.ToList(), importPageBank.mainWindow); } } } } else if (buttonContent == "importHistoryButton") { ImportStatsChartBank importStatsChart = new ImportStatsChartBank(importPageBank.banks); importStatsChart.selectedBank = "All"; importPageBank.mainWindow.MainFrame.Content = importStatsChart; } }
public void Execute(object parameter) { List <string> currentFile = new List <string>(); currentFile.Add(currentFileName); new ImportReadIn("Bank", currentFile, specifiedImport.mainWindow, true); if (SpecifiedImport.folderPath.Count < specifiedImport.getCurrentFileIndex()) { specifiedImport.incrementNumberofFile(); string nextFileName = SpecifiedImport.folderPath[specifiedImport.getCurrentFileIndex()]; string[] splittedFileName = nextFileName.Split('\\'); int lastSplitIndex = nextFileName.Length - 1; specifiedImport.currentFileLabel.Content = "File: " + splittedFileName[lastSplitIndex]; set_box_values_to_zero(); StoredColumnChecker columnChecker = new StoredColumnChecker(); columnChecker.getDataTableFromSql(specifiedImport.mainWindow); columnChecker.setAnalyseWorksheet(nextFileName); columnChecker.setMostMatchesRow(columnChecker.findMostMatchingRow()); columnChecker.setSpecifiedImportPageTextBoxes(); } }