public CriarProcessoCommandValidator(
            IProcessoRepository processoRepository,
            ISituacaoProcessoRepository situacaoProcessoRepository,
            IResponsavelRepository responsavelRepository,
            IProcessoDomainService processoDomainService,
            INotificationContext notificationContext) : base(notificationContext)
        {
            this.processoRepository         = processoRepository;
            this.situacaoProcessoRepository = situacaoProcessoRepository;
            this.responsavelRepository      = responsavelRepository;
            this.processoDomainService      = processoDomainService;
            this.RuleFor(p => p.NumeroProcesso)
            .NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Número Processo: {ErrorMessages.ErroVazio}")
            .MaximumLength(20).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Número Processo: {string.Format(ErrorMessages.ErroTamanhoMaximo, 20)}");

            this.RuleFor(p => p.DataDistribuicao)
            .LessThanOrEqualTo(DateTimeOffset.Now).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Data Distribuição: {string.Format(ErrorMessages.ErroDataDeveSerAnterior, DateTimeOffset.Now.Date.ToString())}");

            this.RuleFor(p => p.PastaFisicaCliente)
            .MaximumLength(50).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Pasta Física Cliente: {string.Format(ErrorMessages.ErroTamanhoMaximo, 50)}");

            this.RuleFor(p => p.Descricao)
            .MaximumLength(1000).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Descrição: {string.Format(ErrorMessages.ErroTamanhoMaximo, 1000)}");

            this.RuleFor(p => p.SituacaoProcessoId)
            .NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Situação Processo: {ErrorMessages.ErroVazio}");

            this.RuleFor(p => p.ResponsaveisIds)
            .NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Responsável: {ErrorMessages.ErroVazio}")

            .Must(r => r.Count >= 1 && r.Count <= 3).When(r => r.ResponsaveisIds != null, ApplyConditionTo.CurrentValidator).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Quantidade Responsável: {string.Format(ErrorMessages.ErroQuantidadeResponsavel, 1, 3)}")

            .Must(r => r.Distinct().Count() == r.Count).When(r => r.ResponsaveisIds != null, ApplyConditionTo.CurrentValidator).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Responsável: {ErrorMessages.ResponsavelRepetido}");
        }
Esempio n. 2
0
        public RemoverResponsavelCommandValidator(IResponsavelRepository responsavelRepository,
                                                  INotificationContext notificationContext) : base(notificationContext)
        {
            this.RuleFor(p => p.Id)
            .NotEmpty().NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Id: {ErrorMessages.ErroVazio}");

            this.responsavelRepository = responsavelRepository;
        }
Esempio n. 3
0
 public ChangeProcessoCommandHandler(IProcessoRepository processoRepository,
                                     IResponsavelRepository responsavelRepository,
                                     ISituacaoRepository situacaoRepository)
 {
     _processoRepository    = processoRepository;
     _responsavelRepository = responsavelRepository;
     _situacaoRepository    = situacaoRepository;
 }
 public UsuarioApplicationService(IUsuarioRepository usuarioRepository,
                                  IProfessorRepository professorRepository,
                                  IResponsavelRepository responsavelRepository)
 {
     _usuarioRepository     = usuarioRepository;
     _professorRepository   = professorRepository;
     _responsavelRepository = responsavelRepository;
 }
Esempio n. 5
0
 public ResponsavelController(IMediatorHandler mediator, IResponsavelRepository responsavelRepository,
                              IMapper mapper, IAspNetUser user)
 {
     _responsavelRepository = responsavelRepository;
     _mediator = mediator;
     _mapper   = mapper;
     _user     = user;
 }
Esempio n. 6
0
 public ResponsavelService(INotificador notificator,
                           IResponsavelRepository responsavelRepository,
                           IAlunoRepository alunoRepository,
                           IMapper mapper) : base(notificator)
 {
     _responsavelRepository = responsavelRepository;
     _alunoRepository       = alunoRepository;
     _mapper = mapper;
 }
 public ObterResponsavelQueryHandler(
     IResponsavelRepository responsavelRepository,
     INotificationContext notificationContext,
     IObterResponsavelQueryValidator validator,
     ILogger <ObterResponsavelQueryHandler> logger) : base(notificationContext, validator)
 {
     this.responsavelRepository = responsavelRepository;
     this.logger = logger;
 }
 public ProcessoRemovidoEventHandler(
     IResponsavelRepository responsavelRepository,
     IEmailService emailService,
     ILogger <ProcessoRemovidoEventHandler> logger)
 {
     this.responsavelRepository = responsavelRepository;
     this.emailService          = emailService;
     this.logger = logger;
 }
 public ResponsavelApplicationService(IResponsavelRepository responsavelRepository,
                                      IAlunoRepository alunoRepository,
                                      IUsuarioApplicationService usuarioApplicationService,
                                      ISalaRepository salaRepository)
 {
     _responsavelRepository     = responsavelRepository;
     _alunoRepository           = alunoRepository;
     _usuarioApplicationService = usuarioApplicationService;
     _salaRepository            = salaRepository;
 }
 public RemoverResponsavelCommandHandler(
     IResponsavelRepository responsavelRepository,
     INotificationContext notificationContext,
     IRemoverResponsavelCommandValidator validator,
     IUnitOfWork unitOfWork,
     ILogger <RemoverResponsavelCommandHandler> logger) : base(notificationContext, validator)
 {
     this.responsavelRepository = responsavelRepository;
     this.unitOfWork            = unitOfWork;
     this.logger = logger;
 }
