Ejemplo n.º 1
0
        private void ProcessImportABNModelView(string fileName, OptionViewModel options)
        {
            if (ImportFile(fileName))
            {
                try
                {
                    using (BankingDbContext db = new BankingDbContext(options.DbConnection))
                    {
                        foreach (Import record in Cache)
                        {
                            db.Imports.Add(record);
                            db.SaveChanges();
                        }
                    }

                    Log.Write($"{Cache.Count} records are imported from ABN file");
                    MessageBox.Show($"{Cache.Count} records are imported.",
                                    "Import ABN",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
                catch (Exception ex)
                {
                    Log.Write($"Import ABN file has failed after record {Cache.Count}", ex.Message, ex.InnerException.ToString());
                    throw new ImportException("Import ABN file has failed");
                }
            }
        }
Ejemplo n.º 2
0
        public ImportINGViewModel(string fileName, OptionViewModel options)
        {
            if (ImportFile(fileName))
            {
                try
                {
                    using (BankingDbContext db = new BankingDbContext(options.DbConnection))
                    {
                        foreach (Import record in Cache)
                        {
                            db.Imports.Add(record);
                            db.SaveChanges();
                        }
                    }

                    Log.Write($"{Cache.Count} records are imported from ING file");
                    MessageBox.Show($"{Cache.Count} records are imported.",
                                    "Import ING",
                                    MessageBoxButton.OK,
                                    MessageBoxImage.Information);
                }
                catch
                {
                    Log.Write("Failed importing ING file");
                    throw new ImportException("Import ING file has failed");
                }
            }
        }
Ejemplo n.º 3
0
        public OVCardViewModel(OptionViewModel options, OVCardList listView)
        {
            Options  = options;
            ListView = listView;

            OpenCards();
        }
Ejemplo n.º 4
0
        public ImportProcessViewModel(OptionViewModel options, MainViewModel mainVM)
        {
            Options = options;
            MainVM  = mainVM;

            ProcessImportToBankAsync();
            ProcessMissedTallies();
            ProcessPostImportAsync();
        }
Ejemplo n.º 5
0
        public ImportViewModel(OptionViewModel options, MainWindow parent)
        {
            Options = options;

            OpenImportTable();

            View = new ImportWindow(this)
            {
                Top  = parent.Top + 20,
                Left = parent.Left + 20
            };

            View.ShowDialog();
        }
Ejemplo n.º 6
0
        public BankViewModel(OptionViewModel options, OverviewWindow parent, MainViewModel mainVM, string tallyName, string month)
        {
            Options = options;
            MainVM  = mainVM;

            OpenBankTable(tallyName, month);
            View = new BankWindow(this)
            {
                Top  = parent.Top + 20,
                Left = parent.Left + 20
            };

            bool?Result = View.ShowDialog();

            if ((bool)Result)
            {
                Db.Dispose();
            }
        }
Ejemplo n.º 7
0
        public BankViewModel(OptionViewModel options, MainWindow parent, MainViewModel mainVM, bool hasMissedTallies = false)
        {
            Options          = options;
            MainVM           = mainVM;
            HasMissedTallies = hasMissedTallies;

            OpenBankTable();
            View = new BankWindow(this)
            {
                Top  = parent.Top + 20,
                Left = parent.Left + 20
            };

            bool?Result = View.ShowDialog();

            if ((bool)Result)
            {
                Db.Dispose();
            }
        }
Ejemplo n.º 8
0
 public ImportABNViewModel(string fileName, OptionViewModel options)
 {
     Log.Write("Starting ABN import");
     ProcessImportABNModelView(fileName, options);
 }