Example #1
0
        public bool IsAcceptable(CreditRequest request)
        {
            LocalDate birth = request.PassportInfo.BirthDate.ToLocalDate();
            LocalDate now = DateTime.Now.ToLocalDate();
            long age = Period.Between(birth, now).Years;

            return (age>=MinAge && age<=MaxAge);
        }
Example #2
0
        public bool IsAcceptable(CreditRequest request)
        {
            if (Conditions != null && Conditions.Any())
            {
                return Conditions.All(x => x.IsAcceptable(request));
            }

            return false;
        }
Example #3
0
        public Approval ApproveRequest(CreditRequest request)
        {
            Approval approval = new Approval();

            approval.Approver = this;
            approval.Request = request;
            approval.ApproveTime = DateTime.Now;

            return approval;
        }
Example #4
0
 public ActionResult New(CreditRequest model)
 {
     LinkedList<CreditLine> acceptableCreditLines = new LinkedList<CreditLine>();
     foreach (CreditLine line in RepoFactory.GetCreditLineRepo().getAll()) {
         if (line.IsAcceptable(model)) {
             acceptableCreditLines.AddLast(line);
         }
     }
     IRequestRepository repository = RepoFactory.GetRequestsRepo();
     repository.AddCreditRequest(model);
     if (acceptableCreditLines.Count > 0) {
         Session["creditRequest"] = model;
         return View("Request.SelectCreditLine", acceptableCreditLines);
     }
     return View(model);
 }
Example #5
0
 public ActionResult New()
 {
     CreditRequest model = new CreditRequest();
     return View(model);
 }
Example #6
0
 public bool IssueCredit(CreditRequest approvedRequest)
 {
     return _account.WithdrawMoney(approvedRequest.Amount);
 }
Example #7
0
 public IEnumerable<CreditLine> GetAvailableCreditLines(CreditRequest request)
 {
     return CreditLines.Where(x => x.IsAcceptable(request));
 }
 public bool Update(CreditRequest request)
 {
     return false;
 }
 public void AddCreditRequest(CreditRequest request)
 {
     request.Id = random.Next();
     requests.AddLast(request);
 }