private void RefreshList()
        {
            entitiesListBox.Items.Clear();

            switch (_option)
            {
            case 1:
                _authorsRepository.GetAll().ForEach(author => entitiesListBox.Items.Add(author));
                break;

            case 2:
                _publishersRepository.GetAll().ForEach(publisher => entitiesListBox.Items.Add(publisher));
                break;

            case 3:
                _studentsRepository.GetAll().ForEach(student => entitiesListBox.Items.Add(student));
                break;

            case 4:
                _booksRepository.GetAll().ForEach(book => entitiesListBox.Items.Add(book));
                break;

            case 5:
                _loansRepository.GetAll().ForEach(loan => entitiesListBox.Items.Add(loan));
                break;

            default:
                CommonErrorMessage();
                break;
            }

            SearchAutoComplete();
        }
        //public void CurrentAccountCotRate()
        //{
        //    var month = financialDate.Month;
        //    var currentAccounts = _customerAccount.GetByAccountType(AccountType.Current);
        //    var currentConfig = _current.GetFirst();

        //    var COTGl = _glAccount.Get(currentConfig.IncomeGlAccountId);
        //    if (currentAccounts != null)
        //    {
        //        if (financialDate.Day == daysInMonth[month - 1])
        //        {
        //            foreach (var account in currentAccounts)
        //            {
        //                _post.DebitCustomerAccount(account.CotAccured, account.Id, account);
        //                _post.CreditGlAccount(account.CotAccured, COTGl);

        //                account.CotAccured = 0;
        //                _customerAccount.Save(account);
        //            }
        //        }
        //    }
        //}

        public void LoanAccountInterestRate()
        {
            var loanConfig = _loan.GetFirst();
            var loanAcct   = _loanAccount.GetAll();

            if (loanAcct != null)
            {
                var interestIncomeGlAccount = _glAccount.Get(loanConfig.IncomeGlAccountId);


                foreach (var account in loanAcct)
                {
                    var loanAccountId   = _customerAccount.GetByAccountNumber(account.AccountNumber);
                    var customerAccount = _customerAccount.Get(account.CustomerAccountId);

                    if (account.DurationInMonths * 30 != account.DaysCount)
                    {
                        //payment of interest
                        _post.CreditGlAccount(account.InterestDeduction, interestIncomeGlAccount);
                        _post.DebitCustomerAccount(account.InterestDeduction, account.CustomerAccountId, customerAccount);

                        account.InterestRemaining -= account.InterestDeduction;


                        //paying daily loan back
                        _post.DebitCustomerAccount(account.DailyLoanDeduction, account.CustomerAccountId, customerAccount);
                        _post.CreditCustomerAccount(account.DailyLoanDeduction, loanAccountId.Id, loanAccountId);

                        account.LoanBalance -= account.DailyLoanDeduction;

                        _loanAccount.Save(account);
                    }

                    if (account.DurationInMonths * 30 == account.DaysCount)
                    {
                        account.Status    = false;
                        account.DaysCount = 0;
                    }

                    //increases days if loan payment not reached
                    if (account.DurationInMonths * 30 != account.DaysCount)
                    {
                        account.DaysCount++;
                    }

                    _loanAccount.Update(account);
                }
            }
        }
        //GET: CustomerAccount/LoanIndex
        public ActionResult LoanIndex()
        {
            var loanList = _loan.GetAll();

            return(View(loanList));
        }
Beispiel #4
0
        // GET: Loans
        public ActionResult Index()
        {
            List <Loan> loans = _loansRepository.GetAll();

            return(View(loans));
        }