Esempio n. 11
0
        public ResponsavelAppService(
            IResponsavelRepository ResponsavelRepository,
            IConfiguracaoServidorEmailRepository configuracaoRepository)
        {
            if (ResponsavelRepository == null)
            {
                throw new ArgumentNullException("ResponsavelRepository");
            }

            _responsavelRepository = ResponsavelRepository;
        }
 public CriarProcessoCommandHandler(
     IProcessoRepository processoRepository,
     IResponsavelRepository responsavelRepository,
     ICriarProcessoCommandValidator commandValidator,
     INotificationContext notificationContext,
     IUnitOfWork unitOfWork,
     ILogger <CriarProcessoCommandHandler> logger) : base(notificationContext, commandValidator)
 {
     this.processoRepository    = processoRepository;
     this.responsavelRepository = responsavelRepository;
     this.unitOfWork            = unitOfWork;
     this.logger = logger;
 }
        public AtualizarResponsavelCommandValidator(IResponsavelRepository responsavelRepository,
                                                    INotificationContext notificationContext) : base(notificationContext)
        {
            this.responsavelRepository = responsavelRepository;

            this.RuleFor(p => p.Id)
            .NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Id: {ErrorMessages.ErroVazio}");

            this.RuleFor(p => p.Nome)
            .NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Nome: {ErrorMessages.ErroVazio}")
            .MaximumLength(150).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Nome: {string.Format(ErrorMessages.ErroTamanhoMaximo, 150)}");

            this.RuleFor(p => p.Cpf)
            .NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Cpf: {ErrorMessages.ErroVazio}")
            .Custom((cpf, context) =>
            {
                if (!string.IsNullOrWhiteSpace(cpf) && !Util.ValidarCpf(cpf))
                {
                    context.AddFailure(
                        new ValidationFailure("Cpf", string.Format(ErrorMessages.CpfInvalido, cpf))
                    {
                        ErrorCode = NotificationKeys.InvalidArgument
                    });
                }
            });

            this.RuleFor(p => p.Email)
            .NotEmpty().WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Email: {ErrorMessages.ErroVazio}")
            .MaximumLength(400).WithErrorCode(NotificationKeys.InvalidArgument).WithMessage($"Email: {string.Format(ErrorMessages.ErroTamanhoMaximo, 400)}")
            .Custom((email, context) =>
            {
                if (!string.IsNullOrWhiteSpace(email) && !Util.ValidarEmail(email))
                {
                    context.AddFailure(
                        new ValidationFailure("Email", string.Format(ErrorMessages.EmailInvalido, email))
                    {
                        ErrorCode = NotificationKeys.InvalidArgument
                    });
                }
            });
        }
 public override void SetUp()
 {
     base.SetUp();
     _repository = new ResponsavelRepository(Context);
 }
Esempio n. 15
0
 public ResponsavelController(IResponsavelRepository repositorio) : base(repositorio)
 {
 }
Esempio n. 16
0
 public CreateResponsavelCommandHandler(IResponsavelRepository repository)
 {
     _repository = repository;
 }
Esempio n. 17
0
 public FaturaRepository(ApplicationContext applicationContext, IResponsavelRepository responsavelRepository)
     : base(applicationContext)
 {
     this._responsavelRepository = responsavelRepository;
 }
Esempio n. 18
0
 public RemoveResponsavelProcessoResponsibilityValidationDomainEventHandler(IResponsavelRepository repository)
 {
     _repository = repository;
 }
Esempio n. 19
0
 public ResponsavelCFPUniqueValidationDomainEventHandler(IResponsavelRepository repository)
 {
     _repository = repository;
 }
 public ResponsavelQueries(IResponsavelRepository responsavelRepository)
 {
     _responsavelRepository = responsavelRepository;
 }
Esempio n. 21
0
 public ProcessoChangedEmailSendDomainEventHandler(IMailSender mailSender, IResponsavelRepository responsavelRepository)
     : base(mailSender, responsavelRepository)
 {
 }
 public ResponsavelApplication(IResponsavelRepository repository, IMapper mapper) : base(repository, mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
 public ChangeResponsavelCPFValidationDomainEventHandler(IResponsavelRepository repository) : base(repository)
 {
 }
Esempio n. 24
0
 public RemoveResponsavelCommandHandler(IResponsavelRepository repository)
 {
     _repository = repository;
 }
 public ProcessoRemovedSendEmailDomainEventHandler(IMailSender mailSender,
                                                   IResponsavelRepository responsavelRepository)
 {
     _mailSender            = mailSender;
     _responsavelRepository = responsavelRepository;
 }
 public CreateResponsavelValidateCPFDomainEventHandler(IResponsavelRepository repository) : base(repository)
 {
 }