Exemplo n.º 1
0
 public List <AccountDomainEntity> GetListByPerson(PersonDomainEntity person)
 {
     return(GetListBy(
                a =>
                a.OwnerType == AccountOwnerType.Person.ToInt() && a.OwnerId == person.PersonId
                ));
 }
Exemplo n.º 2
0
 public CompanyDomainEntity With(
     string companyName,
     PersonDomainEntity responsablePerson,
     string address,
     string phoneNumber,
     string taxNumber)
 {
     CompanyName       = companyName ?? throw new CommonException.RequiredParameterMissingException(nameof(companyName));
     ResponsablePerson = responsablePerson ?? throw new CommonException.RequiredParameterMissingException(nameof(responsablePerson));
     Address           = address ?? throw new CommonException.RequiredParameterMissingException(nameof(address));
     PhoneNumber       = phoneNumber ?? throw new CommonException.RequiredParameterMissingException(nameof(phoneNumber));
     TaxNumber         = taxNumber ?? throw new CommonException.RequiredParameterMissingException(nameof(taxNumber));
     return(this);
 }
Exemplo n.º 3
0
        public TokenDomainEntity With(PersonDomainEntity person, ApplicationDomainEntity application)
        {
            Person      = person ?? throw new CommonException.RequiredParameterMissingException(nameof(person));
            Application = application ?? throw new CommonException.RequiredParameterMissingException(nameof(application));

            Guid guid = Guid.NewGuid();

            Value = coreContext.Cryptographer.GenerateMD5Hash(guid.ToString());

            CreateDate = DateTime.Now;
            ValidUntil = CreateDate.AddHours(1);

            return(this);
        }
Exemplo n.º 4
0
        public void Insert(bool forceToInsertDb = true)
        {
            PersonDomainEntity person = null;

            try
            {
                person = personRepository.GetByIdentityNumber(IdentityNumber);
            }
            catch (System.Exception)
            {
            }

            if (person != null)
            {
                throw new AccountManagementException.PersonAlreadyExistWithTheGivenIdentityNumberException(string.Format("{0} = {1}", nameof(IdentityNumber), IdentityNumber));
            }

            personRepository.InsertEntity(this, forceToInsertDb);
        }
Exemplo n.º 5
0
 public CompanyDomainEntity GetByResponsablePerson(PersonDomainEntity person)
 {
     return(GetFirstBy(p => p.ResponsablePersonId == person.PersonId));
 }