/// <summary> /// Gets the client bank id by project id /// This method sets client bank id for adding client cheque request /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="projectId">Project id to get client bank id</param> /// <returns>Returns client bank id by project id</returns> public ClientBankIdReturnValue GetClientBankIdByProjectId(HostSecurityToken oHostSecurityToken, Guid projectId) { ClientBankIdReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.GetClientBankIdByProjectId(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { returnValue = new ClientBankIdReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
/// <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(); } } }
/// <summary> /// Gets the client bank id by project id /// This method sets client bank id for adding client cheque request /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service</param> /// <param name="projectId">Project id to get client bank id</param> /// <returns>Returns client bank id by project id</returns> public ClientBankIdReturnValue GetClientBankIdByProjectId(Guid logonId, Guid projectId) { ClientBankIdReturnValue returnValue = new ClientBankIdReturnValue(); try { // Get the logged on user from the current logons and add their // ApplicationSettings the list of concurrent sessions. Host.LoadLoggedOnUser(logonId); try { Functions.RestrictRekoopIntegrationUser(UserInformation.Instance.DbUid); switch (UserInformation.Instance.UserType) { case DataConstants.UserType.Staff: // Can do everything break; case DataConstants.UserType.Client: case DataConstants.UserType.ThirdParty: throw new Exception("Access denied"); default: throw new Exception("Access denied"); } returnValue.ClientBankId = SrvMatterCommon.GetClientBankIdByProjectId(projectId); returnValue.Success = true; } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { returnValue.Success = false; returnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { returnValue.Success = false; returnValue.Message = ex.Message; } return returnValue; }
/// <summary> /// Gets the client bank id by project id /// This method sets client bank id for adding client cheque request /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="projectId">Project id to get client bank id</param> /// <returns>Returns client bank id by project id</returns> public ClientBankIdReturnValue GetClientBankIdByProjectId(HostSecurityToken oHostSecurityToken, Guid projectId) { ClientBankIdReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.GetClientBankIdByProjectId(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { returnValue = new ClientBankIdReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }