Example #1
0
 public int AddPackage(LoanProduct package)
 {
     if (package.UseLoanCycle)
     {
         SetDefaultValues(package);
     }
     using (var connection = _productManager.GetConnection())
         using (var transaction = connection.BeginTransaction())
         {
             try
             {
                 package.Id = _productManager.Add(package, transaction);
                 _productManager.InsertEntryFees(package.EntryFees, package.Id, transaction);
                 LoanProductInterceptorSave(new Dictionary <string, object>
                 {
                     { "LoanProduct", package },
                     { "SqlTransaction", transaction }
                 });
                 transaction.Commit();
             }
             catch (Exception)
             {
                 transaction.Rollback();
                 throw;
             }
         }
     return(package.Id);
 }
Example #2
0
        public int AddPackage(LoanProduct package)
        {
            if (package.UseLoanCycle)
            {
                SetDefaultValues(package);
            }
            int packageId = _productManager.Add(package);

            _productManager.InsertEntryFees(package.EntryFees, packageId);

            return(packageId);
        }
        public void UpdateProduct_Values_DontUpdateContracts()
        {
            LoanProductManager loanProductManager = (LoanProductManager)container["LoanProductManager"];

            LoanProduct loanProduct = loanProductManager.Select(_productWithValues.Id);

            loanProduct.GracePeriod = 8;
            loanProduct.AnticipatedTotalRepaymentPenaltiesBase = OAnticipatedRepaymentPenaltiesBases.RemainingInterest;
            loanProduct.AnticipatedTotalRepaymentPenalties     = 33;
            loanProduct.ChargeInterestWithinGracePeriod        = true;
            loanProduct.NbOfInstallments = 5;
            loanProduct.NonRepaymentPenalties.InitialAmount    = 111;
            loanProduct.NonRepaymentPenalties.OLB              = 222;
            loanProduct.NonRepaymentPenalties.OverDueInterest  = 333;
            loanProduct.NonRepaymentPenalties.OverDuePrincipal = 444;
            loanProduct.EntryFees = new List <EntryFee>();
            EntryFee fee = new EntryFee();

            fee.Value   = 2;
            fee.IsAdded = true;
            loanProduct.EntryFees.Add(fee);
            loanProductManager.UpdatePackage(loanProduct, false);
            loanProductManager.InsertEntryFees(loanProduct.EntryFees, loanProduct.Id);
            LoanProduct updatedLoanProduct = loanProductManager.Select(loanProduct.Id);

            updatedLoanProduct.EntryFees = loanProductManager.SelectEntryFeesWithoutCycles(updatedLoanProduct.Id, false);

            AssertLoanProduct(loanProduct, updatedLoanProduct, false);
        }