Beispiel #1
0
 public ProductServices(User user)
 {
     _user = user;
     _productManager = new LoanProductManager(user);
     _installmentTypeManager = new InstallmentTypeManager(user);
     _fundingLineManager = new FundingLineManager(user);
     _productManager.ProductLoaded += ProductLoaded;
 }
 public AccountingRuleManager(string pTestDB)
     : base(pTestDB)
 {
     _accountManager = new AccountManager(pTestDB);
     _loanProductManager = new LoanProductManager(pTestDB);
     _savingProductManager = new SavingProductManager(pTestDB);
     _economicActivityManager = new EconomicActivityManager(pTestDB);
     _fundingLineManager = new FundingLineManager(pTestDB);
     _currencyManager = new CurrencyManager(pTestDB);
 }
 public AccountingRuleManager(User pUser)
     : base(pUser)
 {
     _accountManager = new AccountManager(pUser);
     _loanProductManager = new LoanProductManager(pUser);
     _savingProductManager = new SavingProductManager(pUser);
     _economicActivityManager = new EconomicActivityManager(pUser);
     _fundingLineManager = new FundingLineManager(pUser);
     _currencyManager = new CurrencyManager(pUser);
     _paymentMethodManager = new PaymentMethodManager(pUser);
 }
Beispiel #4
0
        public void InitManager()
        {
            TechnicalSettings.CheckSettings();

            LoanProductManager loanProductManager = new LoanProductManager(DataUtil.TESTDB);
            AccountingTransactionManager accountingTransactionManager = new AccountingTransactionManager(DataUtil.TESTDB);
            EventManager eventManager = new EventManager(DataUtil.TESTDB);
            ExchangeRateManager exchangeRateManager = new ExchangeRateManager(DataUtil.TESTDB);
            ProvisioningRuleManager provisioningRuleManager = new ProvisioningRuleManager(DataUtil.TESTDB);
            AccountManager accountManager = new AccountManager(DataUtil.TESTDB);
            InstallmentTypeManager installmentTypeManager = new InstallmentTypeManager(DataUtil.TESTDB);
            UserManager userManager = new UserManager(DataUtil.TESTDB);
            EconomicActivityManager economicActivityManager = new EconomicActivityManager(DataUtil.TESTDB);
            InstallmentManager installmentManager = new InstallmentManager(DataUtil.TESTDB);
            FundingLineManager fundingLineManager = new FundingLineManager(DataUtil.TESTDB);
            ClientManager clientManager = new ClientManager(DataUtil.TESTDB);
            LocationsManager locationsManager = new LocationsManager(DataUtil.TESTDB);
            LoanManager loanManager = new LoanManager(DataUtil.TESTDB);
            ProjectManager projectManager = new ProjectManager(DataUtil.TESTDB);
            MFIManager mfiManager = new MFIManager(DataUtil.TESTDB);
            SavingManager savingManager = new SavingManager(DataUtil.TESTDB);
            SavingProductManager savingProductManager = new SavingProductManager(DataUtil.TESTDB);
            SavingEventManager savingEventManager = new SavingEventManager(DataUtil.TESTDB);
            CurrencyManager currencyManager = new CurrencyManager(DataUtil.TESTDB);
            AccountingRuleManager accountingRuleManager = new AccountingRuleManager(DataUtil.TESTDB);
            FundingLineServices fundingLineServices = new FundingLineServices(DataUtil.TESTDB);

            container = new Hashtable
                            {
                                {"LoanProductManager", loanProductManager},
                                {"AccountingTransactionManager", accountingTransactionManager},
                                {"EventManager", eventManager},
                                {"ExchangeRateManager", exchangeRateManager},
                                {"ProvisioningRuleManager", provisioningRuleManager},
                                {"AccountManager", accountManager},
                                {"InstallmentTypeManager", installmentTypeManager},
                                {"UserManager", userManager},
                                {"FundingLineManager", fundingLineManager},
                                {"LoanManager", loanManager},
                                {"ClientManager", clientManager},
                                {"LocationsManager", locationsManager},
                                {"ProjectManager", projectManager},
                                {"EconomicActivityManager", economicActivityManager},
                                {"InstallmentManager", installmentManager},
                                {"MFIManager", mfiManager},
                                {"SavingManager", savingManager},
                                {"SavingProductManager", savingProductManager},
                                {"SavingEventManager", savingEventManager},
                                {"CurrencyManager", currencyManager},
                                {"FundingLineServices", fundingLineServices},
                                {"AccountingRuleManager", accountingRuleManager}
                            };
        }
        public EventProcessorServices(User pUser,string testDB)
        {
            _user = pUser;

            _eventManagement = new EventManager(testDB);
            _savingEventManagement = new SavingEventManager(testDB);
            _movementSetManagement = new AccountingTransactionManager(testDB);
            _loanManager = new LoanManager(testDB);
            _packageManager = new LoanProductManager(testDB);
            _clientManagement = new ClientManager(testDB);
            _accountingServices = new Accounting.AccountingServices(testDB);

            _InitializeEventProcessor();
        }
