public void ImportInstallmentRepayment(List<Installment> pInstallments) { LoanServices loanServices = new LoanServices(_user); ClientServices clientServices = new ClientServices(_user); foreach (var installment in pInstallments) { int loanId = loanServices.SelectLoanId(installment.ContractCode); var loan = loanServices.SelectLoan(loanId, true, true, true); var client = clientServices.FindTiersByContractId(loanId); if (installment.RepaymentStatus == 1) { if (loan.InstallmentList[installment.InstallmentNumber].IsPending) loanServices.ConfirmPendingRepayment(loan, client); else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid) { PaymentMethod paymentMethod = ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(5); loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount, false, 0, 0, false, 0, true, false, paymentMethod, "", false); } } else { if (loan.InstallmentList[installment.InstallmentNumber].IsPending) loanServices.CancelPendingInstallments(loan); } } }
public void ImportInstallmentRepayment(List <Installment> pInstallments) { LoanServices loanServices = new LoanServices(_user); ClientServices clientServices = new ClientServices(_user); foreach (var installment in pInstallments) { int loanId = loanServices.SelectLoanId(installment.ContractCode); var loan = loanServices.SelectLoan(loanId, true, true, true); var client = clientServices.FindTiersByContractId(loanId); if (installment.RepaymentStatus == 1) { if (loan.InstallmentList[installment.InstallmentNumber].IsPending) { loanServices.ConfirmPendingRepayment(loan, client); } else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid) { PaymentMethod paymentMethod = ServicesProvider.GetInstance().GetPaymentMethodServices().GetPaymentMethodById(5); loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount, false, 0, 0, false, 0, true, false, paymentMethod, "", false); } } else { if (loan.InstallmentList[installment.InstallmentNumber].IsPending) { loanServices.CancelPendingInstallments(loan); } } } }
private void CheckContractAndDisplayIt(CreditSearchResult pCredit) { if (!_isSearchLoanContractForCompulsory) { try { ClientServices clientServices = ServicesProvider.GetInstance().GetClientServices(); // if client has no contract (i.e. in Village) if (pCredit.Id == 0) { MessageBox.Show(@"This client in a village has no contract yet!"); } else { IClient client = clientServices.FindTiersByContractId(pCredit.Id); if (clientServices.CheckIfTiersIsValid(client)) { var mainForm = (MainView)Application.OpenForms[0]; mainForm.InitializeCreditContractForm(client, pCredit.Id); } } } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } } else { groupBoxContractType.Enabled = true; _isSearchSavingContractForTransfer = false; SelectedLoanContract = pCredit; DialogResult = DialogResult.OK; } }
public void ImportInstallmentRepayment(List<Installment> pInstallments) { LoanServices loanServices = new LoanServices(_user); ClientServices clientServices = new ClientServices(_user); foreach (var installment in pInstallments) { int loanId = loanServices.SelectLoanID(installment.ContractCode); var loan = loanServices.SelectLoan(loanId, true, true, true); var client = clientServices.FindTiersByContractId(loanId); if (installment.RepaymentStatus == 1) { if (loan.InstallmentList[installment.InstallmentNumber].IsPending) loanServices.ConfirmPendingRepayment(loan, client); else if (!loan.InstallmentList[installment.InstallmentNumber].IsRepaid) loanServices.Repay(loan, client, installment.InstallmentNumber, installment.InstallmentDate, installment.InstallmentAmount, false, 0, 0, false, 0, true, Octopus.Enums.OPaymentMethods.WireTransfer, "", false); } else { if (loan.InstallmentList[installment.InstallmentNumber].IsPending) loanServices.CancelPendingInstallments(loan); } } }