Example #1
0
        public RegisterConsultantCommandValidator(IConsultantRepository repository)
        {
            _repository = repository;

            RuleFor(consultant => consultant.Username)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage(ValidationErrors.EmptyUsername)
            .Length(2, 25).WithMessage(ValidationErrors.ShortUsername);

            RuleFor(consultant => consultant.Password)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage(ValidationErrors.EmptyPassword)
            .MinimumLength(4).WithMessage(ValidationErrors.ShortPassword)
            .Must(p => p.Any(char.IsDigit)).WithMessage(ValidationErrors.NoDigitPassword);

            RuleFor(consultant => consultant.Location)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage(ValidationErrors.EmptyLocation)
            .MinimumLength(2).WithMessage(ValidationErrors.ShortLocation);

            RuleFor(consultant => consultant.Email)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage(ValidationErrors.EmptyEmail)
            .EmailAddress().WithMessage(ValidationErrors.InvalidEmail)
            .MustAsync(async(email, cancellation) =>
            {
                bool exists = await _repository.CheckUniqueEmail(email);
                return(!exists);
            }).WithMessage(ValidationErrors.NotUniqueEmail);
        }
Example #2
0
 public BookingMadeHandler(
     ITimeAllocationRepository timeAllocationRepository,
     IConsultantRepository consultantRepository)
 {
     _timeAllocationRepository = timeAllocationRepository;
     _consultantRepository     = consultantRepository;
     DomainEvents.Register <TimeAllocationBookedEvent>(TimeAllocationBooked);
 }
 public QualityControlService(IDependencyFactory dependencyFactory)
 {
     _bus = dependencyFactory.GetInstance<IBus>();
     _clientDetailsService = dependencyFactory.GetInstance<IClientDetailsService>();
     _consultantRepo = dependencyFactory.GetInstance<IConsultantRepository>();
     _getCompleteChecklistQuery = dependencyFactory.GetInstance<IGetCompleteChecklistsQuery>();
     _qaAdvisorRepository = dependencyFactory.GetInstance<IQaAdvisorRepository>();
     _lastQaAdvisorAssignedRepository = dependencyFactory.GetInstance<IRepository<LastQaAdvisorAssigned, int>>();
     _favouriteChecklistRepository = dependencyFactory.GetInstance<IFavouriteChecklistRepository>();
 }
Example #4
0
 public HimsSetupController(IPackageRepository packagerepo,
                            ITestRepository testrepo,
                            IConsultantRepository consultantRepository,
                            IDiagnosisRepository diarepo,
                            IEmbryologistRepository _embryologistRepo,
                            IEmbryologyCodeRepository _embryologyCodeRepo,
                            IVisitNatureRepository _VisitNature_repo,
                            ITestTypeRepository tsttyperepo,
                            ITestCategoryRepository tstcatrepo,
                            IPatientPackageRepository Patientpackagerepo,
                            IProcedureRepository Procedurerepo,
                            ISonologistRepository Sonologistrepo,
                            IMedicineRequestRepository MedicineRequestrepo,
                            IOtTerminologyRepository OtTerminologyrepo,
                            IOtProcedureRepository OtProcedurerepo,
                            IOtEquipmentRepository OtEquipmentrepo
                            )
 {
     con_repo            = consultantRepository;
     package_repo        = packagerepo;
     test_repo           = testrepo;
     dia_repo            = diarepo;
     embryologistRepo    = _embryologistRepo;
     embryologyCodeRepo  = _embryologyCodeRepo;
     VisitNature_repo    = _VisitNature_repo;
     testType_repo       = tsttyperepo;
     testCategory_repo   = tstcatrepo;
     Patientpackage_repo = Patientpackagerepo;
     Procedure_repo      = Procedurerepo;
     Sonologist_repo     = Sonologistrepo;
     //OT
     MedicineRequest_repo = MedicineRequestrepo;
     OtTerminology_repo   = OtTerminologyrepo;
     OtProcedure_repo     = OtProcedurerepo;
     OtEquipment_repo     = OtEquipmentrepo;
 }
 public GetBestConsultantQueryHandler(IConsultantRepository repository)
 {
     _repository = repository;
 }
 public GetAllConsultantsQueryHandler(IConsultantRepository repository)
 {
     _repository = repository;
 }
 public AccountController()
 {
     _consultantRepository = ObjectFactory.GetInstance<IConsultantRepository>();
 }
Example #8
0
 public ConsultantController(IConsultantRepository consultantRepository, ILogger <ConsultantController> logger)
 {
     _consultantRepository = consultantRepository;
     this.logger           = logger;
 }