Beispiel #6
0
 public LoanManager(User pUser)
     : base(pUser)
 {
     _user = pUser;
     _userManager = new UserManager(pUser);
     _paymentMethodManager = new PaymentMethodManager(pUser);
     _packageManager = new LoanProductManager(pUser);
     _installmentTypeManagement = new InstallmentTypeManager(pUser);
     _installmentManagement = new InstallmentManager(pUser);
     _eventManagement = new EventManager(pUser);
     _fundingLineManager = new FundingLineManager(pUser);
     _projectManager = new ProjectManager(pUser, false);
     _clientManager = new ClientManager(pUser, false, false);
     _collateralProductManager = new CollateralProductManager(pUser);
     _economicActivityManager = new EconomicActivityManager(pUser);
 }
Beispiel #7
0
 public ProductServices(LoanProductManager productManager)
 {
     _productManager = productManager;
     _productManager.ProductLoaded += ProductLoaded;
 }
        public void TestFixtureSetUp()
        {
            ProvisioningTable.GetInstance(new User()).Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 1000, Rate = 0 });
            ApplicationSettings.GetInstance("").DeleteAllParameters();
            ApplicationSettings.GetInstance("").AddParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash);
            ApplicationSettings.GetInstance("").AddParameter(OGeneralSettings.USECENTS, true);

            ApplicationSettings.GetInstance("").AddParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, true);
            ApplicationSettings.GetInstance("").AddParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, false);
            ApplicationSettings.GetInstance("").AddParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, true);

            TechnicalSettings.UseOnlineMode = false;

            projectManager = new ProjectManager(DataUtil.TESTDB);
            creditManagement = new CreditContractManagement(DataUtil.TESTDB);
            installmentManagement = new InstallmentManager(DataUtil.TESTDB);
            clientManagement = new ClientManager(DataUtil.TESTDB);
            connectionManager = ConnectionManager.GetInstance(DataUtil.TESTDB);
            fundingLineManager = new FundingLineManager(DataUtil.TESTDB);
            userManager = new UserManager(DataUtil.TESTDB);
            _packageManager = new LoanProductManager(DataUtil.TESTDB);

            installment1 = new Installment();
            installment1.Number = 1;
            installment1.CapitalRepayment = 200;
            installment1.InterestsRepayment = 100;
            installment1.PaidCapital = 200;
            installment1.PaidInterests = 100;
            //to initialize Installment.FeesUnpaid, ocurrency is an object, must be initialized
            installment1.FeesUnpaid = 0;
            installment1.ExpectedDate = DateTime.Today.AddDays(-1);

            installment2 = new Installment();
            installment2.Number = 2;
            installment2.CapitalRepayment = 200;
            installment2.InterestsRepayment = 100;
            installment2.PaidCapital = 0;
            installment2.PaidInterests = 100;
            //to initialize Installment.FeesUnpaid, ocurrency is an object, must be initialized
            installment2.FeesUnpaid = 0;
            installment2.ExpectedDate = DateTime.Today.AddMonths(1);
        }
Beispiel #9
0
 public LoanManager(string pTestDb)
     : base(pTestDb)
 {
     _user = User.CurrentUser;
     _userManager = new UserManager(pTestDb);
     _packageManager = new LoanProductManager(pTestDb);
     _installmentTypeManagement = new InstallmentTypeManager(pTestDb);
     _installmentManagement = new InstallmentManager(pTestDb);
     _eventManagement = new EventManager(pTestDb);
     _fundingLineManager = new FundingLineManager(pTestDb);
     _collateralProductManager = new CollateralProductManager(pTestDb);
     _paymentMethodManager = new PaymentMethodManager(pTestDb);
     _economicActivityManager = new EconomicActivityManager(pTestDb);
 }
