using LSFE.Domain.Contracts; using LSFE.Domain.Contracts.Doctor; using LSFE.Domain.Contracts.Maintenance; using LSFE.Domain.Contracts.Planning; using LSFE.Domain.Contracts.Reports; using LSFE.Domain.Contracts.TimeKeeping; using LSFE.Domain.Services.Doctor; using LSFE.Domain.Services.Maintenance; using LSFE.Domain.Services.Planning; using LSFE.Domain.Services.Reports; using LSFE.Domain.Services.TimeKeeping; using LSFE.Infrastructure.Database; using LSFE.Infrastructure.Entities.Admin; using LSFE.Infrastructure.Entities.Doctor; using LSFE.Infrastructure.Entities.Maintenance; using LSFE.Infrastructure.Entities.Planning; using LSFE.Infrastructure.Entities.TimeKeeping; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LSFE.Domain.Services { public class UnitOfWork : IUnitOfWork { private readonly LSFEDbContext _context; public IErrorLogger ErrorLogger { get; } public IPlanningRepo Planning { get; } public IDoctorRepo Doctors { get; } public IAttendanceRepo Attendances {get; } public IMaintenanceRepo Areas { get; } public IMaintenanceRepo Districts { get; } public IMaintenanceRepo Divisions { get; } public IMaintenanceRepo Territories { get; } public IMaintenanceRepo Institutions { get; } public IMaintenanceRepo InstitutionCategories { get; } public IMaintenanceRepo Products { get; } public IMaintenanceRepo Specializations { get; } public IMaintenanceRepo Inventory { get; } public IMaintenanceRepo InventoryTransactions { get; } public IMaintenanceRepo ProductTransactions { get; } public IMaintenanceRepo MRRawPlans { get; } public IMaintenanceRepo CatchUpCalls { get; } public IMaintenanceRepo MRPlanDetails { get; } public IMaintenanceRepo MRPlanHeaders { get; } public IMaintenanceRepo UserDevices { get; } public IReportsRepo Reports { get; } public UnitOfWork(LSFEDbContext context) { _context = context; ErrorLogger = new ErrorLogger(_context); Doctors = new DoctorRepo(_context); Planning = new PlanningRepo(_context); Reports = new ReportsRepo(_context); Attendances = new AttendanceRepo(_context); Areas = new MaintenanceRepo(_context); Districts = new MaintenanceRepo(_context); Divisions = new MaintenanceRepo(_context); Territories = new MaintenanceRepo(_context); Institutions = new MaintenanceRepo(_context); InstitutionCategories = new MaintenanceRepo(_context); Products = new MaintenanceRepo(_context); Specializations = new MaintenanceRepo(_context); Inventory = new MaintenanceRepo(_context); InventoryTransactions = new MaintenanceRepo(_context); ProductTransactions = new MaintenanceRepo(_context); MRRawPlans= new MaintenanceRepo(_context); CatchUpCalls = new MaintenanceRepo(_context); MRPlanDetails = new MaintenanceRepo(_context); MRPlanHeaders = new MaintenanceRepo(_context); UserDevices = new MaintenanceRepo(_context); } public async Task SaveChangesAsync() { return await _context.SaveChangesAsync(); } public void Dispose() { _context.Dispose(); } } }