Пример #1
0
        static void Main(string[] args)
        {
            var ninjectKernel  = NinjectWebKernel.CreateKernel();
            var historyService = ninjectKernel.Get <IAddressHistoryService>();
            var service        = ninjectKernel.Get <UpdateService>();
            var logger         = ninjectKernel.Get <ILogger>();
            var customSettings = ninjectKernel.Get <ICustomSettings>();

            logger.Log("DBUpdater er start", "dbupdater");
            try
            {
                service.MigrateOrganisations();
                service.MigrateEmployees();
                historyService.UpdateAddressHistories();
                historyService.CreateNonExistingHistories();
                service.UpdateLeadersOnExpiredOrActivatedSubstitutes();
                service.AddLeadersToReportsThatHaveNone();
                service.UpdateVacationBalance();
                logger.Log("DBUpdater kørte uden fejl", "dbupdater");
            }
            catch (Exception ex)
            {
                logger.Log("Fejl:", "dbupdater", ex);
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            var ninjectKernel = NinjectWebKernel.CreateKernel();

            ILogger _logger = NinjectWebKernel.CreateKernel().Get <ILogger>();

            _logger.Debug($"-------- DBUPDATER STARTED --------");

            IAddressHistoryService historyService = new AddressHistoryService(ninjectKernel.Get <IGenericRepository <Employment> >(), ninjectKernel.Get <IGenericRepository <AddressHistory> >(), ninjectKernel.Get <IGenericRepository <PersonalAddress> >());

            var service = new UpdateService(ninjectKernel.Get <IGenericRepository <Employment> >(),
                                            ninjectKernel.Get <IGenericRepository <OrgUnit> >(),
                                            ninjectKernel.Get <IGenericRepository <Person> >(),
                                            ninjectKernel.Get <IGenericRepository <CachedAddress> >(),
                                            ninjectKernel.Get <IGenericRepository <PersonalAddress> >(),
                                            ninjectKernel.Get <IAddressLaunderer>(),
                                            ninjectKernel.Get <IAddressCoordinates>(), new DataProvider(),
                                            ninjectKernel.Get <IMailSender>(),
                                            historyService,
                                            ninjectKernel.Get <IGenericRepository <DriveReport> >(),
                                            ninjectKernel.Get <IDriveReportService>(),
                                            ninjectKernel.Get <ISubstituteService>(),
                                            ninjectKernel.Get <IGenericRepository <Substitute> >());

            service.MigrateOrganisations();
            service.MigrateEmployees();
            historyService.UpdateAddressHistories();
            historyService.CreateNonExistingHistories();
            service.UpdateLeadersOnExpiredOrActivatedSubstitutes();
            service.AddLeadersToReportsThatHaveNone();

            _logger.Debug($"-------- DBUPDATER FINISHED --------");
        }
Пример #3
0
 public UpdateService(IGenericRepository <Employment> emplRepo,
                      IGenericRepository <OrgUnit> orgRepo,
                      IGenericRepository <Person> personRepo,
                      IGenericRepository <CachedAddress> cachedRepo,
                      IGenericRepository <PersonalAddress> personalAddressRepo,
                      IAddressLaunderer actualLaunderer,
                      IAddressCoordinates coordinates,
                      IDbUpdaterDataProvider dataProvider,
                      IMailService mailService,
                      IAddressHistoryService historyService,
                      IGenericRepository <DriveReport> reportRepo,
                      IDriveReportService driveService,
                      ISubstituteService subService,
                      IGenericRepository <Substitute> subRepo)
 {
     _emplRepo            = emplRepo;
     _orgRepo             = orgRepo;
     _personRepo          = personRepo;
     _cachedRepo          = cachedRepo;
     _personalAddressRepo = personalAddressRepo;
     _actualLaunderer     = actualLaunderer;
     _coordinates         = coordinates;
     _dataProvider        = dataProvider;
     _mailService         = mailService;
     _historyService      = historyService;
     _reportRepo          = reportRepo;
     _driveService        = driveService;
     _subService          = subService;
     _subRepo             = subRepo;
     _driveService        = driveService;
     _logger = NinjectWebKernel.GetKernel().Get <ILogger>();
 }
Пример #4
0
 public AddressHistoryService(IGenericRepository <Employment> emplRepo, IGenericRepository <AddressHistory> addressHistoryRepo, IGenericRepository <PersonalAddress> personalAddressRepo)
 {
     _emplRepo            = emplRepo;
     _addressHistoryRepo  = addressHistoryRepo;
     _personalAddressRepo = personalAddressRepo;
     _changedHistories    = new HashSet <int>();
     _homeAddresses       = new List <PersonalAddress>();
     _workAddresses       = new List <WorkAddress>();
     _logger = NinjectWebKernel.GetKernel().Get <ILogger>();
 }
Пример #5
0
        static void Main(string[] args)
        {
            var ninjectKernel = NinjectWebKernel.GetKernel();

            ILogger         logger         = ninjectKernel.Get <ILogger>();
            ICustomSettings customSettings = ninjectKernel.Get <ICustomSettings>();

            logger.Debug($"-------- DBUPDATER STARTED --------");

            IAddressHistoryService historyService = new AddressHistoryService(ninjectKernel.Get <IGenericRepository <Employment> >(), ninjectKernel.Get <IGenericRepository <AddressHistory> >(), ninjectKernel.Get <IGenericRepository <PersonalAddress> >());

            var service = new UpdateService(ninjectKernel.Get <IGenericRepository <Employment> >(),
                                            ninjectKernel.Get <IGenericRepository <OrgUnit> >(),
                                            ninjectKernel.Get <IGenericRepository <Person> >(),
                                            ninjectKernel.Get <IGenericRepository <CachedAddress> >(),
                                            ninjectKernel.Get <IGenericRepository <PersonalAddress> >(),
                                            ninjectKernel.Get <IAddressLaunderer>(),
                                            ninjectKernel.Get <IAddressCoordinates>(),
                                            new DataProvider(ninjectKernel.Get <ILogger>(), ninjectKernel.Get <ICustomSettings>()),
                                            ninjectKernel.Get <IMailService>(),
                                            historyService,
                                            ninjectKernel.Get <IGenericRepository <DriveReport> >(),
                                            ninjectKernel.Get <IDriveReportService>(),
                                            ninjectKernel.Get <ISubstituteService>(),
                                            ninjectKernel.Get <IGenericRepository <Substitute> >());

            var dbSync = customSettings.DbIntegration ?? "SOFD";

            logger.Debug($"Database integration = {dbSync}");

            switch (dbSync)
            {
            case "IDM":
                service.MigrateOrganisationsIDM();
                service.MigrateEmployeesIDM();
                break;

            case "SOFD":
                service.MigrateOrganisations();
                service.MigrateEmployees();
                break;

            default:
                logger.Error("Could not read database integration type, check CustomSettings.config. DBUpdater will NOT run.");
                return;
            }

            historyService.UpdateAddressHistories();
            historyService.CreateNonExistingHistories();
            service.UpdateLeadersOnExpiredOrActivatedSubstitutes();
            service.AddLeadersToReportsThatHaveNone();
            logger.Debug($"-------- DBUPDATER FINISHED --------");
        }