Beispiel #10
0
 public LoanManager(string pTestDb, User pUser)
     : base(pTestDb)
 {
     _user = pUser;
     _userManager = new UserManager(pTestDb, _user);
     _packageManager = new LoanProductManager(pTestDb);
     _installmentTypeManagement = new InstallmentTypeManager(pTestDb);
     _installmentManagement = new InstallmentManager(pTestDb);
     _eventManagement = new EventManager(pTestDb);
     _fundingLineManager = new FundingLineManager(pTestDb);
     _clientManager = new ClientManager(pTestDb);
     _collateralProductManager = new CollateralProductManager(pTestDb);
     _paymentMethodManager = new PaymentMethodManager(pTestDb, pUser);
 }
Beispiel #11
0
 public ProductServices(LoanProductManager productManager)
 {
     _productManager = productManager;
     _productManager.ProductLoaded += ProductLoaded;
     MefContainer.Current.Bind(this);
 }
Beispiel #12
0
        public void TestCreationOfIndividualLoanWithLoanCycle()
        {
            Person person = new Person();
            person.Id = 23456;

            var loanAmountCycle = GetLoanAmountCycles();
            var rateCycles = GetRateCycles();
            var maturityCycles = GetMaturityCycles();
            LoanProductManager productManager = new LoanProductManager(DataUtil.TESTDB);
            ProductServices productServices = new ProductServices(productManager);
            productServices.SaveAllCycleParams(loanAmountCycle, rateCycles, maturityCycles);
            var entryFees = new List<EntryFee>();
            Currency currency = new Currency();
            currency.Id = 1;
            var nrp = new NonRepaymentPenaltiesNullableValues(100, 200, 10, 0.2);
            LoanProduct product = CreatePackage(
                                                "NewPackage", //package name
                                                null, //anticipatedTotalRepaymentPenalties
                                                3, //anticipatedTotalRepaymentPenaltiesMin
                                                6, //anticipatedTotalRepaymentPenaltiesMax
                                                4, //grace period
                                                null, //gracePeriodMin
                                                null, //gracePeriodMax
                                                0.2m, //interestRate
                                                null, //interesrRateMin
                                                null, //interestRateMax
                                                0, //NmbOfInstallments
                                                null, //NmbOfInstallmentsMin
                                                null, //NmbOfInstallmentsMax
                                                entryFees, //List<EntryFee>
                                                nrp, //NonRepaymentPenalties
                                                null, //NonRepaymentPenaltiesMin
                                                null, //NonRepaymentPenaltiesMax
                                                _monthly, //InstallmentType
                                                2000, //amount
                                                null, //amountMin
                                                null, //AmountMax
                                                null, //ExoticInstallmentsTable
                                                2, //cycleId
                                                loanAmountCycle, //List<LoanAmountCycle>
                                                rateCycles, //List<RateCycle>
                                                maturityCycles, //List<MaturityCycle>
                                                "CODE1", //ProductCode
                                                null, //List<ProductClientType>
                                                null, //amountUnderLoc
                                                null, //amountUnderLocMin
                                                null, //amountUnderLocMax
                                                1, //anticipatedPartialRRepaymentPenalties
                                                null, //anticipatedPartialRRepaymentPenaltiesMin
                                                null, //anticipatedPartialRRepaymentPenaltiesMax
                                                null, //compulsoryAmount
                                                null, //compulsoryAmountMin
                                                null, //compulsoryAmountMax
                                                currency
                );

            Loan credit = new Loan();
            credit.Product = product;
            person.LoanCycle = 0;
            productServices.SetCyclesParamsForContract(product,credit,person,true);
            //Cheking loan amount values
            Assert.AreEqual(product.AmountMin, loanAmountCycle[0].Min.Value);
            Assert.AreEqual(product.AmountMax, loanAmountCycle[0].Max.Value);
            //Checking rate values
            Assert.AreEqual(product.InterestRateMin, rateCycles[0].Min.Value);
            Assert.AreEqual(product.InterestRateMax, rateCycles[0].Max.Value);
            //Checking maturity values
            Assert.AreEqual(product.NbOfInstallmentsMin, maturityCycles[0].Min.Value);
            Assert.AreEqual(product.NbOfInstallmentsMax, maturityCycles[0].Max.Value);

            person.LoanCycle = 2;

            productServices.SetCyclesParamsForContract(product, credit, person, true);
            //Cheking loan amount values
            Assert.AreEqual(product.AmountMin, loanAmountCycle[2].Min.Value);
            Assert.AreEqual(product.AmountMax, loanAmountCycle[2].Max.Value);
            //Checking rate values
            Assert.AreEqual(product.InterestRateMin, rateCycles[2].Min.Value);
            Assert.AreEqual(product.InterestRateMax, rateCycles[2].Max.Value);
            //Checking maturity values
            Assert.AreEqual(product.NbOfInstallmentsMin, maturityCycles[2].Min.Value);
            Assert.AreEqual(product.NbOfInstallmentsMax, maturityCycles[2].Max.Value);

            person.LoanCycle = 1;

            productServices.SetCyclesParamsForContract(product, credit, person, true);
            //Cheking loan amount values
            Assert.AreEqual(product.AmountMin, loanAmountCycle[1].Min.Value);
            Assert.AreEqual(product.AmountMax, loanAmountCycle[1].Max.Value);
            //Checking rate values
            Assert.AreEqual(product.InterestRateMin, rateCycles[1].Min.Value);
            Assert.AreEqual(product.InterestRateMax, rateCycles[1].Max.Value);
            //Checking maturity values
            Assert.AreEqual(product.NbOfInstallmentsMin, maturityCycles[1].Min.Value);
            Assert.AreEqual(product.NbOfInstallmentsMax, maturityCycles[1].Max.Value);
        }
