Пример #1
0
 public List <CreditCardExtreDomainEntity> GetListByCreditCard(CreditCardDomainEntity creditCard)
 {
     return(GetOrderedDescListBy(
                cce =>
                cce.CreditCardId == creditCard.CreditCardId,
                cce =>
                cce.Year,
                cce =>
                cce.Month));
 }
        public List <CreditCardPaymentDomainEntity> GetListByCreditCard(CreditCardDomainEntity creditCard, DateTime fromDate)
        {
            var transactions = coreContext.Query <IAccountTransactionRepository>()
                               .GetLastOutgoingDateRangeListByTransactionOwner(creditCard, fromDate, DateTime.Now);

            return(GetOrderedDescListBy(
                       ccp =>
                       transactions.Select(t => t.TransactionId).Contains(ccp.AccountTransactionId),
                       ccp =>
                       ccp.InstalmentDate));
        }
Пример #3
0
        public CreditCardExtreDomainEntity With(
            CreditCardDomainEntity creditCard, int month, string monthName, int year,
            decimal totalPayment, bool isDischarged, bool isMinDischarged)
        {
            CreditCard      = creditCard ?? throw new CommonException.RequiredParameterMissingException(nameof(creditCard));
            Month           = month;
            MonthName       = monthName;
            Year            = year;
            TotalPayment    = totalPayment;
            MinPayment      = totalPayment * MIN_PAYMENT_RATIO;
            IsDischarged    = isDischarged;
            IsMinDischarged = isMinDischarged;

            return(this);
        }
Пример #4
0
        public CreditCardDomainEntity With(
            decimal limit, int extreDay, int type, string validMonth, string validYear, string securityCode,
            bool isInternetUsageOpen, ICreditCardOwner creditCardOwner)
        {
            if (limit <= 0)
            {
                throw new AccountManagementException.CreditCardLimitCouldNotBeZeroOrNegative(string.Format("{0} = {1}", nameof(limit), limit));
            }

            if (extreDay <= 0)
            {
                throw new AccountManagementException.CreditCardExtreDayCouldNotZeroOrNegative(string.Format("{0} = {1}", nameof(extreDay), extreDay));
            }

            CreditCardDomainEntity cc = null;

            try
            {
                cc = creditCardRepository.GetByCreditCardOwner(creditCardOwner);
            }
            catch (Exception ex)
            {
            }

            if (cc != null)
            {
                throw new AccountManagementException.CreditCardOwnerHasAlreadyCreditCard(string.Format("Owner:{0} - Id: {1}", creditCardOwner.CreditCardOwnerType, creditCardOwner.OwnerId));
            }

            CreditCardNumber    = GenerateCrediCardNumber();
            Limit               = limit;
            ExtreDay            = extreDay;
            Debt                = 0;
            Type                = type;
            ValidMonth          = string.IsNullOrWhiteSpace(validMonth) == false ? validMonth : throw new CommonException.RequiredParameterMissingException(nameof(validMonth));
            ValidYear           = string.IsNullOrWhiteSpace(validYear) == false ? validYear : throw new CommonException.RequiredParameterMissingException(nameof(validYear));
            SecurityCode        = string.IsNullOrWhiteSpace(securityCode) == false ? securityCode : throw new CommonException.RequiredParameterMissingException(nameof(securityCode));
            IsInternetUsageOpen = isInternetUsageOpen;
            CreditCardOwner     = creditCardOwner ?? throw new CommonException.RequiredParameterMissingException(nameof(creditCardOwner));;
            return(this);
        }
Пример #5
0
 public CreditCardExtreDomainEntity GetByCreditCardAndDate(CreditCardDomainEntity creditCard, int month, int year)
 {
     return(GetFirstBy(
                cce =>
                cce.CreditCardId == creditCard.CreditCardId && cce.Month == month && cce.Year == year));
 }
Пример #6
0
 public CreditCardExtreDomainEntity GetLastByCreditCard(CreditCardDomainEntity creditCard)
 {
     return(GetLastBy(
                cce =>
                cce.CreditCardId == creditCard.CreditCardId));
 }