Exemplo n.º 1
0
        private void InitializeCredidCardCredentials(ORMLibrary.Credit credit)
        {
            Random random = new Random();

            credit.CreditCardNumber = credit.MainAccount.AccountNumber + random.Next(0, 1000).ToString("000");
            credit.CreditCardPin    = random.Next(0, 10000).ToString("0000");
        }
Exemplo n.º 2
0
 private void TakeMoneyForCredit(ORMLibrary.Credit dbCredit)
 {
     TransactionService.CommitTransaction(
         AccountService.GetDevelopmentFundAccount(),
         dbCredit.MainAccount,
         dbCredit.Amount
         );
 }
Exemplo n.º 3
0
 private void WithDrawCreditFromCashDesk(ORMLibrary.Credit dbCredit)
 {
     TransactionService.CommitTransaction(
         dbCredit.MainAccount,
         AccountService.GetCashDeskAccount(),
         dbCredit.Amount
         );
     TransactionService.WithDrawCashDeskTransaction(dbCredit.Amount);
 }
Exemplo n.º 4
0
        private void CommitPercents(ORMLibrary.Credit credit)
        {
            decimal percentAmount;

            if (credit.PlanOfCredit.Anuity)
            {
                percentAmount = credit.Amount / (credit.EndDate - credit.StartDate) +
                                credit.Amount * (decimal)credit.PlanOfCredit.Percent / 100 /
                                CommonService.YearLength;
            }
            else
            {
                percentAmount = credit.Amount * (decimal)credit.PlanOfCredit.Percent / 100 /
                                CommonService.YearLength;
            }
            TransactionService.CommitTransaction(credit.PercentAccount, AccountService.GetDevelopmentFundAccount(),
                                                 percentAmount);
        }
Exemplo n.º 5
0
        private void CommitPercents(ORMLibrary.Credit credit)
        {
            decimal percentAmount;
            int     countMonthes    = credit.PlanOfCredit.MonthPeriod;
            double  percentPerMonth = credit.PlanOfCredit.Percent / SystemInformationService.CountMonthesInYear;

            if (credit.PlanOfCredit.Anuity)
            {
                double anuityCoefficient =
                    (percentPerMonth * Math.Pow(1 + percentPerMonth, countMonthes)) /
                    (Math.Pow(1 + percentPerMonth, countMonthes) - 1);

                double paymentPerMonth = anuityCoefficient * (double)credit.Amount;

                percentAmount = (decimal)paymentPerMonth / SystemInformationService.CountDaysInMonth;
            }
            else
            {
                double creditRest = (double)credit.Amount;
                double dayReturningCreditBodyPart = (double)credit.Amount / countMonthes / SystemInformationService.CountDaysInMonth;
                double percentPerDay = percentPerMonth / SystemInformationService.CountDaysInMonth;

                for (int i = 0; i < (SystemInformationService.CurrentBankDay - credit.StartDate).TotalDays; i++)
                {
                    double thisDayPayment = dayReturningCreditBodyPart + creditRest * percentPerDay;
                    creditRest -= dayReturningCreditBodyPart;
                }

                percentAmount = (decimal)(dayReturningCreditBodyPart + creditRest * percentPerDay);
            }

            TransactionService.CommitTransaction(
                credit.PercentAccount,
                AccountService.GetDevelopmentFundAccount(),
                percentAmount
                );
        }