Example #1
0
 public void ChangeLoanProductStatus(LoanProduct loanProduct, LoanProductStatus newStatus)
 {
     Contract.Requires<ArgumentNullException>(loanProduct.IsNotNull());
     this.VerifyLoanProductCreationWorkflow(loanProduct, newStatus);
     loanProduct.Status = newStatus;
     this.gangsterBankUnitOfWork.LoanProductsRepository.CreateOrUpdate(loanProduct);
 }
 public void ChangeLoanProductStatus(LoanProduct loanProduct, LoanProductStatus newStatus)
 {
     Contract.Requires <ArgumentNullException>(loanProduct.IsNotNull());
     this.VerifyLoanProductCreationWorkflow(loanProduct, newStatus);
     loanProduct.Status = newStatus;
     this.gangsterBankUnitOfWork.LoanProductsRepository.CreateOrUpdate(loanProduct);
 }
        public void ChangeLoanProductStatus(int loanProductId, LoanProductStatus status)
        {
            Contract.Requires <ArgumentOutOfRangeException>(loanProductId.IsPositive());
            LoanProduct loanProduct = this.gangsterBankUnitOfWork.LoanProductsRepository.GetById(loanProductId);

            this.ChangeLoanProductStatus(loanProduct, status);
        }
        private IEnumerable <LoanProduct> GetLoanProductsByStatus(LoanProductStatus status)
        {
            IEnumerable <LoanProduct> loanProducts =
                this.gangsterBankUnitOfWork.LoanProductsRepository.GetLoanProductsByStatus(status);

            return(loanProducts);
        }
Example #5
0
        public IEnumerable <LoanProduct> GetLoanProductsByStatus(LoanProductStatus status)
        {
            IQueryable <LoanProduct> loanProducts = from loanProduct in this.DbSet
                                                    where loanProduct.Status == status
                                                    select loanProduct;

            return(loanProducts);
        }
Example #6
0
        private ActionResult ChangeCreditStatus(int creditId, LoanProductStatus status)
        {
            var loanProduct = this._creditService.GetLoanProduct(creditId);

            loanProduct.Status = status;
            this._creditService.Save(loanProduct);
            return(this.Json(true, JsonRequestBehavior.AllowGet));
        }
Example #7
0
        public bool IsAllowedToChangeStatus(LoanProductStatus status, params Role[] roles)
        {
            if (!this.prerequisiteStatuses.ContainsKey(status))
            {
                throw new ArgumentOutOfRangeException("status");
            }

            return(roles.Any(role => this.requiredRoles[status].Contains(role)));
        }
Example #8
0
        public bool CanHaveStatus(LoanProduct loanProduct, LoanProductStatus status)
        {
            Contract.Requires <ArgumentNullException>(loanProduct != null);
            if (!this.prerequisiteStatuses.ContainsKey(status))
            {
                throw new ArgumentOutOfRangeException("status");
            }

            return(this.prerequisiteStatuses[status].Contains(loanProduct.Status));
        }
        private void VerifyLoanProductCreationWorkflow(LoanProduct loanProduct, LoanProductStatus newStatus)
        {
            if (!this.LoanProductHasPrerequisiteStatus(loanProduct, newStatus))
            {
                throw new WorkflowException("Loan product doesn't have prerequisite status");
            }

            if (!this.UserIsAllowedToChangeStatus(newStatus))
            {
                throw new WorkflowException("User is not allowed to change the status");
            }
        }
        public bool CanHaveStatus(LoanProduct loanProduct, LoanProductStatus status)
        {
            Contract.Requires<ArgumentNullException>(loanProduct != null);
            if (!this.prerequisiteStatuses.ContainsKey(status))
            {
                throw new ArgumentOutOfRangeException("status");
            }

            return this.prerequisiteStatuses[status].Contains(loanProduct.Status);
        }
        public bool IsAllowedToChangeStatus(LoanProductStatus status, params Role[] roles)
        {
            if (!this.prerequisiteStatuses.ContainsKey(status))
            {
                throw new ArgumentOutOfRangeException("status");
            }

            return roles.Any(role => this.requiredRoles[status].Contains(role));
        }
Example #12
0
 private bool UserIsAllowedToChangeStatus(LoanProductStatus newStatus)
 {
     return this.loanProductCreationWorkflowConfiguration.IsAllowedToChangeStatus(
         newStatus,
         this.userContext.Roles.ToArray());
 }
Example #13
0
        private void VerifyLoanProductCreationWorkflow(LoanProduct loanProduct, LoanProductStatus newStatus)
        {
            if (!this.LoanProductHasPrerequisiteStatus(loanProduct, newStatus))
            {
                throw new WorkflowException("Loan product doesn't have prerequisite status");
            }

            if (!this.UserIsAllowedToChangeStatus(newStatus))
            {
                throw new WorkflowException("User is not allowed to change the status");
            }
        }
 private bool UserIsAllowedToChangeStatus(LoanProductStatus newStatus)
 {
     return(this.loanProductCreationWorkflowConfiguration.IsAllowedToChangeStatus(
                newStatus,
                this.userContext.Roles.ToArray()));
 }
 private bool LoanProductHasPrerequisiteStatus(LoanProduct loanProduct, LoanProductStatus newStatus)
 {
     return(this.loanProductCreationWorkflowConfiguration.CanHaveStatus(loanProduct, newStatus));
 }
Example #16
0
 private bool LoanProductHasPrerequisiteStatus(LoanProduct loanProduct, LoanProductStatus newStatus)
 {
     return this.loanProductCreationWorkflowConfiguration.CanHaveStatus(loanProduct, newStatus);
 }
 private ActionResult ChangeCreditStatus(int creditId, LoanProductStatus status)
 {
     var loanProduct = this._creditService.GetLoanProduct(creditId);
     loanProduct.Status = status;
     this._creditService.Save(loanProduct);
     return this.Json(true, JsonRequestBehavior.AllowGet);
 }
Example #18
0
 public void ChangeLoanProductStatus(int loanProductId, LoanProductStatus status)
 {
     Contract.Requires<ArgumentOutOfRangeException>(loanProductId.IsPositive());
     LoanProduct loanProduct = this.gangsterBankUnitOfWork.LoanProductsRepository.GetById(loanProductId);
     this.ChangeLoanProductStatus(loanProduct, status);
 }
 private ActionResult GetCredits(DataSourceRequest request, LoanProductStatus? filterStatus = null)
 {
     Contract.Requires<ArgumentNullException>(request.IsNotNull());
     var loanProducts = this._creditService.GetAvailableLoanProductsForShow();
     if (filterStatus != null)
     {
         loanProducts = loanProducts.Where(x => x.Status == filterStatus);
     }
     var result = loanProducts.Select(x => new AvailableCreditViewModel
                                               {
                                                   MinAmount = x.MinAmount,
                                                   MaxAmount = x.MaxAmount,
                                                   MaxPeriodInMonth = x.MaxPeriodInMonth,
                                                   MinPeriodInMonth = x.MinPeriodInMonth,
                                                   Name = x.Name,
                                                   Percentage = x.Percentage,
                                                   Id = x.Id,
                                                   Description = x.Description
                                               });
     return this.Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
 }
Example #20
0
 private IEnumerable<LoanProduct> GetLoanProductsByStatus(LoanProductStatus status)
 {
     IEnumerable<LoanProduct> loanProducts =
         this.gangsterBankUnitOfWork.LoanProductsRepository.GetLoanProductsByStatus(status);
     return loanProducts;
 }