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); }
public IEnumerable <LoanProduct> GetLoanProductsByStatus(LoanProductStatus status) { IQueryable <LoanProduct> loanProducts = from loanProduct in this.DbSet where loanProduct.Status == status select loanProduct; return(loanProducts); }
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)); }
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))); }
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)); }
private bool UserIsAllowedToChangeStatus(LoanProductStatus newStatus) { return this.loanProductCreationWorkflowConfiguration.IsAllowedToChangeStatus( newStatus, this.userContext.Roles.ToArray()); }
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)); }
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); }
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); }
private IEnumerable<LoanProduct> GetLoanProductsByStatus(LoanProductStatus status) { IEnumerable<LoanProduct> loanProducts = this.gangsterBankUnitOfWork.LoanProductsRepository.GetLoanProductsByStatus(status); return loanProducts; }