private void CheckContractAndDisplayIt(SavingSearchResult saving) { if (!_isSearchSavingContractForTransfer) { try { ClientServices clientServices = ServicesProvider.GetInstance().GetClientServices(); IClient client = ServicesProvider.GetInstance().GetClientServices().FindTiers(saving.ClientId, saving.ClientType); if (clientServices.CheckIfTiersIsValid(client)) { var mainForm = (MainView)Application.OpenForms[0]; mainForm.InitializeSavingContractForm(client, saving.Id); } } catch (Exception ex) { new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog(); } } else { groupBoxContractType.Enabled = true; _isSearchSavingContractForTransfer = false; SelectedSavingContract = saving; DialogResult = DialogResult.OK; } }
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 TestIfTiersIsValidWhenTiersIsNull() { clientServices.CheckIfTiersIsValid(null); }