示例#1
0
        public List <AccountDomainEntity> GetListByOwner(IAccountOwner accountOwner)
        {
            int ownerType = accountOwner.OwnerType.ToInt();

            return(GetListBy(
                       a =>
                       a.OwnerId == accountOwner.OwnerId && a.OwnerType == ownerType));
        }
示例#2
0
        public bool HasOwnerAccountByType(IAccountOwner accountOwner, AccountTypeDomainEntity accountType)
        {
            int ownerType = accountOwner.OwnerType.ToInt();

            return(Exists(
                       a =>
                       a.OwnerId == accountOwner.OwnerId && a.OwnerType == ownerType &&
                       a.AccountTypeId == accountType.AccountTypeId));
        }
示例#3
0
        public AccountDomainEntity With(
            AccountTypeDomainEntity accountType,
            IAccountOwner accountOwner,
            string accountNumber)
        {
            AccountType   = accountType ?? throw new CommonException.RequiredParameterMissingException(nameof(accountType));
            AccountOwner  = accountOwner ?? throw new CommonException.RequiredParameterMissingException(nameof(accountType));
            AccountNumber = string.IsNullOrWhiteSpace(accountNumber) ?
                            throw new CommonException.RequiredParameterMissingException(nameof(accountNumber)) : accountNumber;

            accountRepository.InsertEntity(this);
            return(this);
        }
示例#4
0
        private IAccountOwner GetAccountOwner(Account account)
        {
            IAccountOwner accountOwner = null;

            if (account.OwnerType == AccountOwnerType.Person.ToInt())
            {
                accountOwner = coreContext.Query <IPersonRepository>().GetById(account.OwnerId) as IAccountOwner;
            }
            else if (account.OwnerType == AccountOwnerType.Company.ToInt())
            {
                accountOwner = coreContext.Query <ICompanyRepository>().GetById(account.OwnerId) as IAccountOwner;
            }
            return(accountOwner);
        }
示例#5
0
 protected override bool NeedUpdateFunc(IAccountOwner updatedSubject)
 {
     return(CounterpartyUoW.Root.Id == updatedSubject.Counterparty.Id);
 }
示例#6
0
 public void CreateAccount(IAccountOwner owner, AccountType type)
 {
     owner.AddAccount(AccountFactory.CreateAccount(type));
 }
        internal AccountDomainEntity CreateAccount(AccountTypeDomainEntity accountType, IAccountOwner accountOwner, string accountNumber)
        {
            var account = coreContext.New <AccountDomainEntity>()
                          .With(accountType, accountOwner, accountNumber);

            account.Insert();
            return(account);
        }