Beispiel #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="localizer"></param>
 /// <param name="configuration"></param>
 /// <param name="loggerFactory"></param>
 /// <param name="logger"></param>
 /// <param name="slotRepository"></param>
 /// <param name="placeRepository"></param>
 /// <param name="userRepository"></param>
 /// <param name="visitorRepository"></param>
 /// <param name="placeProviderRepository"></param>
 /// <param name="mojeEZdravie"></param>
 /// <param name="emailSender"></param>
 /// <param name="smsSender"></param>
 public AdminController(
     IStringLocalizer <AdminController> localizer,
     IConfiguration configuration,
     ILoggerFactory loggerFactory,
     ILogger <AdminController> logger,
     ISlotRepository slotRepository,
     IPlaceRepository placeRepository,
     IUserRepository userRepository,
     IVisitorRepository visitorRepository,
     IPlaceProviderRepository placeProviderRepository,
     IMojeEZdravie mojeEZdravie,
     IEmailSender emailSender,
     ISMSSender smsSender
     )
 {
     this.localizer               = localizer;
     this.loggerFactory           = loggerFactory;
     this.logger                  = logger;
     this.slotRepository          = slotRepository;
     this.placeRepository         = placeRepository;
     this.userRepository          = userRepository;
     this.configuration           = configuration;
     this.visitorRepository       = visitorRepository;
     this.placeProviderRepository = placeProviderRepository;
     this.mojeEZdravie            = mojeEZdravie;
     this.emailSender             = emailSender;
     this.smsSender               = smsSender;
 }
Beispiel #2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="localizer"></param>
 /// <param name="configuration"></param>
 /// <param name="loggerFactory"></param>
 /// <param name="redisCacheClient"></param>
 /// <param name="emailSender"></param>
 /// <param name="smsSender"></param>
 /// <param name="placeRepository"></param>
 /// <param name="slotRepository"></param>
 /// <param name="placeProviderRepository"></param>
 /// <param name="userRepository"></param>
 public VisitorRepository(
     IStringLocalizer <Repository.RedisRepository.VisitorRepository> localizer,
     IConfiguration configuration,
     ILoggerFactory loggerFactory,
     IRedisCacheClient redisCacheClient,
     IEmailSender emailSender,
     ISMSSender smsSender,
     IPlaceRepository placeRepository,
     ISlotRepository slotRepository,
     IPlaceProviderRepository placeProviderRepository,
     IUserRepository userRepository
     ) : base(
         localizer,
         configuration,
         loggerFactory.CreateLogger <Repository.RedisRepository.VisitorRepository>(),
         redisCacheClient,
         emailSender,
         smsSender,
         placeRepository,
         slotRepository,
         placeProviderRepository,
         userRepository
         )
 {
     logger             = loggerFactory.CreateLogger <VisitorRepository>();
     this.configuration = configuration;
 }
Beispiel #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="slotRepository"></param>
 public SlotController(
     ILogger <SlotController> logger,
     ISlotRepository slotRepository
     )
 {
     this.logger         = logger;
     this.slotRepository = slotRepository;
 }
 public SlotsController(ApplicationDbContext db, ISlotRepository repository, IRoomRepository roomRepository, IStaffRepository staffRepository, IStudentRepository studentRepository)
 {
     _db = db;
     _repo = repository;
     _roomRepo = roomRepository;
     _staffRepo = staffRepository;
     _studentRepo = studentRepository;
 }
Beispiel #5
0
 public AstreintesController(ISlotService service, ISlotRepository repository, IValidation <Slot> slotValidation, IValidation <User> userValidation, EFContext efContext, IMapper <Slot, SlotUI> slotMapper)
 {
     slotService         = service;
     slotRepository      = repository;
     this.slotValidation = slotValidation;
     this.userValidation = userValidation;
     context             = efContext;
     mapper = slotMapper;
 }
Beispiel #6
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="localizer"></param>
 /// <param name="logger"></param>
 /// <param name="placeRepository"></param>
 /// <param name="userRepository"></param>
 /// <param name="placeProviderRepository"></param>
 /// <param name="slotRepository"></param>
 public PlaceController(
     IConfiguration configuration,
     IStringLocalizer <PlaceController> localizer,
     ILogger <PlaceController> logger,
     IPlaceRepository placeRepository,
     IUserRepository userRepository,
     IPlaceProviderRepository placeProviderRepository,
     ISlotRepository slotRepository
     )
 {
     this.configuration           = configuration;
     this.localizer               = localizer;
     this.logger                  = logger;
     this.placeRepository         = placeRepository;
     this.userRepository          = userRepository;
     this.placeProviderRepository = placeProviderRepository;
     this.slotRepository          = slotRepository;
 }
Beispiel #7
0
 public SlotService(ILogger <SlotService> logger, ISlotRepository slotRepository)
 {
     _logger         = logger;
     _slotRepository = slotRepository;
 }
Beispiel #8
0
 public SlotService(ISlotRepository  slotRepository)
 {
     _slotrepository = slotRepository;
 }
Beispiel #9
0
 public SlotService(ISlotRepository slotRepository, ISlotValidation slotValidation)
 {
     repository = slotRepository;
     validation = slotValidation;
 }
Beispiel #10
0
 public SlotController(ApplicationDbContext db, ISlotRepository repository)
 {
     _db  = db;
     repo = repository;
 }
Beispiel #11
0
 public SlotService(ISlotRepository slotRepository, ICompanySlotRepository companySlotRepository)
 {
     _slotRepository        = slotRepository;
     _companySlotRepository = companySlotRepository;
 }
