public override List <SavingEvent> Withdraw(OCurrency pAmount, DateTime pDate, string pDescription, User pUser, bool pIsDesactivateFees, Teller teller, PaymentMethod paymentMethod) { List <SavingEvent> events = new List <SavingEvent>(); int?tellerId = null; if (teller != null && teller.Id != 0) { tellerId = teller.Id; } OSavingsMethods savingsMethod = (OSavingsMethods)Enum.Parse(typeof(OSavingsMethods), paymentMethod.Name); SavingWithdrawEvent withdrawEvent = new SavingWithdrawEvent { Amount = pAmount, Date = pDate, Description = pDescription, User = pUser, Cancelable = true, Fee = 0m, TellerId = tellerId, ProductType = typeof(SavingsBookProduct), SavingsMethod = savingsMethod }; Events.Add(withdrawEvent); events.Add(withdrawEvent); if (Status != OSavingsStatus.Closed && !pIsDesactivateFees) { withdrawEvent.Fee = Product.WithdrawFeesType == OSavingsFeesType.Flat ? FlatWithdrawFees : pAmount * RateWithdrawFees.Value; } return(events); }
// public virtual List<SavingEvent> RefusePendingDeposit(OCurrency pAmount, DateTime pDate, User pUser, string pDescription, OPaymentMethods method, int? pendingEventId) // { // throw new NotImplementedException(); // } public virtual List<SavingEvent> RefusePendingDeposit(OCurrency pAmount, DateTime pDate, User pUser, string pDescription, OSavingsMethods method, int? pendingEventId) { throw new NotImplementedException(); }
public virtual List<SavingEvent> Deposit(OCurrency pAmount, DateTime pDate, string pDescription, User pUser, bool pIsDesactivateFees, bool isPending, OSavingsMethods savingsMethod, int? pendingEventId, Teller teller) { List<SavingEvent> events = new List<SavingEvent>(); SavingEvent savingEvent; int? tellerId = null; if (teller != null) tellerId = teller.Id; if (isPending) { savingEvent = new SavingPendingDepositEvent(); } else { savingEvent = new SavingDepositEvent(); } savingEvent.Amount = pAmount; savingEvent.Date = pDate; savingEvent.Description = pDescription; savingEvent.User = pUser; savingEvent.Cancelable = true; savingEvent.IsPending = isPending; savingEvent.SavingsMethod = savingsMethod; savingEvent.PendingEventId = pendingEventId; savingEvent.TellerId = tellerId; savingEvent.ProductType = typeof(SavingsBookProduct); Events.Add(savingEvent); events.Add(savingEvent); return events; }
// public virtual List<SavingEvent> RefusePendingDeposit(OCurrency pAmount, DateTime pDate, User pUser, string pDescription, OPaymentMethods method, int? pendingEventId) // { // throw new NotImplementedException(); // } public virtual List <SavingEvent> RefusePendingDeposit(OCurrency pAmount, DateTime pDate, User pUser, string pDescription, OSavingsMethods method, int?pendingEventId) { throw new NotImplementedException(); }
public virtual List <SavingEvent> Deposit(OCurrency pAmount, DateTime pDate, string pDescription, User pUser, bool pIsDesactivateFees, bool isPending, OSavingsMethods savingsMethod, int?pendingEventId, Teller teller) { List <SavingEvent> events = new List <SavingEvent>(); SavingEvent savingEvent; int?tellerId = null; if (teller != null) { tellerId = teller.Id; } if (isPending) { savingEvent = new SavingPendingDepositEvent(); } else { savingEvent = new SavingDepositEvent(); } savingEvent.Amount = pAmount; savingEvent.Date = pDate; savingEvent.Description = pDescription; savingEvent.User = pUser; savingEvent.Cancelable = true; savingEvent.IsPending = isPending; savingEvent.SavingsMethod = savingsMethod; savingEvent.PendingEventId = pendingEventId; savingEvent.TellerId = tellerId; savingEvent.ProductType = typeof(SavingsBookProduct); Events.Add(savingEvent); events.Add(savingEvent); return(events); }
public virtual List <SavingEvent> LoanDisbursement(Loan loan, DateTime date, string description, User user, bool isDesactivateFees, bool isPending, OSavingsMethods savingsMethod, int?pendingEventId, Teller teller) { var events = new List <SavingEvent>(); int?tellerId = null; if (teller != null && teller.Id != 0) { tellerId = teller.Id; } SavingEvent savingEvent = new SavingLoanDisbursementEvent(); savingEvent.Amount = loan.Amount; savingEvent.Date = date; savingEvent.Description = description; savingEvent.User = user; savingEvent.Cancelable = false; savingEvent.IsPending = isPending; savingEvent.SavingsMethod = null; savingEvent.PendingEventId = pendingEventId; savingEvent.TellerId = tellerId; savingEvent.LoanEventId = loan.GetNotDeletedDisbursementEvent().Id; savingEvent.ProductType = typeof(SavingsBookProduct); Events.Add(savingEvent); events.Add(savingEvent); savingEvent.Fee = Status != OSavingsStatus.Closed && !isDesactivateFees?loan.GetSumOfFees() : 0; return(events); }
public List<SavingEvent> RefusePendingDeposit(OCurrency pRefuseAmount, ISavingsContract pSaving, DateTime pDate, User pUser, OSavingsMethods method, int? pendingEventId) { using (SqlConnection conn = _savingManager.GetConnection()) using (SqlTransaction sqlTransaction = conn.BeginTransaction()) { try { List<SavingEvent> events = pSaving.RefusePendingDeposit(pRefuseAmount, pDate, pUser, "Refuse pending deposit", method, pendingEventId); foreach (SavingEvent savingEvent in events) _ePS.FireEvent(savingEvent, pSaving, sqlTransaction); sqlTransaction.Commit(); return events; } catch (Exception) { sqlTransaction.Rollback(); throw; } } }
public override List<SavingEvent> Deposit(OCurrency pAmount, DateTime pDate, string pDescription, User pUser, bool pIsDesactivateFees, bool isPending, OSavingsMethods savingsMethod, PaymentMethod paymentMethod, int? pendingEventId, Teller teller) { List<SavingEvent> events = new List<SavingEvent>(); int? tellerId = null; if (teller != null && teller.Id != 0) tellerId = teller.Id; SavingEvent savingEvent; if (isPending) { savingEvent = new SavingPendingDepositEvent(); } else { savingEvent = new SavingDepositEvent(); } savingEvent.Amount = pAmount; savingEvent.Date = pDate; savingEvent.Description = pDescription; savingEvent.User = pUser; savingEvent.Cancelable = true; savingEvent.IsPending = isPending; savingEvent.SavingsMethod = savingsMethod; savingEvent.PaymentsMethod = paymentMethod; savingEvent.PendingEventId = pendingEventId; savingEvent.TellerId = tellerId; savingEvent.ProductType = typeof(SavingsBookProduct); Events.Add(savingEvent); events.Add(savingEvent); if (Status != OSavingsStatus.Closed && !pIsDesactivateFees) savingEvent.Fee = savingsMethod == OSavingsMethods.Cheque ? ChequeDepositFees : DepositFees; return events; }
private SavingCreditOperationEvent SpecialOperationCredit(ISavingsContract pSaving, DateTime pDate, OCurrency creditAmount, string pDescription, User pUser, OSavingsMethods savingsMethod) { using (SqlConnection conn = _savingManager.GetConnection()) using (SqlTransaction sqlTransaction = conn.BeginTransaction()) { try { //// Create a fake Saving object ISavingsContract savingSimulation = (ISavingsContract) pSaving.Clone(); // Do deposit to the fake Saving object savingSimulation.SpecialOperationCredit(creditAmount, pDate, pDescription, pUser); // Check balance simulation if (!IsSavingBalanceCorrect(savingSimulation)) throw new OpenCbsSavingException(OpenCbsSavingExceptionEnum.BalanceIsInvalid); SavingCreditOperationEvent events = pSaving.SpecialOperationCredit(creditAmount, pDate, pDescription, pUser); _ePS.FireEvent(events, pSaving, sqlTransaction); sqlTransaction.Commit(); return events; } catch (Exception) { sqlTransaction.Rollback(); throw; } } }
public List<SavingEvent> Deposit(ISavingsContract saving, DateTime dateTime, OCurrency depositAmount, string description, User user, bool isPending, OSavingsMethods savingsMethod, int? pendingEventId, Teller teller) { using (SqlConnection conn = _savingManager.GetConnection()) using (SqlTransaction sqlTransaction = conn.BeginTransaction()) { try { if (!IsDepositAmountCorrect(depositAmount, saving, savingsMethod)) throw new OpenCbsSavingException(OpenCbsSavingExceptionEnum.DepositAmountIsInvalid); ISavingsContract savingSimulation = (ISavingsContract) saving.Clone(); // Create a fake Saving object // Do deposit to the fake Saving object savingSimulation.Deposit(depositAmount, dateTime, description, user, false, isPending, savingsMethod, pendingEventId, teller); if (!IsSavingBalanceCorrect(savingSimulation)) // Check balance simulation throw new OpenCbsSavingException(OpenCbsSavingExceptionEnum.BalanceIsInvalid); List<SavingEvent> events = saving.Deposit(depositAmount, dateTime, description, user, false, isPending, savingsMethod, pendingEventId, teller); foreach (SavingEvent savingEvent in events) { _ePS.FireEvent(savingEvent, saving, sqlTransaction); } // Change overdraft state if (saving is SavingBookContract) { if (saving.GetBalance() > 0) { ((SavingBookContract) saving).InOverdraft = false; UpdateOverdraftStatus(saving.Id, false); } } sqlTransaction.Commit(); return events; } catch (Exception) { sqlTransaction.Rollback(); throw; } } }
private static bool IsDepositAmountCorrect(OCurrency pDepositAmount, ISavingsContract pSaving, OSavingsMethods savingsMethod) { // Check Deposit event amount if (savingsMethod == OSavingsMethods.Cheque) { SavingsBookProduct sbp = (SavingsBookProduct) pSaving.Product; return ServicesHelper.CheckIfValueBetweenMinAndMax(sbp.ChequeDepositMin, sbp.ChequeDepositMax, pDepositAmount); } return (ServicesHelper.CheckIfValueBetweenMinAndMax(pSaving.Product.DepositMin, pSaving.Product.DepositMax, pDepositAmount)); }
public override List <SavingEvent> RefusePendingDeposit(OCurrency pAmount, DateTime pDate, User pUser, string pDescription, OSavingsMethods method, int?pendingEventId) { List <SavingEvent> events = new List <SavingEvent>(); SavingPendingDepositRefusedEvent refuseEvent = new SavingPendingDepositRefusedEvent { Amount = pAmount, Date = pDate, Description = pDescription, User = pUser, Cancelable = false, Fee = 0m, SavingsMethod = method, PendingEventId = pendingEventId, ProductType = typeof(SavingsBookProduct) }; events.Add(refuseEvent); Events.Add(refuseEvent); return(events); }
public override List <SavingEvent> Deposit(OCurrency pAmount, DateTime pDate, string pDescription, User pUser, bool pIsDesactivateFees, bool isPending, OSavingsMethods savingsMethod, PaymentMethod paymentMethod, int?pendingEventId, Teller teller) { List <SavingEvent> events = new List <SavingEvent>(); int?tellerId = null; if (teller != null && teller.Id != 0) { tellerId = teller.Id; } SavingEvent savingEvent; if (isPending) { savingEvent = new SavingPendingDepositEvent(); } else { savingEvent = new SavingDepositEvent(); } savingEvent.Amount = pAmount; savingEvent.Date = pDate; savingEvent.Description = pDescription; savingEvent.User = pUser; savingEvent.Cancelable = true; savingEvent.IsPending = isPending; savingEvent.SavingsMethod = savingsMethod; savingEvent.PaymentsMethod = paymentMethod; savingEvent.PendingEventId = pendingEventId; savingEvent.TellerId = tellerId; savingEvent.ProductType = typeof(SavingsBookProduct); Events.Add(savingEvent); events.Add(savingEvent); if (Status != OSavingsStatus.Closed && !pIsDesactivateFees) { savingEvent.Fee = savingsMethod == OSavingsMethods.Cheque ? ChequeDepositFees : DepositFees; } return(events); }
private void BSaveClick(object sender, EventArgs e) { nudAmount_ValueChanged(sender, e); bool pending = cbxPending.Visible && cbxPending.Checked; try { _date = new DateTime(dtpDate.Value.Year, dtpDate.Value.Month, dtpDate.Value.Day, TimeProvider.Now.Hour, TimeProvider.Now.Minute, TimeProvider.Now.Second); SavingServices savingServices = ServicesProvider.GetInstance().GetSavingServices(); if (_date.Date < TimeProvider.Today.Date) { savingServices.PerformBackDateOperations(_date); } else if (_date.Date > TimeProvider.Today.Date) { savingServices.PerformFutureDateOperations(_date); } if (_saving.HasPendingEvents()) { if (!savingServices.AllowOperationsDuringPendingDeposit()) { return; } } if ((_flatFees.HasValue && updAmountFees.Value != _flatFees) || (_rateFees.HasValue && updAmountFees.Value != (decimal)(_rateFees * 100))) { if (!savingServices.AllowSettingSavingsOperationsFeesManually()) { return; } } switch (_bookingDirection) { case OSavingsOperation.Credit: { var paymentMethod = (PaymentMethod)cbSavingsMethod.SelectedItem; OSavingsMethods savingsMethod = (OSavingsMethods)Enum.Parse(typeof(OSavingsMethods), paymentMethod.Name); if (_saving is SavingBookContract) { if (savingsMethod == OSavingsMethods.Cheque) { ((SavingBookContract)_saving).ChequeDepositFees = updAmountFees.Value; } else { ((SavingBookContract)_saving).DepositFees = updAmountFees.Value; } } savingServices.Deposit(_saving, _date, _amount, _description, User.CurrentUser, pending, savingsMethod, paymentMethod, null, Teller.CurrentTeller, _chequeNumberTextBox.Text); _saving.Status = OSavingsStatus.Active; savingServices.UpdateStatus(_saving); break; } case OSavingsOperation.Debit: { var paymentMethod = (PaymentMethod)cbSavingsMethod.SelectedItem; if (_saving is SavingBookContract) { if (_flatFees.HasValue) { ((SavingBookContract)_saving).FlatWithdrawFees = updAmountFees.Value; } else { ((SavingBookContract)_saving).RateWithdrawFees = (double)(updAmountFees.Value / 100); } } savingServices.Withdraw(_saving, _date, _amount, _description, User.CurrentUser, Teller.CurrentTeller, paymentMethod, _chequeNumberTextBox.Text); break; } case OSavingsOperation.Transfer: { if (_saving is SavingBookContract) { if (_flatFees.HasValue) { ((SavingBookContract)_saving).FlatTransferFees = updAmountFees.Value; } else { ((SavingBookContract)_saving).RateTransferFees = (double)(updAmountFees.Value / 100); } } decimal fee = nudTotalAmount.Value - nudAmount.Value; savingServices.Transfer(_saving, _savingTarget, _date, _amount, fee, _description, User.CurrentUser, false); break; } case OSavingsOperation.SpecialOperation: { OSavingsMethods savingsMethod = (OSavingsMethods) Enum.Parse(typeof(OSavingsMethods), cbSavingsMethod.SelectedValue.ToString()); if (cbBookings.SelectedItem != null) { Booking booking = (Booking)cbBookings.SelectedItem; booking.Branch = _saving.Branch; savingServices.SpecialOperation(_saving, _date, _amount, _description, User.CurrentUser, savingsMethod, rbxCredit.Checked, booking); break; } throw new OpenCbsSavingException(OpenCbsSavingExceptionEnum.TransactionInvalid); } } Close(); } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } }
public void SpecialOperation(ISavingsContract saving, DateTime pDate, OCurrency amount, string description, User pUser, OSavingsMethods savingsMethod, bool isCredit, Booking booking) { if (booking == null) throw new OpenCbsBookingException(OpenCbsBookingExceptionsEnum.BookingIsEmpty); booking.Amount = amount; booking.Description = description; booking.ExchangeRate = 1; booking.Date = TimeProvider.Now; booking.Currency = saving.Product.Currency; booking.User = User.CurrentUser; SavingEvent e; if (isCredit) { e = SpecialOperationCredit(saving, pDate, amount, description, User.CurrentUser, savingsMethod); } else { e = SpecialOperationDebit(saving, pDate, amount, description, User.CurrentUser, savingsMethod); } booking.EventId = e.Id; ServicesProvider.GetInstance().GetAccountingServices().BookManualEntry(booking, User.CurrentUser); }
public override List<SavingEvent> LoanDisbursement(Loan loan, DateTime date, string description, User user, bool isDesactivateFees, bool isPending, OSavingsMethods savingsMethod, int? pendingEventId, Teller teller) { var events = new List<SavingEvent>(); int? tellerId = null; if (teller != null && teller.Id != 0) tellerId = teller.Id; SavingEvent savingEvent = new SavingLoanDisbursementEvent { Amount = loan.Amount, Date = date, Description = description, User = user, Cancelable = false, IsPending = isPending, SavingsMethod = null, PendingEventId = pendingEventId, TellerId = tellerId, LoanEventId = loan.GetNotDeletedDisbursementEvent().Id, ProductType = typeof (SavingsBookProduct) }; Events.Add(savingEvent); events.Add(savingEvent); savingEvent.Fee = Status != OSavingsStatus.Closed && !isDesactivateFees ? loan.GetSumOfFees() : 0; return events; }
public SavingDebitOperationEvent SpecialOperationDebit(ISavingsContract pSaving, DateTime pDate, OCurrency debitAmount, string pDescription, User pUser, OSavingsMethods savingsMethod) { using (SqlConnection conn = _savingManager.GetConnection()) using (SqlTransaction sqlTransaction = conn.BeginTransaction()) { try { if (pSaving is SavingBookContract) { decimal vBalance = CheckVirtualBalance((SavingBookContract) pSaving, debitAmount); if (vBalance > 0) { List<string> messages = new List<string> { ServicesHelper.ConvertDecimalToString( ((SavingBookContract) pSaving).GetBalance().Value), ServicesHelper.ConvertDecimalToString(vBalance), ((SavingBookContract) pSaving).Loans.Count.ToString(), ServicesHelper.ConvertDecimalToString( ((SavingBookContract) pSaving).GetBalance().Value - vBalance) }; throw new OpenCbsSavingException( OpenCbsSavingExceptionEnum.BalanceOnCurrentSavingAccountForTransfer, messages); } } //// Create a fake Saving object ISavingsContract savingSimulation = (ISavingsContract) pSaving.Clone(); // Do deposit to the fake Saving object savingSimulation.SpecialOperationDebit(debitAmount, pDate, pDescription, pUser); // Check balance simulation if (!IsSavingBalanceCorrect(savingSimulation)) throw new OpenCbsSavingException(OpenCbsSavingExceptionEnum.BalanceIsInvalid); SavingDebitOperationEvent events = pSaving.SpecialOperationDebit(debitAmount, pDate, pDescription, pUser); _ePS.FireEvent(events, pSaving, sqlTransaction); // Change overdraft state if (pSaving is SavingBookContract) { if (pSaving.GetBalance() > 0) { ((SavingBookContract) pSaving).InOverdraft = false; UpdateOverdraftStatus(pSaving.Id, false); } } sqlTransaction.Commit(); return events; } catch (Exception) { sqlTransaction.Rollback(); throw; } } }
public override List<SavingEvent> RefusePendingDeposit(OCurrency pAmount, DateTime pDate, User pUser, string pDescription, OSavingsMethods method, int? pendingEventId) { List<SavingEvent> events = new List<SavingEvent>(); SavingPendingDepositRefusedEvent refuseEvent = new SavingPendingDepositRefusedEvent { Amount = pAmount, Date = pDate, Description = pDescription, User = pUser, Cancelable = false, Fee = 0m, SavingsMethod = method, PendingEventId = pendingEventId, ProductType = typeof(SavingsBookProduct) }; events.Add(refuseEvent); Events.Add(refuseEvent); return events; }
private void BSaveClick(object sender, EventArgs e) { nudAmount_ValueChanged(sender, e); bool pending = cbxPending.Visible && cbxPending.Checked; bool?local = null; local = rbxLocal.Visible && rbxLocal.Checked; try { _date = new DateTime(dtpDate.Value.Year, dtpDate.Value.Month, dtpDate.Value.Day, TimeProvider.Now.Hour, TimeProvider.Now.Minute, TimeProvider.Now.Second); AccountServices savingServices = ServicesProvider.GetInstance().GetAccountServices(); if (_saving.Events.Find(ev => ev.Code == OSavingEvents.SavingClosure && ev.Date.Date >= _date.Date && ev is SavingClosureEvent) != null) { savingServices.CanPostAfterClosureEvent(); } List <SavingEvent> savingEvents = new List <SavingEvent>(); if (_date.Date < TimeProvider.Today.Date) { savingServices.PerformBackDateOperations(_date); } else if (_date.Date > TimeProvider.Today.Date) { savingServices.PerformFutureDateOperations(_date); } if (_saving.HasPendingEvents()) { if (!savingServices.AllowOperationsDuringPendingDeposit()) { return; } } if ((_flatFees.HasValue && updAmountFees.Value != _flatFees) || (_rateFees.HasValue && updAmountFees.Value != (decimal)(_rateFees * 100))) { if (!savingServices.AllowSettingSavingsOperationsFeesManually()) { return; } } switch (_bookingDirection) { case OSavingsOperation.Credit: { OSavingsMethods savingsMethod = (OSavingsMethods) Enum.Parse(typeof(OSavingsMethods), "Cash"); var paymentMethod = (PaymentMethod)cbSavingsMethod.SelectedItem; if (_saving is SavingBookContract) { if (savingsMethod == OSavingsMethods.Cheque) { ((SavingBookContract)_saving).ChequeDepositFees = updAmountFees.Value; } else { ((SavingBookContract)_saving).DepositFees = updAmountFees.Value; } //modified OCurrency dutyStampFeeMin = Convert.ToDecimal(ApplicationSettings.GetInstance("").GetSpecificParameter(OGeneralSettings.STAMP_DUTY_VALID_ABOVE)); if (_amount < dutyStampFeeMin) { ((SavingBookContract)_saving).DutyStampFees = 0; } } savingEvents = savingServices.Deposit(_saving, _date, _amount, _description, _referenceNumber, User.CurrentUser, pending, local, savingsMethod, paymentMethod, null, Teller.CurrentTeller); break; } case OSavingsOperation.Debit: { var paymentMethod = (PaymentMethod)cbSavingsMethod.SelectedItem; if (_saving is SavingBookContract) { if (_flatFees.HasValue) { ((SavingBookContract)_saving).FlatWithdrawFees = updAmountFees.Value; } else { ((SavingBookContract)_saving).RateWithdrawFees = (double)(updAmountFees.Value / 100); } OCurrency _feesMin, _feesMax; decimal value = _flatAMFees.HasValue ? _flatAMFees.Value : ((decimal)(_rateAMFees)) * 100; if (((SavingsBookProduct)_saving.Product).FlatAMFees.HasValue || ((SavingsBookProduct)_saving.Product).FlatAMFeesMin.HasValue) { if (((SavingsBookProduct)_saving).FlatAMFees.HasValue) { _feesMin = ((SavingsBookProduct)_saving.Product).FlatAMFees; _feesMax = ((SavingsBookProduct)_saving.Product).FlatAMFees; } else { _feesMin = ((SavingsBookProduct)_saving.Product).FlatAMFeesMin; _feesMax = ((SavingsBookProduct)_saving.Product).FlatAMFeesMax; } OCurrency amFee = value <_feesMin || value> _feesMax ? _feesMin : value; ((SavingBookContract)_saving).FlatAMFees = amFee; } else { if (((SavingsBookProduct)_saving.Product).RateAMFees.HasValue) { _feesMin = (decimal)((SavingsBookProduct)_saving.Product).RateAMFees * 100; _feesMax = (decimal)((SavingsBookProduct)_saving.Product).RateAMFees * 100; } else { _feesMin = (decimal)((SavingsBookProduct)_saving.Product).RateAMFeesMin * 100; _feesMax = (decimal)((SavingsBookProduct)_saving.Product).RateAMFeesMax * 100; } var amFee = value <_feesMin || value> _feesMax ? _feesMin : value; ((SavingBookContract)_saving).RateAMFees = (double)(amFee.Value / 100); } } savingEvents = savingServices.Withdraw(_saving, _date, _amount, _description, _referenceNumber, User.CurrentUser, Teller.CurrentTeller, paymentMethod); break; } case OSavingsOperation.Transfer: { if (_saving is SavingBookContract) { if (_flatFees.HasValue) { ((SavingBookContract)_saving).FlatTransferFees = updAmountFees.Value; } else { ((SavingBookContract)_saving).RateTransferFees = (double)(updAmountFees.Value / 100); } } decimal fee = nudTotalAmount.Value - nudAmount.Value; savingEvents = savingServices.Transfer(_saving, _savingTarget, _date, _amount, fee, _description, _referenceNumber, User.CurrentUser, false); break; } case OSavingsOperation.SpecialOperation: { OSavingsMethods savingsMethod = (OSavingsMethods) Enum.Parse(typeof(OSavingsMethods), ((PaymentMethod)cbSavingsMethod.SelectedItem).Name); if (cbBookings.SelectedItem != null) { Booking booking = (Booking)cbBookings.SelectedItem; booking.Branch = _saving.Branch; savingServices.SpecialOperation(_saving, _date, _amount, _description, User.CurrentUser, savingsMethod, rbxCredit.Checked, booking); break; } throw new OpenCbsSavingException(OpenCbsSavingExceptionEnum.TransactionInvalid); } } try { //slycode MessagingService messagingService = new MessagingService(Person); foreach (SavingEvent savingEvent in savingEvents) { if (!(savingEvent is SavingInstrumentFeeEvent || savingEvent is SavingSearchFeeEvent //|| savingEvent is SavingDutyStampFeeEvent || savingEvent is SavingAMFeeEvent)) { messagingService.SendNotification(savingEvent, _saving, _bookingDirection.Description()); } } } catch (Exception exc) { new frmShowError(CustomExceptionHandler.ShowExceptionText(exc)).ShowDialog(); } Close(); } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } }