public SavingManager(string pTestDB) : base(pTestDB) { _savingProductManager = new SavingProductManager(pTestDB); _savingEventManager = new SavingEventManager(pTestDB); _loanManager = new LoanManager(pTestDB); _user = new User(); }
public SavingManager(User pUser) : base(pUser) { _savingProductManager = new SavingProductManager(pUser); _savingEventManager = new SavingEventManager(pUser); _loanManager = new LoanManager(pUser); _clientManager = new ClientManager(pUser, false, false); _user = pUser; }
public ProjectManager(User pUser, bool pInitializeAll) : base(pUser) { if (pInitializeAll) { _creditManager = new LoanManager(pUser); _locations = new LocationsManager(pUser); } else _clientManager = new ClientManager(pUser, false, false); }
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(); }
public LoanServices(InstallmentManager pInstalmentManager, ClientManager pClientManager, LoanManager pLoanManager) { _user = new User(); _instalmentManager = pInstalmentManager; _clientManager = pClientManager; _loanManager = pLoanManager; MefContainer.Current.Bind(this); }
public GraphServices(LoanManager pContractManagement) { _contractManagement = pContractManagement; _user = new User(); }
public EventProcessorServices(EventManager eventManagement,AccountingTransactionManager movementSetManagement,LoanManager loanManager, AccountManager accountManagement) { _eventManagement = eventManagement; _movementSetManagement = movementSetManagement; _loanManager = loanManager; _InitializeEventProcessor(); }
public void DoRepaymentFromSavingsAccount() { SetApplicationSettings(); AddDataForTestingTransaction dataHelper = new AddDataForTestingTransaction(); int _creditId = dataHelper.AddGenericCreditContractIntoDatabase(); IClient _client = ServicesProvider.GetInstance().GetClientServices().FindGroupByName("SCG"); LoanManager _loanManager = new LoanManager(new User() { Id = 1 }); Loan _loan = _loanManager.SelectLoan(_creditId, true, true, true); _loan.CreditCommiteeDate = _loan.StartDate; _loan.CompulsorySavings = GetSavingContract(_client); _loanManager.UpdateLoan(_loan); AddFundingLineEvent(_loan); LoanServices loanServices = new LoanServices(new User() { Id = 1 }); PaymentMethod method = new PaymentMethod(1, "Cash", "Cash", false); _loan = loanServices.Disburse(_loan, new DateTime(2005, 10, 10), true, false, method); Assert.AreEqual(_loan.Disbursed, true); PaymentMethod paymentMethod = new PaymentMethod(1, "Savings", "", false); loanServices.Repay(_loan, _client, 1, new DateTime(2005, 10, 11), 100, true, 0, 0, false, 5, false, false, paymentMethod, null, false); Assert.IsTrue(_loan.CompulsorySavings.Events.FindAll(item => item is LoanRepaymentFromSavingEvent).Count==1); }
public SavingServices(SavingManager pSavingManager, SavingEventManager pSavingEventManager, LoanManager pLoanManager, User pUser) { _user = pUser; _savingManager = pSavingManager; _savingEventManager = pSavingEventManager; }
public void TestIfRealDisbursmentCurveCorrectlyCalculate() { int forecastDays = 8; DateTime date = new DateTime(2006,1,1); List<KeyValuePair<DateTime, decimal>> list = new List<KeyValuePair<DateTime, decimal>> { new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 1), 100), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 2), 200), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 4), 400), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 6), 1233), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 9), 4876) }; mockContractManagement.SetReturnValue("CalculateCashToDisburseByDay",list); contractManagement = (LoanManager)mockContractManagement.MockInstance; this.graphServices = new GraphServices(contractManagement); double[] disbursmentState = new double[forecastDays]; disbursmentState = this.graphServices.CalculateRealDisbursmentCurve(date,forecastDays); Assert.AreEqual(100,disbursmentState[0]); Assert.AreEqual(300,disbursmentState[1]); Assert.AreEqual(300,disbursmentState[2]); Assert.AreEqual(700,disbursmentState[3]); Assert.AreEqual(700,disbursmentState[4]); Assert.AreEqual(1933,disbursmentState[5]); Assert.AreEqual(1933,disbursmentState[6]); Assert.AreEqual(1933,disbursmentState[7]); }
public void TestIfRealRepayCurveCorrectlyCalculate() { int forecastDays = 10; DateTime date = new DateTime(2006,1,1); List<KeyValuePair<DateTime, decimal>> cashToRepayByDay = new List<KeyValuePair<DateTime, decimal>> { new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 1), 100), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 2), 184), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 4), 3944), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 5), 5978), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 7), 6000), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 8), 6001), new KeyValuePair<DateTime, decimal>(new DateTime(2006, 1, 10), 6876) }; mockContractManagement.SetReturnValue("CalculateCashToRepayByDay",cashToRepayByDay); contractManagement = (LoanManager)mockContractManagement.MockInstance; this.graphServices = new GraphServices(contractManagement); double[] realPrevision = new double[forecastDays]; realPrevision = this.graphServices.CalculateRealRepayCurve(date,forecastDays); Assert.AreEqual(100,realPrevision[0]); Assert.AreEqual(284,realPrevision[1]); Assert.AreEqual(284,realPrevision[2]); Assert.AreEqual(4228,realPrevision[3]); Assert.AreEqual(10206,realPrevision[4]); Assert.AreEqual(10206,realPrevision[5]); Assert.AreEqual(16206,realPrevision[6]); Assert.AreEqual(22207,realPrevision[7]); Assert.AreEqual(22207,realPrevision[8]); Assert.AreEqual(29083,realPrevision[9]); }
public SavingServices(SavingManager pSavingManager, SavingEventManager pSavingEventManager, LoanManager pLoanManager, User pUser) { _user = pUser; _savingManager = pSavingManager; _savingEventManager = pSavingEventManager; MefContainer.Current.Bind(this); }
public LoanServices(InstallmentManager pInstalmentManager, ClientManager pClientManager, LoanManager pLoanManager) { _user = new User(); _instalmentManager = pInstalmentManager; _clientManager = pClientManager; _loanManager = pLoanManager; }
public LoanServices(User pUser) : base(pUser) { _user = pUser; _loanManager = new LoanManager(pUser); _instalmentManager = new InstallmentManager(pUser); _clientManager = new ClientManager(pUser, true, true); _branchService = new BranchService(pUser); _econimcActivityServices = new EconomicActivityServices(pUser); _ePs = ServicesProvider.GetInstance().GetEventProcessorServices(); _accountingServices = new AccountingServices(pUser); _fundingLineServices = new FundingLineServices(pUser); _savingServices = new SavingServices(pUser); _savingEventManager = new SavingEventManager(pUser); }
public LoanServices(User pUser) : base(pUser) { _user = pUser; _loanManager = new LoanManager(pUser); _instalmentManager = new InstallmentManager(pUser); _clientManager = new ClientManager(pUser, true, true); _branchService = new BranchService(pUser); _econimcActivityServices = new EconomicActivityServices(pUser); _ePs = ServicesProvider.GetInstance().GetEventProcessorServices(); _accountingServices = new AccountingServices(pUser); _fundingLineServices = new FundingLineServices(pUser); _savingServices = new SavingServices(pUser); _savingEventManager = new SavingEventManager(pUser); var settings = ApplicationSettings.GetInstance(string.Empty); var nonWorkingDate = NonWorkingDateSingleton.GetInstance(string.Empty); _configurationFactory = new OctopusScheduleConfigurationFactory(nonWorkingDate, settings); MefContainer.Current.Bind(this); }
public ProjectManager(string testDB, User pUser) : base(testDB) { _creditManager = new LoanManager(testDB, pUser); _locations = new LocationsManager(testDB); }
public void RepayLoanBeforeDisburse() { ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, false); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, false); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, 0); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INTERESTS_ALSO_CREDITED_IN_FL, 1); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, 0); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.BAD_LOAN_DAYS, "180"); ProvisionTable _provisionningTable = ProvisionTable.GetInstance(new User() { Id = 1 }); _provisionningTable.ProvisioningRates = new List<ProvisioningRate>(); _provisionningTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, ProvisioningValue = 0.02, ProvisioningInterest = 0.02, ProvisioningPenalty = 0.02 }); _provisionningTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, ProvisioningValue = 0.1, ProvisioningInterest = 0.1, ProvisioningPenalty = 0.1 }); _provisionningTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 0.25, ProvisioningInterest = 0.25, ProvisioningPenalty = 0.25 }); _provisionningTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 61, NbOfDaysMax = 90, ProvisioningValue = 0.5, ProvisioningInterest= 0.5, ProvisioningPenalty= 0.5 }); _provisionningTable.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 91, NbOfDaysMax = 180, ProvisioningValue = 0.75, ProvisioningInterest = 0.75, ProvisioningPenalty = 0.75 }); _provisionningTable.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 181, NbOfDaysMax = 365, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty= 1 }); _provisionningTable.Add(new ProvisioningRate { Number = 7, NbOfDaysMin = 366, NbOfDaysMax = 99999, ProvisioningValue = 1, ProvisioningInterest= 1, ProvisioningPenalty= 1 }); Teller.CurrentTeller = null; AddDataForTestingTransaction dataHelper = new AddDataForTestingTransaction(); int _creditId = dataHelper.AddGenericCreditContractIntoDatabase(); IClient _client = new Group { Id = 5 }; LoanManager _loanManager = new LoanManager(new User() { Id = 1 }); Loan _loan = _loanManager.SelectLoan(_creditId, true, true, true); _loan.CreditCommiteeDate = _loan.StartDate; FundingLine f = _loan.FundingLine; f.Currency.Id = _loan.Product.Currency.Id; FundingLineServices fundingLineServices = new FundingLineServices(new User() { Id = 1 }); var ev = new FundingLineEvent { Code = "KAO", Type = OFundingLineEventTypes.Entry, CreationDate = new DateTime(2008, 1, 10), EndDate = DateTime.Now.AddDays(1), Amount = 1000, FundingLine = f, Movement = OBookingDirections.Credit, IsDeleted = false }; fundingLineServices.AddFundingLineEvent(ev, null); f.AddEvent(ev); LoanServices loanServices = new LoanServices(new User() { Id = 1 }); PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false); _loan = loanServices.Disburse(_loan, new DateTime(2005, 10, 10), true, false, method); Assert.AreEqual(_loan.Disbursed, true); PaymentMethod paymentMethod = new PaymentMethod(1, "Cash", "", false); loanServices.Repay(_loan, _client, 1, new DateTime(2005, 1, 5), 100, true, 0, 0, false, 5, false, false, paymentMethod, null, false); }
protected override void SetUp() { base.SetUp(); _loanManager = (LoanManager) container["LoanManager"]; _loan = new Loan(new User(), ApplicationSettings.GetInstance(""), NonWorkingDateSingleton.GetInstance(""), ProvisionTable.GetInstance(new User()), ChartOfAccounts.GetInstance(new User())) { ClientType = OClientTypes.Person, LoanOfficer = new User {Id = 1}, BranchCode = "DU", CreationDate = DateTime.Today.AddDays(-1), StartDate = DateTime.Today, AlignDisbursementDate = DateTime.Today, CloseDate = DateTime.Today.AddDays(1), Product = new LoanProduct {Id = 1, Currency = new Currency {Id = 1}}, Amount = 1000m, InterestRate = 3, InstallmentType = new InstallmentType {Id = 1}, NbOfInstallments = 2, FundingLine = new FundingLine {Id = 1}, InstallmentList = new List<Installment> {_installment1, _installment2}, EconomicActivityId = 1, EconomicActivity = new EconomicActivity{Id = 1}, GracePeriodOfLateFees = 0 }; }
public void RepayWrittenOffLoan() { ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, false); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INCREMENTALDURINGDAYOFF, false); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.CALCULATIONLATEFEESDURINGPUBLICHOLIDAYS, 0); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.INTERESTS_ALSO_CREDITED_IN_FL, 1); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.DONOTSKIPWEEKENDSININSTALLMENTSDATE, 0); ApplicationSettings.GetInstance("").UpdateParameter(OGeneralSettings.BAD_LOAN_DAYS, "180"); ProvisionTable _provisionningTable = ProvisionTable.GetInstance(new User() {Id = 1}); _provisionningTable.ProvisioningRates = new List<ProvisioningRate>(); _provisionningTable.Add(new ProvisioningRate { Number = 1, NbOfDaysMin = 0, NbOfDaysMax = 0, ProvisioningValue = 0.02, ProvisioningInterest = 0.02, ProvisioningPenalty = 0.02 }); _provisionningTable.Add(new ProvisioningRate { Number = 2, NbOfDaysMin = 1, NbOfDaysMax = 30, ProvisioningValue = 0.1, ProvisioningInterest = 0.01, ProvisioningPenalty = 0.01 }); _provisionningTable.Add(new ProvisioningRate { Number = 3, NbOfDaysMin = 31, NbOfDaysMax = 60, ProvisioningValue = 0.25, ProvisioningInterest = 0.025, ProvisioningPenalty = 0.025 }); _provisionningTable.Add(new ProvisioningRate { Number = 4, NbOfDaysMin = 61, NbOfDaysMax = 90, ProvisioningValue = 0.5, ProvisioningInterest = 0.5, ProvisioningPenalty = 0.5 }); _provisionningTable.Add(new ProvisioningRate { Number = 5, NbOfDaysMin = 91, NbOfDaysMax = 180, ProvisioningValue = 0.75, ProvisioningInterest = 0.75, ProvisioningPenalty = 0.75 }); _provisionningTable.Add(new ProvisioningRate { Number = 6, NbOfDaysMin = 181, NbOfDaysMax = 365, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty = 1 }); _provisionningTable.Add(new ProvisioningRate { Number = 7, NbOfDaysMin = 366, NbOfDaysMax = 99999, ProvisioningValue = 1, ProvisioningInterest = 1, ProvisioningPenalty = 1 }); Teller.CurrentTeller = null; //DynamicMock mockClientManager = new DynamicMock(typeof(ClientManager)); //DynamicMock mockLoanManager = new DynamicMock(typeof(LoanManager)); //Loan loan = new Loan //{ // Amount = 11, // Code = "Test", // InterestRate = 1, // NbOfInstallments = 2, // InstallmentType = new InstallmentType(), // AnticipatedTotalRepaymentPenalties = 2, // NonRepaymentPenalties = new NonRepaymentPenalties(1, 1, 1, 1), // GracePeriod = 2, // Events = new EventStock(), // StartDate = new DateTime(2009, 1, 1), // FundingLine = new FundingLine { Currency = new Currency { Id = 1, Code = "Code", Name = "Name" } }, // LoanOfficer = new User(), // Product = new LoanProduct { Currency = new Currency { Id = 1, Code = "Code", Name = "Name" } }, // InstallmentList = new List<Installment> { _installment1, _installment2 } //}; //Person person = new Person { Active = false, LoanCycle = 1 }; //IClient group = new Group { Active = false, LoanCycle = 1, Members = new List<Member> { new Member { Tiers = person } } }; //mockClientManager.Expect("UpdateClientStatus", group, null); //mockClientManager.Expect("UpdateClientLoanCycle", group, null); //mockClientManager.Expect("UpdateClientStatus", person, null); //mockClientManager.Expect("UpdateClientLoanCycle", person, null); //LoanServices loanServices = new LoanServices(null, (ClientManager)mockClientManager.MockInstance, (LoanManager)mockLoanManager.MockInstance); //loanServices.SaveLoan(ref loan, 1, ref group); //loanServices.Disburse(loan, new DateTime(2008, 1, 1), true, true); //loanServices.Repay(loan, group, 1, DateTime.Now, 1, true, 0, 0, false, 0, true); //Loan disbursedLoan = loan; //disbursedLoan.Disbursed = true; //LoanDisbursmentEvent loanDisbursmentEvent = new LoanDisbursmentEvent // { // Date = new DateTime(2008, 1, 1), // Amount = disbursedLoan.Amount, // Commission = disbursedLoan.CalculateEntryFeesAmount(), // ClientType = disbursedLoan.ClientType // }; //disbursedLoan.Events.Add(loanDisbursmentEvent); //loanServices.Repay(disbursedLoan, group, 1, DateTime.Now, 1, true, 0,0, false, 1, true); AddDataForTestingTransaction dataHelper = new AddDataForTestingTransaction(); int _creditId = dataHelper.AddGenericCreditContractIntoDatabase(); IClient _client = new Group {Id = 5}; LoanManager _loanManager = new LoanManager(new User() {Id = 1}); Loan _loan = _loanManager.SelectLoan(_creditId, true, true, true); _loan.CreditCommiteeDate = _loan.StartDate; AccountManager accountManager = new AccountManager(new User() {Id = 1}); //accountManager.AddForCurrency(_loan.Product.Currency.Id); FundingLine f = _loan.FundingLine; f.Currency.Id = _loan.Product.Currency.Id; FundingLineServices fundingLineServices = new FundingLineServices(new User() {Id = 1}); var ev = new FundingLineEvent { Code = "KAO", Type = OFundingLineEventTypes.Entry, CreationDate = new DateTime(2008,1,1), EndDate = DateTime.Now.AddDays(1), Amount = 1000, FundingLine = f, Movement = OBookingDirections.Credit, IsDeleted = false }; fundingLineServices.AddFundingLineEvent(ev, null); f.AddEvent(ev); _loan.LoanEntryFeesList=new List<LoanEntryFee>(); EntryFee productEntryFee = new EntryFee(); productEntryFee.Value = 1; productEntryFee.IsRate = false; productEntryFee.Id = 21; LoanEntryFee loanEntryFee = new LoanEntryFee(); loanEntryFee.FeeValue = 1; loanEntryFee.ProductEntryFee = productEntryFee; loanEntryFee.ProductEntryFeeId = 21; LoanServices loanServices = new LoanServices(new User() { Id = 1 }); PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false); loanServices.Disburse(_loan, new DateTime(2008, 1, 1), true, false, method); ////_loan.WrittenOff = true; ////_loan = loanServices.Repay(_loan, _client, 1, DateTime.Now, 10, true, 0, 0,false, 1, true); //Assert.AreEqual(_loan.Disbursed, true); //_loan.WrittenOff = true; //OCurrency prevAmount = _loan.ChartOfAccounts.GetAccountByNumber(OAccounts.RECOVERY_OF_CHARGED_OFF_ASSETS, _loan.Product.Currency.Id).Balance; //_loan = loanServices.Repay(_loan, _client, 1, DateTime.Now, 100, true, 0, 0, false, 5, false, OPaymentMethods.Cash, null, false); //Assert.AreEqual(_loan.Events.GetNumberOfEvents, 1); //_loan.Events.SortEventsByDate(); //Assert.AreEqual(_loan.Events.GetEvent(0).Code, "ROWO"); //_loan = loanServices.Repay(_loan, _client, 2, DateTime.Now, 100, true, 0, 0, false, 5, false, OPaymentMethods.Cash, null, false); //Assert.AreEqual(_loan.Events.GetNumberOfEvents, 2); //_loan.Events.SortEventsByDate(); //Assert.AreEqual(_loan.Events.GetEvent(0).Code, "ROWO"); }
public void ShouldNotDisburseMultipleTimes() { var settings = ApplicationSettings.GetInstance(""); settings.UpdateParameter(OGeneralSettings.ALLOWSMULTIPLELOANS, true); settings.UpdateParameter(OGeneralSettings.ACCOUNTINGPROCESS, OAccountingProcesses.Cash); Teller.CurrentTeller = null; AddDataForTestingTransaction dataHelper = new AddDataForTestingTransaction(); int creditId = dataHelper.AddGenericCreditContractIntoDatabase(); LoanManager loanManager = new LoanManager(new User { Id = 1 }); Loan loan = loanManager.SelectLoan(creditId, true, true, true); FundingLine f = loan.FundingLine; f.Currency.Id = loan.Product.Currency.Id; FundingLineServices fundingLineServices = new FundingLineServices(new User() { Id = 1 }); var ev = new FundingLineEvent { Code = "KAO", Type = OFundingLineEventTypes.Entry, CreationDate = new DateTime(2008, 1, 10), EndDate = DateTime.Now.AddDays(1), Amount = 1000, FundingLine = f, Movement = OBookingDirections.Credit, IsDeleted = false }; fundingLineServices.AddFundingLineEvent(ev, null); f.AddEvent(ev); loan.CreditCommiteeDate = loan.StartDate; LoanServices loanServices = new LoanServices(new User { Id = 1 }); PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false); try { loan.Disbursed = true; loanServices.Disburse(loan, new DateTime(2005, 10, 10), true, false, method); Assert.Fail("Contract should not be validated"); } catch(OpenCbsContractSaveException) { } try { loan.Disbursed = false; loanServices.Disburse(loan, new DateTime(2005, 10, 10), true, false, method); loanServices.Disburse(loan, new DateTime(2005, 10, 10), true, false, method); Assert.Fail("Contract should not be failed due to double disbursements"); } catch (OpenCbsContractSaveException) { } }
public GraphServices(User pUser) { _contractManagement = new LoanManager(pUser); _user = pUser; }