Example #9
0
 public UpdateConsultantByIdCommandHandler(IConsultantRepository repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
Example #10
0
 public GetConsultants(IConsultantRepository consultantRepository)
 {
     repository = consultantRepository ?? throw new ArgumentNullException(nameof(consultantRepository));
 }
 public RegisterConsultantCommandHandler(IConsultantRepository repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
 public GetConsultantByIdQueryHandler(IConsultantRepository repository)
 {
     _repository = repository;
 }
 public EmployeeRegisteredHandler(IConsultantRepository consultantRepository)
 {
     _consultantRepository = consultantRepository;
     DomainEvents.Register <ConsultantAddedEvent>(ConsultantAdded);
     DomainEvents.Register <ConsultantServerValidatedEvent>(ConsultantServerValidated);
 }
Example #14
0
 public AddressesController(IConsultantRepository repository, IMapper mapper)
 {
     this.repository = repository;
     this.mapper     = mapper;
 }
 public ConsultantRepositoryTest(DatabaseTest databaseTest)
 {
     _database   = databaseTest;
     _repository = _database.ConsultantRepository;
 }
Example #16
0
 public ConsultantService(IConsultantRepository consultantRepository, IUnitOfWork unitOfWork)
 {
     _consultantRepository = consultantRepository;
     _unitOfWork           = unitOfWork;
 }
Example #17
0
        public UpdateConsultantByIdCommandValidator(IConsultantRepository repository)
        {
            _repository = repository;
            const string idRegex = "^[a-f\\d]{24}$";

            RuleFor(consultant => consultant.Id)
            .Cascade(CascadeMode.Stop)
            .NotEmpty().WithMessage(ValidationErrors.EmptyId)
            .Length(24).WithMessage(ValidationErrors.InvalidIdLength)
            .Matches(idRegex).WithMessage(ValidationErrors.InvalidIdStructure)
            .MustAsync(async(id, cancellation) =>
            {
                var consultant = await _repository.GetByIdAsync(id);
                return(consultant != null);
            }).WithMessage(ValidationErrors.InexistentId);

            When(consultant => !string.IsNullOrEmpty(consultant.Username), () =>
            {
                RuleFor(consultant => consultant.Username)
                .Length(2, 25).WithMessage(ValidationErrors.ShortUsername);
            });

            When(consultant => !string.IsNullOrEmpty(consultant.Email), () =>
            {
                RuleFor(consultant => consultant.Email)
                .Cascade(CascadeMode.Stop)
                .EmailAddress().WithMessage(ValidationErrors.InvalidEmail)
                .MustAsync(async(email, cancellation) =>
                {
                    var exists = await _repository.CheckUniqueEmail(email);
                    return(!exists);
                }).WithMessage(ValidationErrors.NotUniqueEmail);
            });

            When(consultant => !string.IsNullOrEmpty(consultant.Password), () =>
            {
                RuleFor(consultant => consultant.Password)
                .Cascade(CascadeMode.Stop)
                .MinimumLength(4).WithMessage(ValidationErrors.ShortPassword)
                .Must(p => p.Any(char.IsDigit)).WithMessage(ValidationErrors.NoDigitPassword);
            });

            When(consultant => !string.IsNullOrEmpty(consultant.Location), () =>
            {
                RuleFor(consultant => consultant.Location)
                .Cascade(CascadeMode.Stop)
                .MinimumLength(2).WithMessage(ValidationErrors.ShortLocation);
            });

            When(consultant => !string.IsNullOrEmpty(consultant.Skill), () =>
            {
                RuleFor(consultant => consultant.Skill)
                .Cascade(CascadeMode.Stop)
                .IsEnumName(typeof(ConsultantSkills), caseSensitive: false).WithMessage(ValidationErrors.InvalidSkill);
            });

            When(consultant => !string.IsNullOrEmpty(consultant.Availability), () =>
            {
                RuleFor(consultant => consultant.Availability)
                .Cascade(CascadeMode.Stop)
                .IsEnumName(typeof(ConsultantAvailability), caseSensitive: false).WithMessage(ValidationErrors.InvalidAvailability);
            });

            When(consultant => consultant.NumberOfTickets != 0, () =>
            {
                RuleFor(consultant => consultant.NumberOfTickets)
                .GreaterThan(1).WithMessage(ValidationErrors.InvalidNumberOfTickets);
            });
        }
 public ConsultantController(IDependencyFactory dependencyFactory)
 {
     _consultantRepository = dependencyFactory.GetInstance<IConsultantRepository>();
     _activeDirectoryService = dependencyFactory.GetInstance<IActiveDirectoryService>(); // new ActiveDirectoryService("HQ", "DC=hq,DC=peninsula-uk,DC=local", @"hq\veritas", "is74rb80pk52");
     _userForAuditingRepository = dependencyFactory.GetInstance<BusinessSafe.Domain.RepositoryContracts.IUserForAuditingRepository>();
 }
 public ConsultantManagement(IConsultantRepository consultantRepository, IUnitOfWork unitOfWork)
 {
     this.consultantRepository = consultantRepository;
     this.unitOfWork           = unitOfWork;
 }
 public DeleteConsultantByIdCommandHandler(IConsultantRepository repository)
 {
     _repository = repository;
 }
Example #21
0
 public CompetencesController(IConsultantRepository repository, IMapper mapper)
 {
     this.repository = repository;
     this.mapper     = mapper;
 }
Example #22
0
 public ConsultantService(IConsultantRepository consultantRepository)
 {
     _consultantRepository = consultantRepository;
 }