/// <summary> /// Sets client bank by project id in session /// </summary> /// <param name="projectId">Project id in session sets the client bank.</param> private void SetClientBank(Guid projectId) { AccountsServiceClient accountsService = null; ClientBankIdReturnValue returnValue = null; try { returnValue = new ClientBankIdReturnValue(); //If a value is selected then save it, this prevents the default value from //overriding the selection if (_ddlClientBank.Items.Count > 0) { accountsService = new AccountsServiceClient(); returnValue = accountsService.GetClientBankIdByProjectId(_logonSettings.LogonId, projectId); } if (returnValue.ClientBankId != 0) { if (_ddlClientBank.Items.FindByValue(returnValue.ClientBankId.ToString()) != null) { _ddlClientBank.SelectedValue = returnValue.ClientBankId.ToString(); } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) { accountsService.Close(); } } } }
/// <summary> /// Sets client bank by project id in session /// </summary> /// <param name="projectId">Project id in session sets the client bank.</param> private void SetClientBank(Guid projectId) { AccountsServiceClient accountsService = null; ClientBankIdReturnValue returnValue = null; try { returnValue = new ClientBankIdReturnValue(); //If a value is selected then save it, this prevents the default value from //overriding the selection if (_ddlClientBank.Items.Count > 0) { accountsService = new AccountsServiceClient(); returnValue = accountsService.GetClientBankIdByProjectId(_logonSettings.LogonId, projectId); } if (returnValue.ClientBankId != 0) { if (_ddlClientBank.Items.FindByValue(returnValue.ClientBankId.ToString()) != null) { _ddlClientBank.SelectedValue = returnValue.ClientBankId.ToString(); } } } catch (System.ServiceModel.EndpointNotFoundException) { _lblMessage.Text = DataConstants.WSEndPointErrorMessage; _lblMessage.CssClass = "errorMessage"; } catch (Exception ex) { _lblMessage.CssClass = "errorMessage"; _lblMessage.Text = ex.Message; } finally { if (accountsService != null) { if (accountsService.State != System.ServiceModel.CommunicationState.Faulted) accountsService.Close(); } } }