Beispiel #12
0
 public SlotService(ISlotScoreProvider scoreProvider, ISlotRepository slotRepository)
 {
     _scoreProvider  = scoreProvider;
     _slotRepository = slotRepository;
 }
Beispiel #13
0
 public SlotService(ISlotRepository slotRepository, IFloorRepository floorRepository, ILogger <SlotService> logger)
 {
     _slotRepository  = slotRepository ?? throw new ArgumentNullException(nameof(slotRepository));
     _floorRepository = floorRepository ?? throw new ArgumentNullException(nameof(floorRepository));
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Beispiel #14
0
 public SlotService(IUserContext userContext, ISlotRepository repository, IEmailService emailService)
 {
     _userContext  = userContext;
     _repository   = repository;
     _emailService = emailService;
 }
Beispiel #15
0
 public SlotService(ISlotRepository repository, IUnitOfWork unitOfWork)
 {
     _repository = repository;
     _unitOfWork = unitOfWork;
 }
Beispiel #16
0
        public void Setup()
        {
            _slotRepository = MockRepository.GenerateStub<ISlotRepository>();
            _slotService = new SlotService(_slotRepository);
            _urlHelper = MockRepository.GenerateStub<IUrlHelper>();
            _objectUnderTest = new SlotController(_slotService, _urlHelper);

            _objectUnderTest.Request = new HttpRequestMessage();
            _objectUnderTest.Request.SetConfiguration(new HttpConfiguration());
        }
 public KioskService(IKioskRepository kioskRepository,
                     ISlotRepository slotRepository)
 {
     _kioskRepository = kioskRepository;
     _slotRepository  = slotRepository;
 }
Beispiel #18
0
        /// <summary>
        /// Downloads the visitors from eHealth
        /// </summary>
        /// <param name="placeProviderId"></param>
        /// <param name="managerEmail"></param>
        /// <param name="day"></param>
        /// <param name="visitorRepository"></param>
        /// <param name="placeRepository"></param>
        /// <param name="placeProviderRepository"></param>
        /// <param name="slotRepository"></param>
        /// <param name="loggerFactory"></param>
        /// <returns></returns>
        public async Task <int> DownloadEHealthVisitors(
            string placeProviderId,
            string managerEmail,
            DateTimeOffset day,
            IVisitorRepository visitorRepository,
            IPlaceRepository placeRepository,
            IPlaceProviderRepository placeProviderRepository,
            ISlotRepository slotRepository,
            ILoggerFactory loggerFactory
            )
        {
            var logger = loggerFactory.CreateLogger <MojeEZdravieAbstract>();

            logger.LogInformation($"eHealth: Downloading {placeProviderId} {managerEmail} {day}");
            var rPlaces = (await placeRepository.ListAll())?.Where(p => p.PlaceProviderId == placeProviderId);

            if (rPlaces == null || !rPlaces.Any())
            {
                throw new Exception("This place provider does not have any place defined");
            }
            var pp = await placeProviderRepository.GetPlaceProvider(placeProviderId);

            var product = pp.Products.FirstOrDefault(pr => pr.EHealthDefault == true);

            if (product == null)
            {
                product = pp.Products.FirstOrDefault();
            }

            int ret  = 0;
            var data = await MakeSurePlaceProviderIsAuthenticated(placeProviderId, placeProviderRepository);

            var token  = data.LoginPayload.Session.Token;
            var places = await DriveInQueue(token, day);

            if (places.Payload == null)
            {
                throw new Exception("No places found");
            }

            foreach (var place in places.Payload)
            {
                var rPlace = rPlaces.FirstOrDefault(p => p.EHealthId == place.Id);
                if (rPlace == null)
                {
                    rPlace = rPlaces.FirstOrDefault();
                }

                var list = await PlaceDetail(token, day, place.Id);

                foreach (var person in list.Payload)
                {
                    if (!person.DesignatedDriveinScheduledAt.HasValue)
                    {
                        continue;
                    }
                    if (string.IsNullOrEmpty(person.BirthNumber?.FormatDocument()))
                    {
                        continue;
                    }
                    var slot = await slotRepository.GetCurrentSlot(rPlace.Id, person.DesignatedDriveinScheduledAt.Value);

                    var documentClear = person.BirthNumber.FormatDocument();
                    var existing      = await visitorRepository.GetVisitorByPersonalNumber(documentClear, true);

                    if (existing != null && existing.ChosenPlaceId == rPlace.Id && existing.ChosenSlot == slot.SlotId)
                    {
                        continue; // already exists
                    }

                    var visitor = new Visitor()
                    {
                        ChosenSlot           = slot.SlotId,
                        ChosenPlaceId        = rPlace.Id,
                        Product              = product.Id,
                        FirstName            = person.FirstName,
                        LastName             = person.LastName,
                        RC                   = person.BirthNumber,
                        Insurance            = person.HealthInsuranceCompany,
                        PersonTrackingNumber = person.PersonTrackingNumber,
                        Gender               = person.Gender,
                        Street               = person.Street,
                        StreetNo             = person.StreetNumber,
                        City                 = person.City,
                        ZIP                  = person.PostalCode,
                        Phone                = person.PrimaryPhone,
                        Language             = "sk",
                        Result               = TestResult.NotTaken,
                        DownloadedAt         = DateTimeOffset.UtcNow
                    };
                    var newRegistration = await visitorRepository.Register(visitor, managerEmail, false);

                    logger.LogInformation($"eHealth: Visitor downloaded {visitor.Id} {visitor.RC.GetSHA256Hash()}");
                    ret++;
                }
            }
            return(ret);
        }