private void AddAlert(Alert pAlert) { if(!_list.ContainsKey(pAlert.LoanId)) _list.Add(pAlert.LoanId,pAlert); else { Alert alert = _list[pAlert.LoanId] as Alert; decimal amount = alert.Amount.Value + pAlert.Amount.Value; if(alert.EffectDate > pAlert.EffectDate) { _list.Remove(pAlert.LoanId); pAlert.Amount = amount; _list.Add(pAlert.LoanId,pAlert); } else (_list[pAlert.LoanId] as Alert).Amount = amount; } }
//[Test] //public void Test_SelectDisbursedLoan() //{ // List<AccountTiers> accountsTiers = _loanManager.SelectDisbursedContracts(new DateTime(2010, 01, 01), new DateTime(2010, 02, 01)); // Assert.AreEqual(0, accountsTiers.Count); // //Assert.AreEqual(5, accountsTiers[0].ContractId); // //Assert.AreEqual("EDE34/LALAU/1/1/2", accountsTiers[0].ContractCode); // //Assert.AreEqual(new DateTime(2010, 01, 01), accountsTiers[0].DisbursmentDate); // //Assert.AreEqual(1, accountsTiers[0].ClientId); // //Assert.AreEqual(OClientTypes.Group, accountsTiers[0].ClientType); // //Assert.AreEqual("Group Nicolas", accountsTiers[0].ClientName); // //Assert.AreEqual(1, accountsTiers[0].LoanOfficerId); // //Assert.AreEqual("ZOU ZOU", accountsTiers[0].LoanOfficerName); // //Assert.AreEqual(2, accountsTiers[0].CollectiveAccount.Id); // //Assert.AreEqual("10913", accountsTiers[0].CollectiveAccount.LocalNumber); // //Assert.AreEqual("Cash Credit", accountsTiers[0].CollectiveAccount.Label); //} private static void _AssertAlert(Alert pActualAlert, char pType, int pLoanId, string pLoanCode, string pClientName, DateTime pEffectDate, OCurrency pAmount, DateTime pStartDate, DateTime pCloseDate, DateTime pCreationDate, string pInstallmentType, decimal pInterestRate, OCurrency pOLB, string pDistrict) { Assert.AreEqual(pType, pActualAlert.Type); Assert.AreEqual(pLoanId, pActualAlert.LoanId); Assert.AreEqual(pLoanCode, pActualAlert.LoanCode); Assert.AreEqual(pClientName, pActualAlert.ClientName); Assert.AreEqual(pEffectDate, pActualAlert.EffectDate); Assert.AreEqual(pAmount.Value, pActualAlert.Amount.Value); Assert.AreEqual(pStartDate, pActualAlert.StartDate); Assert.AreEqual(pCloseDate, pActualAlert.CloseDate); Assert.AreEqual(pCreationDate, pActualAlert.CreationDate); Assert.AreEqual(pInstallmentType, pActualAlert.InstallmentTypes); Assert.AreEqual(pInterestRate, pActualAlert.InterestRate); Assert.AreEqual(pOLB.Value, pActualAlert.OLB.Value); Assert.AreEqual(pDistrict, pActualAlert.DistrictName); }
private static Alert GetAlert(OpenCbsReader pReader, char pType) { int i = 0; var alert = new Alert(); while (i < pReader.FieldCount) { alert.AddParameter(pReader.GetName(i), pReader.GetValue(i)); i++; } alert.Type = pType; return alert; }
public void Add(Alert pAlert) { AddAlert(pAlert); }
private ListViewItem CreateListViewItem(Alert alert) { ListViewItem listViewItem = new ListViewItem(alert.LoanCode){ Tag = alert.LoanId, ImageIndex = (alert.Type == 'D' ? 1 : 0) }; listViewAlert.CheckBoxes = true; listViewItem.SubItems.Add(alert.EffectDate.ToShortDateString()); listViewItem.SubItems.Add(alert.Amount.GetFormatedValue(alert.UseCents)); listViewItem.SubItems.Add(alert.ClientName); listViewItem.SubItems.Add(alert.DistrictName); listViewItem.SubItems.Add(alert.StartDate.ToShortDateString()); listViewItem.SubItems.Add(alert.CloseDate.ToShortDateString()); listViewItem.SubItems.Add(alert.CreationDate.ToShortDateString()); listViewItem.SubItems.Add(alert.InstallmentTypes); listViewItem.SubItems.Add(alert.InterestRate.ToString()); listViewItem.SubItems.Add(alert.OLB.GetFormatedValue(alert.UseCents)); listViewItem.SubItems.Add(alert.LoanId.ToString()); if (alert.Color == OAlertColors.Color1) listViewItem.BackColor = Color.FromArgb(226, 0, 26); else if (alert.Color == OAlertColors.Color2) listViewItem.BackColor = Color.FromArgb(255, 92, 92); else if (alert.Color == OAlertColors.Color3) listViewItem.BackColor = Color.FromArgb(255, 187, 120); else if (alert.Color == OAlertColors.Color4) listViewItem.BackColor = Color.FromArgb(147, 181, 167); else if (alert.Color == OAlertColors.Color5) listViewItem.BackColor = Color.FromArgb(188, 209, 199); else if (alert.Color == OAlertColors.Color6) listViewItem.BackColor = Color.FromArgb(217, 229, 223); else listViewItem.BackColor = Color.White; return listViewItem; }