Ejemplo n.º 1
0
		public void UpdateRolloverTest() {
			const int oldID = 5116;
			const int customerID = 385;
			DateTime now = DateTime.UtcNow;
			PaymentRolloverRepository rep = ObjectFactory.GetInstance<PaymentRolloverRepository>();
			var rollovers = rep.GetByLoanId(oldID);
			var paymentRollovers = rollovers as IList<PaymentRollover> ?? rollovers.ToList();
			//paymentRollovers.ForEach(rr => this.m_oLog.Debug(rr));
			var r = paymentRollovers.FirstOrDefault(rr => rr.ExpiryDate > now);
			m_oLog.Debug(r);
			if (r == null) {
				return;
			}

			var s = new GetLoanIDByOldID(oldID);
			s.Execute();
			GetLoanState state = new GetLoanState(customerID, s.LoanID, now, 1, false);
			state.Execute();

			NL_LoanRollovers nlr = state.Result.Loan.Rollovers.FirstOrDefault(nr => nr.CreationTime.Date == r.Created.Date && nr.ExpirationTime.Date == r.ExpiryDate);

			if (nlr == null)
				return;

			nlr.ExpirationTime = nlr.ExpirationTime.AddDays(4);

			m_oLog.Debug(nlr);

			SaveRollover saver = new SaveRollover(nlr, state.Result.Loan.LoanID);
			saver.Execute();
			m_oLog.Debug(saver.Error);
		}
Ejemplo n.º 2
0
        //public LoanScheduleReportResult(LoanDetails loanDetails, bool isExcell, Customer customer)
        public LoanScheduleReportResult(PaymentRolloverRepository rolloverRepository, Loan loan, bool isExcell, bool wError, Customer customer)
        {
            var loansDetailsBuilder = new LoansDetailsBuilder();

            _loanDetails = loansDetailsBuilder.Build(loan, rolloverRepository.GetByLoanId(loan.Id));
            _isExcell    = isExcell;
            _withErrors  = wError;
            _customer    = customer;
            _loan        = loan;
        }
Ejemplo n.º 3
0
        public JsonResult Details(int id)
        {
            var customer = _context.Customer;

            var loan = customer.Loans.SingleOrDefault(l => l.Id == id);

            if (loan == null)
            {
                return(Json(new { error = "loan does not exists" }, JsonRequestBehavior.AllowGet));
            }

            var loansDetailsBuilder = new LoansDetailsBuilder();
            var details             = loansDetailsBuilder.Build(loan, _rolloverRepository.GetByLoanId(loan.Id));

            return(Json(details, JsonRequestBehavior.AllowGet));
        }