private IQueryable <Deposit> FilterDepositsByDepositProperties(InterestPayment interestPayment, DepositFor depositFor, InterestType interestType, IncreasingAmount increasingAmount, OverdraftOpportunity overdraftOpportunity, CreditOpportunity creditOpportunity, IQueryable <Deposit> deposits)
        {
            if (interestPayment != InterestPayment.NoMatter)
            {
                deposits = deposits.Where(d => d.InterestPayment == interestPayment);
            }
            if (depositFor != DepositFor.NoMatter)
            {
                deposits = deposits.Where(d => d.DepositFor == depositFor);
            }
            if (interestType != InterestType.NoMatter)
            {
                deposits = deposits.Where(d => d.InterestType == interestType);
            }
            if (increasingAmount != IncreasingAmount.NoMatter)
            {
                deposits = deposits.Where(d => d.IncreasingAmount == increasingAmount);
            }
            if (overdraftOpportunity != OverdraftOpportunity.NoMatter)
            {
                deposits = deposits.Where(d => d.OverdraftOpportunity == overdraftOpportunity);
            }
            if (creditOpportunity != CreditOpportunity.NoMatter)
            {
                deposits = deposits.Where(d => d.CreditOpportunity == creditOpportunity);
            }

            return(deposits);
        }
Esempio n. 2
0
        public string ToHtml(CourseType courseType)
        {
            const string cellTemplate = "<div class=\"cell\">{0}</div>\r\n";
            var          cellsContent = string.Format(cellTemplate, Period);

            cellsContent += string.Format(cellTemplate, PeriodDate.ToString("MM/yyyy"));
            if (courseType != CourseType.None)
            {
                cellsContent += string.Format(cellTemplate, InterestMonthPercentage.ToString("N4") + "%");
                cellsContent += string.Format(cellTemplate, InterestYearPercentage.ToString("N2") + "%");
            }

            cellsContent += string.Format(cellTemplate, InterestPayment.ToString("N0"));
            cellsContent += string.Format(cellTemplate, FundPayment.ToString("N0"));
            if (PriceIndexCourses.Contains(courseType))
            {
                cellsContent += string.Format(cellTemplate, FundPaymentWithPriceIndex.ToString("N0"));
            }

            cellsContent += string.Format(cellTemplate, TotalFund.ToString("N0"));
            if (PriceIndexCourses.Contains(courseType))
            {
                cellsContent += string.Format(cellTemplate, TotalFundWithPriceIndex.ToString("N0"));
            }

            var paymentTemplate = cellTemplate.Replace("class=\"cell\"", "class=\"cell payment_green\"");

            cellsContent += string.Format(paymentTemplate, "₪" + TotalPayment.ToString("N0"));
            var result = $"<div class=\"row\">\r\n{cellsContent.Trim()}\r\n</div>\r\n";

            return(result);
        }
        public void Add(string depositName, decimal minimumAmount, decimal maximumAmount, DepositType depositType,
                        string contractualInterest, Currency currency, InterestPayment interestPayment, DepositFor depositFor,
                        InterestType interestType, IncreasingAmount increasingAmount, OverdraftOpportunity overdraftOpportunity,
                        CreditOpportunity creditOpportunity, InterestCapitalize interestCapitalize, string maximumMonthPeriod,
                        string minimumMonthPeriod, string validDepositDeadlines, ValidForCustomer validForCustomer,
                        MonthlyAccrual monthlyAccrual, string additionalTerms, string bonuses, int bankId,
                        decimal interestForOneMonth, decimal interestForThreeMonths, decimal interestForSixMonths,
                        decimal interestForNineMonths, decimal interestForTwelveMonths, decimal interestForEighteenMonths,
                        decimal interestForTwentyFourMonths, decimal interestForThirtySixMonths, decimal interestForFortyEightMonths,
                        decimal interestForSixtyMonths)
        {
            var bank = this.banksService.GetById <Bank>(bankId);

            var deposit = new Deposit
            {
                Name                        = depositName,
                MinimumAmount               = minimumAmount,
                MaximumAmount               = maximumAmount,
                DepositType                 = depositType,
                ContractualInterest         = contractualInterest,
                Currency                    = currency,
                InterestPayment             = interestPayment,
                InterestType                = interestType,
                IncreasingAmount            = increasingAmount,
                DepositFor                  = depositFor,
                OverdraftOpportunity        = overdraftOpportunity,
                CreditOpportunity           = creditOpportunity,
                InterestCapitalize          = interestCapitalize,
                MaximumMonthPeriod          = maximumMonthPeriod,
                MinimumMonthPeriod          = minimumMonthPeriod,
                ValidDepositDeadlines       = validDepositDeadlines,
                ValidForCustomer            = validForCustomer,
                MonthlyAccrual              = monthlyAccrual,
                AdditionalTerms             = additionalTerms,
                Bonuses                     = bonuses,
                Bank                        = bank,
                InterestForOneMonth         = interestForOneMonth,
                InterestForThreeMonths      = interestForThreeMonths,
                InterestForSixMonths        = interestForSixMonths,
                InterestForNineMonths       = interestForNineMonths,
                InterestForTwelveMonths     = interestForTwelveMonths,
                InterestForEighteenMonths   = interestForEighteenMonths,
                InterestForTwentyFourMonths = interestForTwentyFourMonths,
                InterestForThirtySixMonths  = interestForThirtySixMonths,
                InterestForFortyEightMonths = interestForFortyEightMonths,
                InterestForSixtyMonths      = interestForSixtyMonths
            };

            this.dbContext.Deposits.Add(deposit);
            this.dbContext.SaveChanges();
        }
        public IQueryable <TModel> Compared <TModel>(decimal amount, Currency currency, DepositTerm depositTerm,
                                                     InterestPayment interestPayment, DepositFor depositFor, InterestType interestType,
                                                     IncreasingAmount increasingAmount, OverdraftOpportunity overdraftOpportunity,
                                                     CreditOpportunity creditOpportunity)
        {
            var deposits = this.dbContext.Deposits.Where(d => d.Currency == currency);

            this.SetAmountForDeposits(amount, deposits);
            this.SetInterestValueByDepositTerm(depositTerm, deposits);

            deposits = deposits.Where(d => d.MinimumAmount <= amount && d.MaximumAmount >= amount);

            deposits = this.FilterDepositsByDepositProperties(interestPayment, depositFor, interestType, increasingAmount, overdraftOpportunity, creditOpportunity, deposits);

            var compared = deposits.AsQueryable().ProjectTo <TModel>();

            return(compared);
        }
        public void Edit(int depositId, string depositName, decimal minimumAmount, decimal maximumAmount,
                         DepositType depositType, string contractualInterest, Currency currency, InterestPayment interestPayment,
                         DepositFor depositFor, InterestType interestType, IncreasingAmount increasingAmount,
                         OverdraftOpportunity overdraftOpportunity, CreditOpportunity creditOpportunity,
                         InterestCapitalize interestCapitalize, string maximumMonthPeriod, string minimumMonthPeriod,
                         string validDepositDeadlines, ValidForCustomer validForCustomer, MonthlyAccrual monthlyAccrual,
                         string additionalTerms, string bonuses, int bankId,
                         decimal interestForOneMonth, decimal interestForThreeMonths, decimal interestForSixMonths,
                         decimal interestForNineMonths, decimal interestForTwelveMonths, decimal interestForEighteenMonths,
                         decimal interestForTwentyFourMonths, decimal interestForThirtySixMonths, decimal interestForFortyEightMonths,
                         decimal interestForSixtyMonths)
        {
            var deposit = this.dbContext.Deposits.FirstOrDefault(d => d.Id == depositId);

            deposit.Name                        = depositName;
            deposit.MinimumAmount               = minimumAmount;
            deposit.MaximumAmount               = maximumAmount;
            deposit.DepositType                 = depositType;
            deposit.ContractualInterest         = contractualInterest;
            deposit.Currency                    = currency;
            deposit.InterestPayment             = interestPayment;
            deposit.DepositFor                  = depositFor;
            deposit.InterestType                = interestType;
            deposit.IncreasingAmount            = increasingAmount;
            deposit.OverdraftOpportunity        = overdraftOpportunity;
            deposit.CreditOpportunity           = creditOpportunity;
            deposit.InterestCapitalize          = interestCapitalize;
            deposit.MaximumMonthPeriod          = maximumMonthPeriod;
            deposit.MinimumMonthPeriod          = minimumMonthPeriod;
            deposit.ValidDepositDeadlines       = validDepositDeadlines;
            deposit.ValidForCustomer            = validForCustomer;
            deposit.MonthlyAccrual              = monthlyAccrual;
            deposit.AdditionalTerms             = additionalTerms;
            deposit.Bonuses                     = bonuses;
            deposit.BankId                      = bankId;
            deposit.InterestForOneMonth         = interestForOneMonth;
            deposit.InterestForThreeMonths      = interestForThreeMonths;
            deposit.InterestForSixMonths        = interestForSixMonths;
            deposit.InterestForNineMonths       = interestForNineMonths;
            deposit.InterestForTwelveMonths     = interestForTwelveMonths;
            deposit.InterestForTwentyFourMonths = interestForTwentyFourMonths;
            deposit.InterestForThirtySixMonths  = interestForThirtySixMonths;
            deposit.InterestForFortyEightMonths = interestForFortyEightMonths;
            deposit.InterestForSixtyMonths      = interestForSixtyMonths;

            this.dbContext.Update(deposit);
            this.dbContext.SaveChanges();
        }