public SecretsModel( IClientDbContext clientDbContext, SecretsVaultManager secretsVaultManager) : base(clientDbContext) { _secretsVaultManager = secretsVaultManager; }
public ExportClientDbModel( IClientDbContext clientDbContext, IExportClientDbContext exportClientDbContext) { _clientDb = clientDbContext as IClientDbContextModify; _exportClientDb = exportClientDbContext; }
public UserValidator(IClientDbContext context) { _context = context; RuleFor(x => x.FullName).Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty() .MaximumLength(500); RuleFor(x => x.Email) .NotEmpty().DependentRules(() => { RuleFor(x => x.Email) .MustAsync(async(email, cancellationToken) => { return(!(await _context.Users.AnyAsync(x => x.Email == email))); }) .WithMessage(x => $"Email:{x.Email} exists") .Must((email) => { return((email.Trim().Equals("")) ? true : CommonHelper.EmailFormat(email)); }).WithMessage("Email format incorrect") .MaximumLength(250); }); RuleFor(x => x.Password).Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty() .MaximumLength(125); }
public AddressValidator(IClientDbContext context) { _context = context; RuleFor(x => x.City).MustAsync(async(city, cancellationToken) => { return(await _context.Cities.AnyAsync(x => x.CityId == city)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"City:{x.City} doesn´t exist") .When(x => x.City != null && x.City != 0); RuleFor(x => x.AddressType) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("AddressType is required") .MustAsync(async(addressType, cancellationToken) => { return(await _context.AddressesTypes.AnyAsync(x => x.AddressTypeId == addressType)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"AddressType:{x.AddressType} doesn´t exist"); RuleFor(x => x.StatusCodeAddress).MustAsync(async(statusCodeAddress, cancellationToken) => { return(await _context.StatusCodesAddresses.AnyAsync(x => x.StatusCodeAddressId == statusCodeAddress)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"StatusCodeAddress:{x.StatusCodeAddress} doesn´t exist") .When(x => x.StatusCodeAddress != null && x.StatusCodeAddress != 0); RuleFor(x => x.PostCode) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("PostCode is required") .MaximumLength(20).WithMessage("PostCode must have to 20 letters"); RuleFor(x => x.StreetName).MaximumLength(100).WithMessage("StreetName must have to 100 letters") .When(x => !string.IsNullOrWhiteSpace(x.StreetName)); RuleFor(x => x.BuildingNumber).MaximumLength(20).WithMessage("BuildingNumber must have to 20 letters") .When(x => !string.IsNullOrWhiteSpace(x.BuildingNumber)); RuleFor(x => x.AddressLine).MaximumLength(100).WithMessage("AddressLine must have to 100 letters") .When(x => !string.IsNullOrWhiteSpace(x.AddressLine)); RuleFor(x => x.PostOfficeBoxCode).MaximumLength(10).WithMessage("PostOfficeBoxCode must have to 10 letters") .When(x => !string.IsNullOrWhiteSpace(x.PostOfficeBoxCode)); RuleFor(x => x.PoboxPostalCode).MaximumLength(10).WithMessage("PoboxPostalCode must have to 10 letters") .When(x => !string.IsNullOrWhiteSpace(x.PoboxPostalCode)); RuleFor(x => x.Coname).MaximumLength(100).WithMessage("Coname must have to 100 letters") .When(x => !string.IsNullOrWhiteSpace(x.Coname)); RuleFor(x => x.ValidFrom).NotEmpty().WithMessage("ValidFrom is required"); RuleFor(x => x).Must((Address) => { int result = DateTime.Compare(Convert.ToDateTime(Address.ValidFrom), Convert.ToDateTime(Address.ValidTo)); return(result < 0 || result == 0); }).WithMessage("ValidTo must be >= ValidFrom") .When(x => CommonHelper.DateFormat(x.ValidFrom.ToString()) && CommonHelper.DateFormat(x.ValidTo.ToString())); }
public ClientStore( IClientDbContext context, ILogger <ClientStore> logger ) { _repository = context; _logger = logger; }
public ActionResult Index() { var getUserDetails = _userRepository.GetUserDetails(); dbContext = new ClientDbContext(DefaultConnectionString); var getEnrollment = dbContext.Enrollments.Where(x => x.UserId == "admin").SingleOrDefault(); return(View(getEnrollment)); }
public CorsPolicyService(IClientDbContext context, ILogger <CorsPolicyService> logger) { if (context == null) { throw new ArgumentNullException(nameof(context)); } _clients = context; _logger = logger; }
public GetIdDocumentTypeByCountryQueryValidator(IClientDbContext context) { _context = context; RuleFor(x => x.CountryId) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("CountryId is required") .MustAsync(async(countryId, cancellation) => { return(await _context.Countries.AnyAsync(x => x.CountryIsoCode == countryId, cancellation)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"CountryId: {x.CountryId} does not exists."); }
public GetAddressesValidator(IClientDbContext context) { _context = context; RuleFor(x => x.PersonId) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("PersonId is required") .MustAsync(async(personId, cancellationToken) => { return(await _context.Persons.AnyAsync(x => x.PersonId == personId)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"The PersonId was not found"); }
public PersonValidator(IClientDbContext context) { _context = context; RuleFor(x => x.PersonNumber).MustAsync(async(personNumber, cancellationToken) => { return(!await _context.Persons.AnyAsync(x => x.PersonNumber == personNumber, cancellationToken)); }) .WithErrorCode(ErrorCode.NotFound.ToString()) .When(x => x.PersonNumber != 0).WithMessage(x => $"Person Number:{x.PersonNumber} exists."); RuleFor(x => x.Category) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("Category is required"); RuleFor(x => x.Category).MustAsync(async(category, cancellationToken) => { return(await _context.Categories.AnyAsync(x => x.CategoryId == category, cancellationToken)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"CategoryId:{x.Category} doesn't exist"); RuleFor(x => x.Status) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("Status is required") .MustAsync(async(status, cancellationToken) => { return(await _context.ClientsStatus.AnyAsync(x => x.ClientStatusId == status, cancellationToken)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"ClientStatus:{x.Status} doesn't exist"); RuleFor(x => x.Address).NotEmpty().WithMessage("Address must not be empty"); RuleFor(x => x.IdentificationDocument).NotEmpty().WithMessage("IdentificationDocument must not be empty"); RuleFor(x => x.Email).NotEmpty().WithMessage("Email must not be empty"); RuleFor(x => x.Phone).NotEmpty().WithMessage("Phone must not be empty"); RuleFor(x => x.NaturalPerson).NotEmpty().WithMessage("Natural person must not be empty "); RuleFor(x => x.Attachment).NotEmpty().WithMessage("Attachment must not be empty"); RuleFor(x => x.NaturalPerson).SetValidator(new NaturalPersonValidator(context)); RuleForEach(x => x.Address).NotNull().SetValidator(new AddressValidator(context)); RuleForEach(x => x.IdentificationDocument).SetValidator(new IdentificationDocumentValidator(_context)); RuleForEach(x => x.Email).NotNull().SetValidator(new EmailValidator()); RuleForEach(x => x.Phone).NotNull().SetValidator(new PhoneValidator(context)); RuleForEach(x => x.Income).SetValidator(new IncomeValidator(context)); RuleForEach(x => x.Rol).SetValidator(new RoleValidator(context)); RuleForEach(x => x.Attachment).SetValidator(new AttachmentValidator(context)); }
public IndexModel( UserManager <ApplicationUser> userManager, IUserDbContext userDbContext = null, IRoleDbContext roleDbContext = null, IResourceDbContext resourceDbContxt = null, IClientDbContext clientDbContext = null) { _userManager = userManager; this.HasUserDb = userDbContext != null; this.HasRoleDb = roleDbContext != null; this.HasResourceDb = resourceDbContxt != null; this.HasClientDb = clientDbContext != null; }
public PhoneValidator(IClientDbContext context) { _context = context; RuleFor(x => x.PhoneType) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("PhoneType is required") .MustAsync(async(phoneType, cancellationToken) => { return(await _context.PhonesTypes.AnyAsync(x => x.PhoneTypeId == phoneType)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"PhoneType:{x.PhoneType} doesn´t exist"); RuleFor(x => x.CountryIsoCode) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("CountryIsoCode is required") .MaximumLength(3).WithMessage("CountryIsoCode must have to 3 letters") .MustAsync(async(countryIsoCode, cancellationToken) => { return(await _context.Countries.AnyAsync(x => x.CountryIsoCode == countryIsoCode)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"CountryIsoCode:{x.CountryIsoCode} doesn´t exist"); RuleFor(x => x.AreaCode) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("AreaCode is required") .MaximumLength(10).WithMessage("AreaCode must have to 10 letters"); RuleFor(x => x.PhoneNumber) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("PhoneNumber is required") .MaximumLength(30).WithMessage("PhoneNumber must have to 30 numbers") .Must((phoneNumber) => { return(CommonHelper.IsLong(phoneNumber)); }).WithMessage("phoneNumber must be a number"); RuleFor(x => x.Extension).MaximumLength(10).WithMessage("Extension must have to 10 letters") .When(x => !string.IsNullOrWhiteSpace(x.Extension)); RuleFor(x => x).Must((Phone) => { int result = DateTime.Compare(Convert.ToDateTime(Phone.ValidFrom), Convert.ToDateTime(Phone.ValidTo)); return(result < 0 || result == 0); }).WithMessage("ValidTo must be >= ValidFrom") .When(x => CommonHelper.DateFormat(x.ValidFrom.ToString()) && CommonHelper.DateFormat(x.ValidTo.ToString())); }
public RoleValidator(IClientDbContext context) { _context = context; RuleFor(x => x.RoleType) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("RoleType is required") .MustAsync(async(roleType, cancellationToken) => { return(await _context.RolesTypes.AnyAsync(x => x.RoleTypeId == roleType)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"RoleType {x.RoleType} doesn´t exist"); RuleFor(x => x).NotEmpty().Must((plan) => { int result = DateTime.Compare(Convert.ToDateTime(plan.ValidFrom), Convert.ToDateTime(plan.ValidTo)); return(result < 0 || result == 0); }).WithMessage(x => "ValidFrom must be <= ValidTo") .When(x => CommonHelper.DateFormat(x.ValidFrom.ToString()) && CommonHelper.DateFormat(x.ValidTo.ToString())); }
public AttachmentValidator(IClientDbContext context) { _context = context; RuleFor(x => x.AttachmentType) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("AttachmentType is required") .MustAsync(async(attachmentType, cancellationToken) => { return(await _context.AttachmentsTypes.AnyAsync(x => x.AttachmentTypeId == attachmentType)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"AttachmentType:{x.AttachmentType} doesn´t exist"); RuleFor(x => x.FileName) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("FileName is required") .MaximumLength(50).WithMessage("FileName must have to 50 letters"); RuleFor(x => x.Notes) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("Notes is required") .MaximumLength(255).WithMessage("Notes must have to 255 letters"); RuleFor(x => x.OwnerKey).MaximumLength(100).WithMessage("OwnerKey must have to 100 letters") .When(x => !string.IsNullOrWhiteSpace(x.OwnerKey)); RuleFor(x => x.EncodedKey).MaximumLength(100).WithMessage("EncodedKey must have to 100 letters") .When(x => !string.IsNullOrWhiteSpace(x.EncodedKey)); RuleFor(x => x.FileSize).NotEmpty().WithMessage("FileSize is required"); RuleFor(x => x.Name) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("Name is required") .MaximumLength(50).WithMessage("Name must have to 50 letters"); RuleFor(x => x.Location) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("Location is required") .MaximumLength(100).WithMessage("Name must have to 100 letters"); }
public IdentificationDocumentValidator(IClientDbContext context) { _context = context; RuleFor(x => x.DocumentNumber) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("DocumentNumber is required") .MaximumLength(50).WithMessage("DocumentNumber must have to 50 letters") .MustAsync(async(documentNumber, cancellation) => { return(await _context.IdentificationsDocuments.AllAsync(x => x.DocumentNumber != documentNumber)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"DocumentNumber:{x.DocumentNumber} is exists."); RuleFor(x => x.IssuingAuthority).MaximumLength(50).WithMessage("IssuingAuthority must have to 50 letters") .When(x => !string.IsNullOrWhiteSpace(x.IssuingAuthority)); RuleFor(x => x.IdentificationDocumentType) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("DocumentType is required") .MustAsync(async(type, cancellationToken) => { return(await _context.DocumentsTypes.AnyAsync(x => x.DocumentTypeId == type)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"DocumentType:{x.IdentificationDocumentType} doen´t exist"); RuleFor(x => x).Must((identificationDocument) => { int result = DateTime.Compare(Convert.ToDateTime(identificationDocument.IssuingDate), Convert.ToDateTime(identificationDocument.ExpiryDate)); return((result > 0) ? false : true); }).WithMessage("ExpireDate must be >= IssuingDate") .When(x => CommonHelper.DateFormat(x.IssuingDate.ToString()) && CommonHelper.DateFormat(x.ExpiryDate.ToString())); RuleFor(x => x).Must((identificationDocument) => { int result = DateTime.Compare(Convert.ToDateTime(identificationDocument.ValidFrom), Convert.ToDateTime(identificationDocument.ValidTo)); return(result < 0 || result == 0); }).WithMessage("ValidTo must be >= ValidFrom") .When(x => CommonHelper.DateFormat(x.ValidFrom.ToString()) && CommonHelper.DateFormat(x.ValidTo.ToString())); }
public IncomeValidator(IClientDbContext context) { _context = context; RuleFor(x => x.Company) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("Company is required") .MaximumLength(100).WithMessage("Company must have to 100 letters"); RuleFor(x => x.Currency) .Cascade(CascadeMode.StopOnFirstFailure) .NotEmpty().WithMessage("Currency is required") .MaximumLength(3).WithMessage("Currency must have to 3 letters") .MustAsync(async(currency, cancellationToken) => { return(await _context.Currencies.AnyAsync(x => x.IsoCode == currency)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"Currency:{x.Currency} doesn´t exist"); RuleFor(x => x.Periodicity) .MustAsync(async(periodicity, cancellationToken) => { return(await _context.Periodicity.AnyAsync(x => x.PeriodicityId == periodicity)); }).WithErrorCode(ErrorCode.NotFound.ToString()) .WithMessage(x => $"periodicity:{x.Periodicity} doen´t exist") .When(x => x.Periodicity != null && x.Periodicity != 0); RuleFor(x => x.ValidFrom).NotEmpty().WithMessage("ValidFrom is required"); RuleFor(x => x).Must((Income) => { int result = DateTime.Compare(Convert.ToDateTime(Income.ValidFrom), Convert.ToDateTime(Income.ValidTo)); return(result < 0 || result == 0); }).WithMessage("ValidTo must be >= ValidFrom") .When(x => CommonHelper.DateFormat(x.ValidFrom.ToString()) && CommonHelper.DateFormat(x.ValidTo.ToString())); }
/// <summary> /// Initializes a new instance of the <see cref="ClientStore"/> class. /// </summary> /// <param name="context">The context.</param> /// <param name="logger">The logger.</param> /// <exception cref="ArgumentNullException">context</exception> public ClientStore(IClientDbContext <TClient> context, ILogger <ClientStore <TClient> > logger) { _context = context ?? throw new ArgumentNullException(nameof(context)); _logger = logger; }
public CommandHandlerBase(IClientDbContext context) { _context = context; }
public GetIdDocumentTypeByCountryQueryHandler(IClientDbContext context) { _context = context; }
public EditClientPageModel(IClientDbContext clientDbContext) { _clientDb = clientDbContext as IClientDbContextModify; }
public ClientRepository(IClientDbContext dbContext) { _dbContext = dbContext; }
public SeedSampleDataCommandHandler(IClientDbContext context) { _context = context; }
public PropertiesModel(IClientDbContext clientDbContext) : base(clientDbContext) { }
public ScopesModel(IClientDbContext clientDbContext, IResourceDbContext resourceDbContext) : base(clientDbContext) { _resourceDb = resourceDbContext as IResourceDbContextModify; }
public IndexModel(IClientDbContext clientDbContext) : base(clientDbContext) { }
public SampleDataSeeder(IClientDbContext context) { _context = context; }
public InserPersontHandler(IClientDbContext context) { _context = context; }
protected QueryHandlerBase(IClientDbContext dbContext) { _context = dbContext; }
public GetByIdHandler(IPersonDataRepository personDataRepository, IClientDbContext context) { _personDataRepository = personDataRepository; _context = context; }
public CollectionsModel(IClientDbContext clientDbContext) : base(clientDbContext) { }
public Handler(IClientDbContext context) { _context = context; }
public ClientsModel(IClientDbContext clientDbContext) { _clientDb = clientDbContext as IClientDbContextModify; }