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); }
public int AddPackage(LoanProduct package) { if (package.UseLoanCycle) { SetDefaultValues(package); } int packageId = _productManager.Add(package); _productManager.InsertEntryFees(package.EntryFees, packageId); return(packageId); }
public void AddProduct_RangeValues() { LoanProductManager loanProductManager = (LoanProductManager)container["LoanProductManager"]; _productWithRangeValues.Name = "Test"; _productWithRangeValues.Currency = new Currency { Id = 1 }; int productId = loanProductManager.Add(_productWithRangeValues); Assert.AreNotEqual(0, productId); }
public void AddProduct_Values_ExoticInstallmentsTable_AmountCyclesStock() { Assert.Ignore(); LoanProductManager loanProductManager = (LoanProductManager)container["LoanProductManager"]; _productWithValues.ExoticProduct = _exoticInstallmentsTable; // _productWithValues.AmountCycles = _amountCycleStock; _productWithValues.Amount = null; _productWithValues.Name = "Test"; _productWithValues.Currency = new Currency { Id = 1 }; int productId = loanProductManager.Add(_productWithValues); Assert.AreNotEqual(0, productId); }
public void SelectProduct_Values_ExoticInstallmentsTable_AmountCyclesStock() { Assert.Ignore(); LoanProductManager loanProductManager = (LoanProductManager)container["LoanProductManager"]; _productWithValues.ExoticProduct = _exoticInstallmentsTable; // _productWithValues.AmountCycles = _amountCycleStock; _productWithValues.Amount = null; _productWithValues.Name = "Test"; _productWithValues.Currency = new Currency { Id = 1 }; _productWithValues.Id = loanProductManager.Add(_productWithValues); LoanProduct selectedProduct = loanProductManager.Select(_productWithValues.Id); selectedProduct.EntryFees = new List <EntryFee>(); EntryFee entryFee = new EntryFee(); entryFee.Value = 3; selectedProduct.EntryFees.Add(entryFee); AssertLoanProduct(_productWithValues, selectedProduct, true); }