private async Task ProcessPostImportAsync() { int updates; DictPostImport(); using (BankingDbContext db = new BankingDbContext(Options.DbConnection)) { foreach (var item in PostImport) { try { updates = await db.Database.ExecuteSqlCommandAsync(item.Value); Log(item.Key, updates); } catch (Exception ex) { Log($"Error in SQL '{item.Key}' with [{ex}]"); } } } PostImport.Clear(); }
/// <summary> /// Initializes a new instance of the <see cref="ParameterizationsRepository"/> class. /// </summary> /// <param name="bankingDbContext"> /// The banking database context. /// </param> /// <param name="humanRepository"> /// The human Repository. /// </param> /// <param name="accountRepository"> /// The account Repository. /// </param> /// <param name="cacheProvider"> /// The cache Provider. /// </param> public ParameterizationsRepository(BankingDbContext bankingDbContext, IHumanRepository humanRepository, IAccountRepository accountRepository, Domain.ICacheProvider cacheProvider) { this.context = bankingDbContext; this.humanRepository = humanRepository; this.cacheProvider = cacheProvider; this.accountRepository = accountRepository; }
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"); } } }
private async Task ProcessImportToBankAsync() { int updates; Log($"Start ProcessImportToBank() with {CheckMissedTallies()} missed tallies"); DictImportToBank(); using (BankingDbContext db = new BankingDbContext(Options.DbConnection)) { foreach (var item in ImportToBank) { try { updates = await db.Database.ExecuteSqlCommandAsync(item.Value); Log(item.Key, updates); } catch (Exception ex) { Log($"Error in SQL '{item.Key}' with [{ex}]"); } } } ImportToBank.Clear(); await MainVM.GetAccountSummaryAsync(); MissedTalliesCount = CheckMissedTallies(); Log($"After ProcessImportToBank() has {MissedTalliesCount} missed tallies"); }
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"); } } }
public IntegrationEventLogService( BankingDbContext bankingDbContext , IServiceBusEndpoint endpoint ) { _bankingDbContext = bankingDbContext; _endpoint = endpoint; }
public EFPersistenceContext(BankingDbContext context) { this.dbContext = context; CustomerRepository = new EFCustomerRepository(context); CardRepository = new EFCardRepository(context); //CardTransactionRepository = new EFCardTransactionRepository(context); }
private async void OpenImportTable() { using BankingDbContext db = new BankingDbContext(Options.DbConnection); var Imports = await(from a in db.Imports orderby a.Date descending select a).ToListAsync(); View.ImportDataGrid.ItemsSource = Imports; }
private void OpenCards() { using BankingDbContext db = new BankingDbContext(Options.DbConnection); var cards = (from a in db.OVCards orderby a.Id descending select a).ToList(); Cards = new List <OVCard>(cards); }
public static BankingDbContext GetDatabaseContext() { var options = new DbContextOptionsBuilder <BankingDbContext>() .UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()) .Options; var context = new BankingDbContext(options); Initialize(context); return(context); }
private static bool CheckAccountNumber(string accountNumber, BankingDbContext context) { foreach (var num in context.Accounts) { if (accountNumber == num.Number) { return(true); } } return(false); }
private static string CreateNewAccountNumber(BankingDbContext context) { var r = new Random(); string accountNumber; while (CheckAccountNumber(accountNumber = ((long)(r.NextDouble() * 100000000000000)).ToString(), context)) { ; } return(accountNumber); }
public TransactionBehaviour(BankingDbContext dbContext, IIntegrationEventLogService integrationEventLogService, ILogger <TransactionBehaviour <TRequest, TResponse> > logger , IServiceBusEndpoint endpoint ) { _dbContext = dbContext ?? throw new ArgumentException(nameof(BankingDbContext)); //_orderingIntegrationEventService = orderingIntegrationEventService ?? throw new ArgumentException(nameof(orderingIntegrationEventService)); _integrationEventLogService = integrationEventLogService; _logger = logger ?? throw new ArgumentException(nameof(ILogger)); _endpoint = endpoint; }
public async void OpenBankTable(string TallyName = null, string Month = null) { Db = new BankingDbContext(Options.DbConnection); { List <Bank> accounts = await(from a in Db.Accounts orderby a.Date descending select a).ToListAsync(); Accounts = new ObservableCollection <Bank>(accounts); Tallies = Accounts .Select(x => x.TallyName) .Distinct() .OrderBy(x => x) .ToList(); if (HasMissedTallies) { List <Bank> filteredAccounts = Accounts .Where(x => x.TallyName is null) .ToList(); FilteredAccounts = new ObservableCollection <Bank>(filteredAccounts); View.BankingDataGrid.ItemsSource = FilteredAccounts; View.Title = "Gemiste markeringen"; } else if (!(string.IsNullOrWhiteSpace(TallyName) && string.IsNullOrWhiteSpace(Month))) { List <Bank> filteredAccounts = Accounts .Where(x => x.TallyName == TallyName && x.Month == Month) .ToList(); FilteredAccounts = new ObservableCollection <Bank>(filteredAccounts); View.BankingDataGrid.ItemsSource = FilteredAccounts; } else if (!string.IsNullOrWhiteSpace(AccountFilter)) { List <Bank> filteredAccounts = Accounts .Where(x => x.RawText.ToLower().Contains(AccountFilter.ToLower()) || x.Name.ToLower().Contains(AccountFilter.ToLower())) .ToList(); FilteredAccounts = new ObservableCollection <Bank>(filteredAccounts); View.BankingDataGrid.ItemsSource = FilteredAccounts; } else { View.BankingDataGrid.ItemsSource = Accounts; } } }
public void ClearImportTable() { using BankingDbContext db = new BankingDbContext(Options.DbConnection); MessageBoxResult result = MessageBox.Show("Are you sure to clear the import table?", "Clear import table", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result != MessageBoxResult.Yes) { return; } db.Database.ExecuteSqlCommand("TRUNCATE TABLE Import"); Thread.Sleep(1000); GetSummaries(); }
private async Task ProcessMissedTallies() { int updates; int totalUpdates = 0; Log($"Start ProcessMissedTallies() with {CheckMissedTallies()} missed tallies"); if (MainVM.TalliesRules.Count == 0) { MainVM.ReadTalliesRules(); } using (BankingDbContext db = new BankingDbContext(Options.DbConnection)) { foreach (var item in MainVM.TalliesRules) { try { updates = await db.Database.ExecuteSqlCommandAsync(item.Value); totalUpdates += updates; if (updates > 0) { Log(item.Key, updates); } } catch (Exception ex) { Log($"Error in SQL '{item.Key}' with [{ex}]"); } } } Log($"Total {totalUpdates} updates"); //MainVM.TalliesRules.Clear(); await MainVM.GetAccountSummaryAsync(); MissedTalliesCount = CheckMissedTallies(); Log($"After ProcessImportToBank() has {MissedTalliesCount} missed tallies"); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, BankingDbContext dbContext) { dbContext.Database.Migrate(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } // app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseSwagger(); app.UseSwaggerUI(o => { o.SwaggerEndpoint("/swagger/v1/swagger.json", "Banking Microservice V1"); }); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IHostingEnvironment env, AppContext appContext, BankingDbContext bankingDbContext, MarketingDbContext marketingDbContext) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseMvc(); appContext.Seed().Wait(); // Normally I shouldn't need these extra Seed methods // But somehow UseInMemoryDatabase won't let me share data across contexts bankingDbContext.Seed().Wait(); marketingDbContext.Seed().Wait(); }
public AccountRepository(BankingDbContext ctx) { _ctx = ctx ?? throw new ArgumentNullException(nameof(ctx)); }
public AccountController(BankingDbContext context, AccountValidator validator) : base(context, validator) { }
public AccountDAL(BankingDbContext ctx) { _ctx = ctx; }
public AccountRepository(BankingDbContext dbContext) : base(dbContext) { myOwnDbContext = dbContext; }
public AccountRepository(BankingDbContext dbContext) { _dbContext = dbContext; }
public AccountRepository(BankingDbContext context) { _context = context; }
public RoundUpRepository(BankingDbContext dbContext, IUow <RoundUp> uow) { _dbContext = dbContext; Uow = uow; }
public IntegrationEventLogRepository(BankingDbContext dbContext) : base(dbContext) { }
public AccountRepository(BankingDbContext bankingDbContext) { _bankingDbContext = bankingDbContext; }
public TransactionHistoriesRepository(BankingDbContext dbContext) : base(dbContext) { }
public AccountRepository(BankingDbContext ctx) { _ctx = ctx; }
/// <summary> /// Initializes a new instance of the <see cref="CurrencyRepository"/> class. /// </summary> /// <param name="bankingDbContext"> /// The banking database context. /// </param> public CurrencyRepository(BankingDbContext bankingDbContext) { this.context = bankingDbContext; }