Beispiel #13
0
        public void TestCreatingContractForNonSolidaryGroupWithLoanCycles()
        {
            LoanProductManager productManager = new LoanProductManager(DataUtil.TESTDB);
            ProductServices productServices = new ProductServices(productManager);

            ClientManager clientManager = new ClientManager(DataUtil.TESTDB);
            ClientServices clientServices = new ClientServices(clientManager);

            Village village = new Village();
            Person person = clientServices.FindPersonById(2);
            person.LoanCycle = 0;

            VillageMember villageMember = new VillageMember();
            villageMember.Tiers = person;
            village.Members.Add(villageMember);

            person = clientServices.FindPersonById(4);
            person.LoanCycle = 1;

            villageMember = new VillageMember();
            villageMember.Tiers = person;
            village.Members.Add(villageMember);

            person = clientServices.FindPersonById(6);
            person.LoanCycle = 2;
            villageMember = new VillageMember();
            villageMember.Tiers = person;
            village.Members.Add(villageMember);

            var loanAmountCycle = GetLoanAmountCycles();
            var maturityCycles = GetMaturityCycles();
            var rateCycles = GetRateCycles();
            var entryFees = new List<EntryFee>();

            Currency currency = new Currency();
            currency.Id = 1;
            var nrp = new NonRepaymentPenaltiesNullableValues(100, 200, 10, 0.2);
            LoanProduct product = CreatePackage(
                                                "NewPackage68", //package name
                                                null, //anticipatedTotalRepaymentPenalties
                                                3, //anticipatedTotalRepaymentPenaltiesMin
                                                6, //anticipatedTotalRepaymentPenaltiesMax
                                                4, //grace period
                                                null, //gracePeriodMin
                                                null, //gracePeriodMax
                                                0.2m, //interestRate
                                                null, //interesrRateMin
                                                null, //interestRateMax
                                                10, //NmbOfInstallments
                                                null, //NmbOfInstallmentsMin
                                                null, //NmbOfInstallmentsMax
                                                entryFees, //List<EntryFee>
                                                nrp, //NonRepaymentPenalties
                                                null, //NonRepaymentPenaltiesMin
                                                null, //NonRepaymentPenaltiesMax
                                                _monthly, //InstallmentType
                                                2000, //amount
                                                null, //amountMin
                                                null, //AmountMax
                                                null, //ExoticInstallmentsTable
                                                2, //cycleId
                                                loanAmountCycle, //List<LoanAmountCycle>
                                                rateCycles, //List<RateCycle>
                                                maturityCycles, //List<MaturityCycle>
                                                "CODE1", //ProductCode
                                                null, //List<ProductClientType>
                                                null, //amountUnderLoc
                                                null, //amountUnderLocMin
                                                null, //amountUnderLocMax
                                                1, //anticipatedPartialRRepaymentPenalties
                                                null, //anticipatedPartialRRepaymentPenaltiesMin
                                                null, //anticipatedPartialRRepaymentPenaltiesMax
                                                null, //compulsoryAmount
                                                null, //compulsoryAmountMin
                                                null, //compulsoryAmountMax
                                                currency
                );
            product.ClientType = '-';
            product.ProductClientTypes = new List<ProductClientType>();
            product.AddedEntryFees = entryFees;
            product.Id=productServices.AddPackage(product);
            productServices.SaveAllCycleParams(loanAmountCycle, rateCycles, maturityCycles);

            foreach (VillageMember member in village.Members)
            {
                productServices.SetVillageMemberCycleParams(member, product.Id, ((Person)member.Tiers).LoanCycle);
            }

            for (int i = 0; i < village.Members.Count; i++)
            {
                int j = i;
                //to avoid index out of range exception (it occurs in product.LoanAmountCycleParams)
                if (i == product.LoanAmountCycleParams.Count) j = product.LoanAmountCycleParams.Count - 1;
                Assert.AreEqual(village.Members[i].Product.AmountMin, product.LoanAmountCycleParams[j].Min);
                Assert.AreEqual(village.Members[i].Product.AmountMax, product.LoanAmountCycleParams[j].Max);
                Assert.AreEqual(village.Members[i].Product.InterestRateMin, product.RateCycleParams[j].Min.Value);
                Assert.AreEqual(village.Members[i].Product.InterestRateMax, product.RateCycleParams[j].Max.Value);
                Assert.AreEqual(village.Members[i].Product.NbOfInstallmentsMin, (int) product.MaturityCycleParams[j].Min.Value);
                Assert.AreEqual(village.Members[i].Product.NbOfInstallmentsMax, (int) product.MaturityCycleParams[j].Max.Value);
            }

            foreach (VillageMember member in village.Members)
            {
                Loan loan = new Loan();
                loan.LoanPurpose = "Unit tests";
                loan.Product = member.Product;

                loan.Amount = member.Product.AmountMin;
                loan.AmountMin = member.Product.AmountMin;
                loan.AmountMax = member.Product.AmountMax;
                loan.InterestRate = member.Product.InterestRateMin.Value;
                loan.InterestRateMin = member.Product.InterestRateMin.Value;
                loan.InterestRateMax = member.Product.InterestRateMax.Value;
                loan.NbOfInstallments = member.Product.NbOfInstallmentsMin.Value;
                loan.NmbOfInstallmentsMin = member.Product.NbOfInstallmentsMin.Value;
                loan.NmbOfInstallmentsMax = member.Product.NbOfInstallmentsMax;
                loan.StartDate = TimeProvider.Now;
                loan.FirstInstallmentDate = loan.FirstInstallmentDate = DateTime.Now + new TimeSpan(30, 0, 0, 0);
                loan.CloseDate = TimeProvider.Now + new TimeSpan(365, 0, 0, 0);
                loan.EconomicActivityId = 1;

                loan.NonRepaymentPenalties = new NonRepaymentPenalties
                {
                    InitialAmount = member.Product.NonRepaymentPenalties.InitialAmount ?? 0,
                    OLB = member.Product.NonRepaymentPenalties.OLB ?? 0,
                    OverDuePrincipal = member.Product.NonRepaymentPenalties.OverDuePrincipal ?? 0,
                    OverDueInterest = member.Product.NonRepaymentPenalties.OverDueInterest ?? 0
                };
                loan.LoanEntryFeesList = new List<LoanEntryFee>();
                loan.InstallmentType = member.Product.InstallmentType;
                loan.AnticipatedTotalRepaymentPenalties = 0;
                loan.FundingLine = new FundingLine("New_Founding_line", false);
                loan.FundingLine.Currency = loan.Product.Currency;
                loan.FundingLine.Id = 1;
                loan.LoanOfficer = User.CurrentUser;
                loan.LoanOfficer.LastName = "Unit";
                loan.LoanOfficer.FirstName = "Test";
                loan.Synchronize = false;
                loan.ContractStatus = OContractStatus.Validated;
                loan.CreditCommitteeCode = "OK";
                loan.GracePeriod = 0;
                loan.GracePeriodOfLateFees = member.Product.GracePeriodOfLateFees;
                loan.AnticipatedPartialRepaymentPenalties = 2;
                loan.AnticipatedTotalRepaymentPenalties = 3;
                loan.LoanCycle = ((Person)member.Tiers).LoanCycle;
                loan.InstallmentList = new List<Installment>();
                loan.InstallmentList.Add(new Installment());
                loan.InstallmentList[0].ExpectedDate = TimeProvider.Now + new TimeSpan(60, 0, 0, 0);
                loan.InstallmentList[0].InterestsRepayment = 10;
                loan.InstallmentList[0].Number = 1;
                loan.InstallmentList[0].CapitalRepayment = 10;
                loan.InstallmentList[0].PaidInterests = 10;
                loan.InstallmentList[0].PaidCapital = 10;
                loan.InstallmentList[0].PaidDate = TimeProvider.Now;
                loan.InstallmentList[0].FeesUnpaid = 10;
                loan.InstallmentList[0].PaidFees = 10;
                loan.InstallmentList[0].Comment = "Unit test";
                loan.InstallmentList[0].IsPending = false;
                loan.InstallmentList[0].StartDate = TimeProvider.Now;
                loan.InstallmentList[0].OLB = 20;

                loan.InstallmentList.Add(new Installment());
                loan.InstallmentList[1].ExpectedDate = TimeProvider.Now + new TimeSpan(120, 0, 0, 0);
                loan.InstallmentList[1].InterestsRepayment = 10;
                loan.InstallmentList[1].Number = 2;
                loan.InstallmentList[1].CapitalRepayment = 10;
                loan.InstallmentList[1].PaidInterests = 10;
                loan.InstallmentList[1].PaidCapital = 10;
                loan.InstallmentList[1].PaidDate = TimeProvider.Now + new TimeSpan(120, 0, 0, 0);
                loan.InstallmentList[1].FeesUnpaid = 10;
                loan.InstallmentList[1].PaidFees = 10;
                loan.InstallmentList[1].Comment = "Unit test2";
                loan.InstallmentList[1].IsPending = false;
                loan.InstallmentList[1].StartDate = TimeProvider.Now.AddDays(60);
                loan.InstallmentList[1].OLB = 10;
                loan.Events = new EventStock();
                loan.AlignDisbursementDate = TimeProvider.Now;
                loan.CreditCommiteeDate = TimeProvider.Now;
                loan.Guarantors = new List<Guarantor>();
                loan.Collaterals = new List<ContractCollateral>();

                Project project;
                IClient client = member.Tiers;
                if (0 == client.Projects.Count)
                {
                    project = new Project("Village");
                    project.Name = "Village";
                    project.Code = "Village";
                    project.Aim = "Village";
                    project.BeginDate = TimeProvider.Now;
                    project.Id = ServicesProvider.GetInstance().GetProjectServices().SaveProject(project, client);
                    member.Tiers.AddProject(project);
                }
                project = client.Projects[0];
                client.District = new District(1, "Unit Test");
                client.Name = "Unit Test";

                ApplicationSettings appSettings = ApplicationSettings.GetInstance(User.CurrentUser.Md5);
                appSettings.UpdateParameter("ALLOWS_MULTIPLE_LOANS", 1);
                appSettings.UpdateParameter("CONTRACT_CODE_TEMPLATE", "Contract");

                ServicesProvider.GetInstance().GetContractServices().SaveLoan(ref loan, project.Id, ref client);
            }

            foreach (VillageMember member in village.Members)
            {
                member.ActiveLoans = ServicesProvider.GetInstance().GetContractServices().FindActiveContracts(member.Tiers.Id);
            }

            for (int i = 0; i < village.Members.Count; i++)
            {
                int j = i;
                //to avoid index out of range exception (it occurs in product.LoanAmountCycleParams)
                if (i == product.LoanAmountCycleParams.Count) j = product.LoanAmountCycleParams.Count - 1;
                for (int k = 0; k < village.Members[i].ActiveLoans.Count; k++)
                {
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].AmountMin, loanAmountCycle[j].Min);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].AmountMax, loanAmountCycle[j].Max);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].Amount, loanAmountCycle[j].Min);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].InterestRateMin, (double?) rateCycles[j].Min.Value);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].InterestRateMax, (double?) rateCycles[j].Max.Value);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].InterestRate, (double?) rateCycles[j].Min.Value);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].NmbOfInstallmentsMin,
                                    (int) maturityCycles[j].Min.Value);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].NmbOfInstallmentsMax,
                                    (int) maturityCycles[j].Max.Value);
                    Assert.AreEqual(village.Members[i].ActiveLoans[k].NbOfInstallments, (int) maturityCycles[j].Min.Value);
                }
            }
        }
