Ejemplo n.º 1
0
 public void setSpecifiedImportPageTextBoxes()
 {
     if (mostMatchingRow != null)
     {
         SpecifiedImport.getInstance(null, mainWindow).transactionsRowTextBox.Text = mostMatchingRow["TransStartRow"].ToString();
         SpecifiedImport.getInstance(null, mainWindow).accountNumberChoice         = accountNumberComboBox;
         SpecifiedImport.getInstance(null, mainWindow).accountNumberTextBox.Text   = mostMatchingRow["AccountNumberPos"].ToString();
         SpecifiedImport.getInstance(null, mainWindow).dateColumnTextBox.Text      = mostMatchingRow["DateColumn"].ToString();
         SpecifiedImport.getInstance(null, mainWindow).priceColumnChoice           = priceComboBox;
         if (priceComboBox == "One column")
         {
             SpecifiedImport.getInstance(null, mainWindow).priceColumnTextBox_1.Text = mostMatchingRow["PriceColumn"].ToString();
         }
         else
         {
             string[] splittedPriceColumns = mostMatchingRow["PriceColumn"].ToString().Split(',');
             SpecifiedImport.getInstance(null, mainWindow).priceColumnTextBox_1.Text = splittedPriceColumns[0];
             SpecifiedImport.getInstance(null, mainWindow).priceColumnTextBox_1.Text = splittedPriceColumns[1];
         }
         SpecifiedImport.getInstance(null, mainWindow).balanceColumnChoice = balanceComboBox;
         if (balanceComboBox != "None")
         {
             SpecifiedImport.getInstance(null, mainWindow).balanceColumnTextBox.Text = mostMatchingRow["BalanceColumn"].ToString();
         }
         SpecifiedImport.getInstance(null, mainWindow).commentColumnTextBox.Text = mostMatchingRow["CommentColumn"].ToString();
     }
 }
Ejemplo n.º 2
0
 public static SpecifiedImport getInstance(List <string> newfoldetPath, MainWindow mainWindow)
 {
     if (newfoldetPath != null)
     {
         folderPath = newfoldetPath;
     }
     if (instance == null)
     {
         instance = new SpecifiedImport(mainWindow);
     }
     return(instance);
 }
 public void Execute(object parameter)
 {
     if (buttonContent.Equals("Import 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)
                 {
                     importPage.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
                     SpecifiedImport.getInstance(fileAdresses, importPage.mainWindow).setCurrentFileLabel(fileName[lastPartIndex]);
                     //fájl felismerés
                     StoredColumnChecker columnChecker = new StoredColumnChecker();
                     columnChecker.getDataTableFromSql(importPage.mainWindow);
                     columnChecker.setAnalyseWorksheet(dlg.FileNames.ToList()[0]);
                     columnChecker.setMostMatchesRow(columnChecker.findMostMatchingRow());
                     columnChecker.setSpecifiedImportPageTextBoxes();
                     importPage.mainWindow.MainFrame.Content = SpecifiedImport.getInstance(dlg.FileNames.ToList(), importPage.mainWindow);
                 }
             }
         }
     }
 }
 public ImportReadIn(string _importType, List <string> _path, MainWindow _mainWindow, bool specifiedByUser)
 {
     path       = _path;
     importType = _importType;
     mainWindow = _mainWindow;
     if (path[0] != "FolderAdress")//a path wasn't choosen, useless if ( not in use )
     {
         for (int i = 0; i < path.Count; i++)
         {
             string [] splittedFileName = path[i].Split('\\');
             int       lastSplitIndex   = splittedFileName.Length - 1;
             currentFileName = splittedFileName[lastSplitIndex];
             ReadWorkbook    = excel.Workbooks.Open(path[i]);
             ReadWorksheet   = ReadWorkbook.Worksheets[1];
             if (importType == "Bank")
             {
                 if (!specifiedByUser)
                 {
                     TemplateBankReadIn templateBank = new TemplateBankReadIn(this, ReadWorkbook, ReadWorksheet, mainWindow, false);
                     //so far we got the Starting Row(of the transactions),Number of Columns, account number
                     templateBank.readOutTransactionColumns(templateBank.getStartingRow(), templateBank.getNumberOfColumns());
                 }
                 else //userSpecified==true
                 {
                     TemplateBankReadIn templateBank          = new TemplateBankReadIn(this, ReadWorkbook, ReadWorksheet, mainWindow, true);
                     string             startingRow           = SpecifiedImport.getInstance(null, mainWindow).transactionsRowTextBox.Text.ToString();
                     string             dateColumn            = SpecifiedImport.getInstance(null, mainWindow).dateColumnTextBox.Text.ToString();
                     string             commentColumn         = SpecifiedImport.getInstance(null, mainWindow).commentColumnTextBox.Text.ToString();
                     string             accountNumberCB       = SpecifiedImport.getInstance(null, mainWindow).accountNumberCB.SelectedItem.ToString();
                     string             transactionPriceCB    = SpecifiedImport.getInstance(null, mainWindow).priceColumnCB.SelectedItem.ToString();
                     string             balanceCB             = SpecifiedImport.getInstance(null, mainWindow).balanceColumnCB.SelectedItem.ToString();
                     string             balanceComboBocString = SpecifiedImport.getInstance(null, mainWindow).balanceColumnTextBox.Text.ToString();
                     templateBank.readOutUserspecifiedTransactions(startingRow, dateColumn, commentColumn, accountNumberCB, transactionPriceCB, balanceCB, balanceComboBocString);
                 }
             }
             else if (importType == "Stock")
             {
                 TemplateStockReadIn templateStock = new TemplateStockReadIn(this, path);
             }
         }
         excel.Application.Quit();
         excel.Quit();
     }
 }
Ejemplo n.º 5
0
 public void Execute(object parameter)
 {
     if (buttonContent.Equals("Import 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)
             {
                 for (int i = 0; i < dlg.FileNames.ToList().Count; i++)
                 {
                     check_if_csv(i, dlg);
                 }
                 //importPage.FolderAddressLabel.Content = dlg.FileName.;
                 if (messageBoxResult == MessageBoxResult.Yes)
                 {
                     importPage.getTransactions("All", dlg.FileNames.ToList());
                 }
                 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
                     SpecifiedImport.getInstance(dlg.FileNames.ToList(), importPage.mainWindow).setCurrentFileLabel(fileName[lastPartIndex]);
                     //fájl felismerés
                     checkIfFileInformationStored(dlg.FileNames.ToList()[0]);
                     importPage.mainWindow.MainFrame.Content = SpecifiedImport.getInstance(dlg.FileNames.ToList(), importPage.mainWindow);
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 public ButtonCommands(SpecifiedImport specifiedImport, string fileName)
 {
     this.specifiedImport             = specifiedImport;
     currentFileName                  = fileName;
     specifiedImport.PropertyChanged += new PropertyChangedEventHandler(test_PropertyChanged);
 }