public UnitOfWork(IDbContextFactory <APPDbContext> dbContextFactory, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor) { _dbContext = dbContextFactory.GetContext(); UserRepository = new UserRepository(_dbContext); AccountsRepository = new AccountsRepository(_dbContext); Account_RolesRepository = new Account_RolesRepository(_dbContext); RolesRepository = new RolesRepository(_dbContext); PermissionsRepository = new PermissionsRepository(_dbContext); EmployeesRepository = new EmployeesRepository(_dbContext); MenusRepository = new MenusRepository(_dbContext); JobPositionsRepository = new JobPositionsRepository(_dbContext); MotorManufactureRepository = new MotorManufactureRepository(_dbContext); MotorTypesRepository = new MotorTypesRepository(_dbContext); ServicesRepository = new ServicesRepository(_dbContext); MotorLiftsRepository = new MotorLiftsRepository(_dbContext); SupplierRepository = new SupplierRepository(_dbContext); CustomersRepository = new CustomersRepository(_dbContext); AccessoriesRepository = new AccessoriesRepository(_dbContext); TemporaryBill_ServiceRepository = new TemporaryBill_ServiceRepository(_dbContext); TemporaryBillRepository = new TemporaryBillRepository(_dbContext); TemporaryBill_AccesaryRepository = new TemporaryBill_AccesaryRepository(_dbContext); ImportReceiptRepository = new ImportReceiptRepository(_dbContext); ImportReceipt_AccessoryRepository = new ImportReceipt_AccessoryRepository(_dbContext); ServicePriceHistoryRepository = new ServicePriceHistoryRepository(_dbContext); AccessoryPriceHistoryRepository = new AccessoryPriceHistoryRepository(_dbContext); }
/// <summary> /// Загрузка окна, инициализация контроллеров, загрузка в listview данных и сброс управления. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void MetroWindow_Loaded(object sender, RoutedEventArgs e) { Firts_Start = true; DBConnection oDBConnection = new DBConnection(); await oDBConnection.InitializeDatabase(); oOrdersRepository = new OrdersRepository(oDBConnection); oClientsRepository = new ClientsRepository(oDBConnection); oCardsRepository = new CardsRepository(oDBConnection); oBouquetsRepository = new BouquetsRepository(oDBConnection); oContentsRepository = new ContentsRepository(oDBConnection); oCartsRepository = new CartsRepository(oDBConnection); oAccessoriesRepository = new AccessoriesRepository(oDBConnection); oFlowersRepository = new FlowersRepository(oDBConnection); oSpecialDealsRepository = new SpecialDealsRepository(oDBConnection); oDiscountRepository = new DiscountsRepository(oDBConnection); conn = oDBConnection.GetAsyncConnection(); lCart_Bouquet = new List <Cart_Bouquet>(); await Update_ListView_Clients(); await Update_ListView_Bouquets(); Clear_Control_All(); }
Flowers oFlowers; // Хранит в себе выделенный в ListView объект /// <summary> /// Инициализация контроллеров при загрузке формы /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void MetroWindow_Loaded(object sender, RoutedEventArgs e) { DBConnection oDBConnection = new DBConnection(); await oDBConnection.InitializeDatabase(); oAccessoriesRepository = new AccessoriesRepository(oDBConnection); oFlowersRepository = new FlowersRepository(oDBConnection); await Update_ListView(); Clear_Controls(); }