public void Select_Added_WriteOffEvent() { EventManager eventManager = (EventManager)container["EventManager"]; WriteOffEvent writeOffEvent = new WriteOffEvent { Id = 15, User = new User { Id = 1 }, Date = new DateTime(2006, 7, 21), OLB = 34, AccruedInterests = 355, AccruedPenalties = 433, PastDueDays = 3, OverduePrincipal = 0 }; eventManager.AddLoanEvent(writeOffEvent, 1); EventStock eventStock = eventManager.SelectEvents(2); foreach (Event e in eventStock.GetEvents()) { if (e is WriteOffEvent) _AssertWriteOffEvent(e as WriteOffEvent, new DateTime(2006, 7, 21), 34, 355, 433, 3); } }
public void Delete_Event() { EventManager eventManager = (EventManager)container["EventManager"]; //I choose LoanInterestAccruingEvent, but delete work with any event AccruedInterestEvent loanInterestAccruingEvent = new AccruedInterestEvent { Id = 15, User = new User { Id = 1 }, Date = new DateTime(2006, 7, 21), Interest = 99, AccruedInterest = 3, Rescheduled = true, InstallmentNumber = 4 }; eventManager.AddLoanEvent(loanInterestAccruingEvent, 3); loanInterestAccruingEvent.CancelDate = DateTime.Now; eventManager.DeleteLoanEvent(loanInterestAccruingEvent); EventStock eventStock = eventManager.SelectEvents(3); foreach (Event e in eventStock.GetEvents()) { if (e is AccruedInterestEvent) _AssertLoanInterestAccruingEvent(e as AccruedInterestEvent, new DateTime(2006, 7, 21), 99, 3, true, 4,true); } }
public void Select_Added_RepaymentEvent() { EventManager eventManager = (EventManager)container["EventManager"]; RepaymentEvent repaymentEvent = new RepaymentEvent { Id = 130, Code = "RGLE", User = new User {Id = 1}, Date = new DateTime(2006, 7, 21), PastDueDays = 3, Principal = 1999, Interests = 2333, Commissions = 23, InstallmentNumber = 3, PaymentMethod = new PaymentMethod(1, "Cash", "", false) }; using (SqlTransaction tran = eventManager.GetConnection().BeginTransaction()) eventManager.AddLoanEvent(repaymentEvent, 1, tran); EventStock eventStock = eventManager.SelectEvents(2); foreach (Event e in eventStock.GetEvents()) { if (e is RepaymentEvent) _AssertRepaymentEvent(e as RepaymentEvent, "RGLE", new DateTime(2006, 7, 21), 3, 1999, 2333, 23, 3); } }
public void Select_Added_loanDisbursmentEvent() { EventManager eventManager = (EventManager)container["EventManager"]; LoanDisbursmentEvent loanDisbursmentEvent = new LoanDisbursmentEvent { Id = 100, User = new User { Id = 1 }, Date = new DateTime(2006, 7, 21), Amount = 100, }; var commission = new LoanEntryFeeEvent(); commission.Fee = 10; loanDisbursmentEvent.Commissions = new List<LoanEntryFeeEvent>(); loanDisbursmentEvent.Commissions.Add(commission); PaymentMethod method = new PaymentMethod(1, "Savings", "Savings method", false); loanDisbursmentEvent.PaymentMethod = method; eventManager.AddLoanEvent(loanDisbursmentEvent, 2); EventStock eventStock = eventManager.SelectEvents(2); foreach (Event e in eventStock.GetEvents()) { if (e is LoanDisbursmentEvent) _AssertLoanDisbursmentEvent(e as LoanDisbursmentEvent, new DateTime(2006, 7, 21), 100, 10); } }
public void Select_Added_LoanInterestAccruingEvent() { EventManager eventManager = (EventManager)container["EventManager"]; AccruedInterestEvent loanInterestAccruingEvent = new AccruedInterestEvent { Id = 15, User = new User { Id = 1 }, Date = new DateTime(2006, 7, 21), Interest = 99, AccruedInterest = 3, Rescheduled = true, InstallmentNumber = 4 }; eventManager.AddLoanEvent(loanInterestAccruingEvent, 1); EventStock eventStock = eventManager.SelectEvents(2); foreach (Event e in eventStock.GetEvents()) { if (e is AccruedInterestEvent) { _AssertLoanInterestAccruingEvent(e as AccruedInterestEvent, new DateTime(2006, 7, 21), 99, 3, true, 4, false); } } }
public void Select_Added_ReschedulingLoanEvent() { EventManager eventManager = (EventManager)container["EventManager"]; RescheduleLoanEvent rescheduleLoanEvent = new RescheduleLoanEvent { Id = 14, User = new User { Id = 1 }, Date = new DateTime(2006, 7, 21), Amount = 2345, NbOfMaturity = 4, DateOffset = 0, Interest = 100 }; eventManager.AddLoanEvent(rescheduleLoanEvent, 1); EventStock eventStock = eventManager.SelectEvents(2); foreach (Event e in eventStock.GetEvents()) { if (e is RescheduleLoanEvent) { _AssertReschedulingLoanEvent(e as RescheduleLoanEvent, new DateTime(2006, 7, 21), 2345, 3, 4); } } }
private void BtnPostClick(object sender, EventArgs e) { btnPost.Enabled = false; EnableCloseButton(this, false); try { if (_mode == 0) { _bookings = olvBookings.CheckedObjects.Cast <Booking>().ToList(); if (_bookings.Count > 0) { bwPostBookings.RunWorkerAsync(); } else { MessageBox.Show(@"Please select items !"); btnPost.Enabled = true; EnableCloseButton(this, true); } } if (_mode == 1) { foreach (Event evt in olvEvents.CheckedObjects) { _eventStock.Add(evt); } if (_eventStock.GetEvents().Count > 0) { bwPostEvents.RunWorkerAsync(); } else { MessageBox.Show(@"Please select items !"); EnableCloseButton(this, true); btnPost.Enabled = true; } } } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } }
public void Select_Added_RegEvent() { EventManager eventManager = (EventManager)container["EventManager"]; RegEvent regEvent = new RegEvent { Id = 15, User = new User { Id = 1 }, Date = new DateTime(2006, 7, 21) }; eventManager.AddLoanEvent(regEvent, 1); EventStock eventStock = eventManager.SelectEvents(2); foreach (Event e in eventStock.GetEvents()) { if (e is RegEvent) _AssertRegEvent(e as RegEvent, new DateTime(2006, 7, 21),false); } }
private void GetBookings(ClosureOptions options) { List <Booking> bookings = new List <Booking>(); EventStock eventStock = new EventStock(); AccountingRuleCollection rules = ServicesProvider.GetInstance().GetAccountingRuleServices().SelectAll(); rules.SortByOrder(); if (options.DoLoanClosure) { UpdateStatus("LoanClosureProcessing", ""); eventStock = ServicesProvider.GetInstance().GetEventProcessorServices().SelectEventsForClosure(_beginDate, _endDate, _branch); UpdateStatus("LoanClosureProcessing", eventStock.GetEvents().Count.ToString()); //add generated events for processing } if (options.DoSavingClosure) { UpdateStatus("SavingsClosureProcessing", ""); eventStock.AddRange( ServicesProvider.GetInstance().GetSavingServices().SelectEventsForClosure( _beginDate, _endDate, _branch)); UpdateStatus("SavingsClosureProcessing", eventStock.GetEvents().Count.ToString()); } if (options.DoTellerManagementClosure) { UpdateStatus("TellerManagementProcessing", ""); eventStock.AddRange(ServicesProvider.GetInstance().GetEventProcessorServices().GetTellerEventsForClosure( _beginDate, _endDate)); UpdateStatus("EventClosureProcessing", eventStock.GetEvents().Count.ToString()); } //important to have sorted list eventStock.SortEventsById(); //closure procesing timerClosure.Start(); timerClosure.Enabled = true; //set ex rate List <ExchangeRate> rates = ServicesProvider.GetInstance().GetExchangeRateServices().SelectRatesByDate(_beginDate, _endDate); List <CoreDomain.Accounting.FiscalYear> fiscalYears = ServicesProvider.GetInstance().GetChartOfAccountsServices().SelectFiscalYears(); bookings.AddRange( _accountingClosure.GetBookings( rules, eventStock, ServicesProvider.GetInstance().GetTellerServices().FindAllTellers(), ServicesProvider.GetInstance().GetPaymentMethodServices().GetAllPaymentMethodsForClosure(), rates, fiscalYears)); timerClosure.Stop(); timerClosure.Enabled = false; //manual transactions if (options.DoManualEntries) { bookings.AddRange(ServicesProvider.GetInstance().GetAccountingServices().SelectMovements(false, rates, fiscalYears)); } #region Reversal if (options.DoReversalTransactions) { UpdateStatus("ReversalTransactionProcessing", ""); bookings.AddRange(ServicesProvider.GetInstance().GetAccountingServices().SelectMovementsForReverse( rates, fiscalYears)); } #endregion //add reversal provision booking if (options.DoLoanClosure) { bookings.AddRange( _generatedEvents.GetProvisionEvents().Select( provisionEvent => ServicesProvider.GetInstance().GetAccountingServices().SelectProvisionMovments( provisionEvent.ContracId, rates, fiscalYears)).Where(b => b != null)); } SortBookingsByDate(bookings); FillListView(bookings); }
public void GetEvents() { Assert.AreEqual(7, _eventStock.GetEvents().Count); }