Ejemplo n.º 1
0
        private bool NotifyDifferentUser(Activation activation)
        {
            Guid userId = _identityResolver.GetUserId();

            if (activation.TenantId != userId)
            {
                AddNotification("Usuário inválido", "O usuário não tem autorização para acessar os dados.");
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public void Register(RegisterCompanyCommand command)
        {
            command.Validate();

            if (AddNotifications(command))
            {
                return;
            }

            Company company = _factory.CreateCompany(command.Name, command.Description, command.Email, command.Cnpj,
                                                     command.InscricaoEstadual, command.OwnerName, command.OwnerBirthday, command.OwnerCpf, _identityResolver.GetUserId());

            if (NotifyCnpjExists(company.Cnpj, company.Id))
            {
                return;
            }

            _repository.Register(company);

            if (Commit())
            {
                Publish(new RegisteredCompanyIntegrationEvent(company.Id, company.Email.Email, company.TenantId));
            }
        }
Ejemplo n.º 3
0
        public void Register(Company company)
        {
            company.SetTenantId(_identityResolver.GetUserId());

            _dbContext.Add(company);
        }