public void DeleteProduct()
        {
            LoanProductManager loanProductManager = (LoanProductManager)container["LoanProductManager"];

            loanProductManager.DeleteProduct(1);

            LoanProduct deletedProduct = loanProductManager.Select(1);

            Assert.IsTrue(deletedProduct.Delete);
        }
Example #2
0
        public bool DeletePackage(LoanProduct package)
        {
            if (package == null)
            {
                throw new OpenCbsPackageDeleteException(OpenCbsPackageDeleteExceptionEnum.PackageIsNull);
            }

            if (package.Id == 0)
            {
                throw new OpenCbsPackageDeleteException(OpenCbsPackageDeleteExceptionEnum.PackageIsNull);
            }

            if (package.Delete)
            {
                throw new OpenCbsPackageDeleteException(OpenCbsPackageDeleteExceptionEnum.AlreadyDeleted);
            }

            _productManager.DeleteProduct(package.Id);

            return(true);
        }
Example #3
0
        public bool DeletePackage(LoanProduct package)
        {
            if (package == null)
            {
                throw new OpenCbsPackageDeleteException(OpenCbsPackageDeleteExceptionEnum.PackageIsNull);
            }

            if (package.Id == 0)
            {
                throw new OpenCbsPackageDeleteException(OpenCbsPackageDeleteExceptionEnum.PackageIsNull);
            }

            if (package.Delete)
            {
                throw new OpenCbsPackageDeleteException(OpenCbsPackageDeleteExceptionEnum.AlreadyDeleted);
            }

            using (var connection = _productManager.GetConnection())
                using (var transaction = connection.BeginTransaction())
                {
                    try
                    {
                        _productManager.DeleteProduct(package.Id, transaction);
                        LoanProductInterceptorUpdate(new Dictionary <string, object>
                        {
                            { "LoanProduct", package },
                            { "SqlTransaction", transaction }
                        });
                        transaction.Commit();
                    }
                    catch (Exception)
                    {
                        transaction.Rollback();
                        throw;
                    }
                }

            return(true);
        }