Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public bool IsAcceptable(CreditRequest request)
        {
            if (Conditions != null && Conditions.Any())
            {
                return Conditions.All(x => x.IsAcceptable(request));
            }

            return false;
        }
Exemplo n.º 3
0
        public Approval ApproveRequest(CreditRequest request)
        {
            Approval approval = new Approval();

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

            return approval;
        }
Exemplo n.º 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);
 }
Exemplo n.º 5
0
 public ActionResult New()
 {
     CreditRequest model = new CreditRequest();
     return View(model);
 }
Exemplo n.º 6
0
 public bool IssueCredit(CreditRequest approvedRequest)
 {
     return _account.WithdrawMoney(approvedRequest.Amount);
 }
Exemplo n.º 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);
 }