Beispiel #14
0
 public void TestAddExoticInstallmentInExoticProductWhenInstallmentIsNull()
 {
     ExoticInstallmentsTable product = new ExoticInstallmentsTable();
     ExoticInstallment exoticInstallment = new ExoticInstallment();
     exoticInstallment.InterestCoeff = null;
     exoticInstallment.PrincipalCoeff = 0;
     LoanProductManager productManager = new LoanProductManager(DataUtil.TESTDB);
     ProductServices productServices = new ProductServices(productManager);
     productServices.AddExoticInstallmentInExoticProduct(product, exoticInstallment, 1, false);
 }
Beispiel #15
0
 public ProductServices(User user)
 {
     _user = user;
     _productManager = new LoanProductManager(user);
     _installmentTypeManager = new InstallmentTypeManager(user);
     _fundingLineManager = new FundingLineManager(user);
     _productManager.ProductLoaded += ProductLoaded;
     MefContainer.Current.Bind(this);
 }
Beispiel #16
0
 public void TestCreationOfProductWithoutLoanCycles()
 {
     Currency currency = new Currency();
     currency.Id = 1;
     var nrp = new NonRepaymentPenaltiesNullableValues(100, 200, 10, 0.2);
     var entryFees = new List<EntryFee>();
     LoanProduct product = CreatePackage(
                                         "NewPackage", //package name
                                         null, //anticipatedTotalRepaymentPenalties
                                         3, //anticipatedTotalRepaymentPenaltiesMin
                                         6, //anticipatedTotalRepaymentPenaltiesMax
                                         4, //grace period
                                         null, //gracePeriodMin
                                         null, //gracePeriodMax
                                         0.2m, //interestRate
                                         null, //interesrRateMin
                                         null, //interestRateMax
                                         0, //NmbOfInstallments
                                         null, //NmbOfInstallmentsMin
                                         null, //NmbOfInstallmentsMax
                                         entryFees, //List<EntryFee>
                                         nrp, //NonRepaymentPenalties
                                         null, //NonRepaymentPenaltiesMin
                                         null, //NonRepaymentPenaltiesMax
                                         _monthly, //InstallmentType
                                         2000, //amount
                                         null, //amountMin
                                         null, //AmountMax
                                         null, //ExoticInstallmentsTable
                                         null, //cycleId
                                         null, //List<LoanAmountCycle>
                                         null, //List<RateCycle>
                                         null, //List<MaturityCycle>
                                         "CODE1", //ProductCode
                                         null, //List<ProductClientType>
                                         null, //amountUnderLoc
                                         null, //amountUnderLocMin
                                         null, //amountUnderLocMax
                                         1, //anticipatedPartialRRepaymentPenalties
                                         null, //anticipatedPartialRRepaymentPenaltiesMin
                                         null, //anticipatedPartialRRepaymentPenaltiesMax
                                         null, //compulsoryAmount
                                         null, //compulsoryAmountMin
                                         null, //compulsoryAmountMax
                                         currency
         );
     LoanProductManager productManager = new LoanProductManager(DataUtil.TESTDB);
     ProductServices productServices = new ProductServices(productManager);
     productServices.ParseFieldsAndCheckErrors(product, false);
 }
        protected override void SetUp()
        {
            base.SetUp();

            _accountingRuleManager = (AccountingRuleManager)container["AccountingRuleManager"];
            _accountManager = (AccountManager)container["AccountManager"];
            _loanProductManager = (LoanProductManager)container["LoanProductManager"];
            _savingProductManager = (SavingProductManager)container["SavingProductManager"];
            _economicActivityManager = (EconomicActivityManager)container["EconomicActivityManager"];
            _fundingLineManager = (FundingLineManager)container["FundingLineManager"];
            _eventManager = (EventManager)container["EventManager"];

            Assert.IsNotNull(_accountingRuleManager);
            Assert.IsNotNull(_accountManager);
            Assert.IsNotNull(_loanProductManager);
            Assert.IsNotNull(_savingProductManager);
            Assert.IsNotNull(_economicActivityManager);
            Assert.IsNotNull(_fundingLineManager);
            Assert.IsNotNull(_eventManager);
        }