/// <summary> /// Gets the client bank Id, office bank Id and partner member Id based on the branch and dept id /// </summary> /// <param name="oHostSecurityToken">The Host Security Token from IWS</param> /// <param name="branchOrganisationId">The branch organisation id.</param> /// <param name="departmentId">The department id.</param> /// <returns></returns> public BranchReturnValue GetBranch(HostSecurityToken oHostSecurityToken, Guid orgId) { BranchReturnValue branchReturnValue = new BranchReturnValue(); if (Functions.ValidateIWSToken(oHostSecurityToken)) { oBranchDeptService = new BranchDeptService(); branchReturnValue = oBranchDeptService.GetBranch(Functions.GetLogonIdFromToken(oHostSecurityToken), orgId); } else { branchReturnValue = new BranchReturnValue(); branchReturnValue.Success = false; branchReturnValue.Message = "Invalid Token"; } return(branchReturnValue); }
public BranchReturnValue GetBranch(Guid logonId, Guid orgId) { DsBranches dsBranchReturnValue = new DsBranches(); BranchReturnValue branchReturnValue = new BranchReturnValue(); branchReturnValue.Branch = new Branch(); //DsBranches branchReturnValue = new DsBranches(); //OrganisationReturnValue organisationReturnValue = new OrganisationReturnValue(); //dsDepartments departmentReturnValue = new dsDepartments(); //DsWorkTypes workTypeReturnValue = new DsWorkTypes(); //EarnerReturnValue earnerReturnValue = new EarnerReturnValue(); //DsPersons personReturnValue = new DsPersons(); 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"); } dsBranchReturnValue = SrvBranchLookup.GetBranch(orgId); branchReturnValue.Branch.BranchArchived = dsBranchReturnValue.Tables[0].Rows[0]["BranchArchived"].ToString(); branchReturnValue.Branch.BranchCdsReg = int.Parse(dsBranchReturnValue.Tables[0].Rows[0]["BranchCdsReg"].ToString()); branchReturnValue.Branch.BranchCdsVersion = dsBranchReturnValue.Tables[0].Rows[0]["BranchCdsVersion"].ToString(); branchReturnValue.Branch.BranchCivilContractNo = dsBranchReturnValue.Tables[0].Rows[0]["BranchCivilContractNo"].ToString(); branchReturnValue.Branch.BranchCompanyName = dsBranchReturnValue.Tables[0].Rows[0]["BranchCompanyName"].ToString(); branchReturnValue.Branch.BranchCreditAccountKey = dsBranchReturnValue.Tables[0].Rows[0]["BranchCreditAccountKey"].ToString(); branchReturnValue.Branch.BranchLondonRate = dsBranchReturnValue.Tables[0].Rows[0]["BranchLondonRate"].ToString(); branchReturnValue.Branch.BranchLSCYear = dsBranchReturnValue.Tables[0].Rows[0]["BranchLSCYear"].ToString(); branchReturnValue.Branch.BranchNetId = dsBranchReturnValue.Tables[0].Rows[0]["BranchNetId"].ToString(); branchReturnValue.Branch.BranchNoVAT = dsBranchReturnValue.Tables[0].Rows[0]["BranchNoVAT"].ToString(); branchReturnValue.Branch.BranchPsiId = dsBranchReturnValue.Tables[0].Rows[0]["BranchPsiId"].ToString(); branchReturnValue.Branch.BranchRef = dsBranchReturnValue.Tables[0].Rows[0]["BranchRef"].ToString(); branchReturnValue.Branch.BranchStarsId = dsBranchReturnValue.Tables[0].Rows[0]["BranchStarsId"].ToString(); branchReturnValue.Branch.BranchSupNum1 = dsBranchReturnValue.Tables[0].Rows[0]["BranchSupNum1"].ToString(); branchReturnValue.Branch.BranchVatPeriodEnd = dsBranchReturnValue.Tables[0].Rows[0]["BranchVatPeriodEnd"].ToString(); branchReturnValue.Branch.BranchCivilUnifiedContract = dsBranchReturnValue.Tables[0].Rows[0]["BranchCivilUnifiedContract"].ToString(); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { branchReturnValue.Success = false; branchReturnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { branchReturnValue.Success = false; branchReturnValue.Message = ex.Message; } return branchReturnValue; }
public BranchReturnValue GetBranch(Guid logonId, Guid orgId) { DsBranches dsBranchReturnValue = new DsBranches(); BranchReturnValue branchReturnValue = new BranchReturnValue(); branchReturnValue.Branch = new Branch(); //DsBranches branchReturnValue = new DsBranches(); //OrganisationReturnValue organisationReturnValue = new OrganisationReturnValue(); //dsDepartments departmentReturnValue = new dsDepartments(); //DsWorkTypes workTypeReturnValue = new DsWorkTypes(); //EarnerReturnValue earnerReturnValue = new EarnerReturnValue(); //DsPersons personReturnValue = new DsPersons(); 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"); } dsBranchReturnValue = SrvBranchLookup.GetBranch(orgId); branchReturnValue.Branch.BranchArchived = dsBranchReturnValue.Tables[0].Rows[0]["BranchArchived"].ToString(); branchReturnValue.Branch.BranchCdsReg = int.Parse(dsBranchReturnValue.Tables[0].Rows[0]["BranchCdsReg"].ToString()); branchReturnValue.Branch.BranchCdsVersion = dsBranchReturnValue.Tables[0].Rows[0]["BranchCdsVersion"].ToString(); branchReturnValue.Branch.BranchCivilContractNo = dsBranchReturnValue.Tables[0].Rows[0]["BranchCivilContractNo"].ToString(); branchReturnValue.Branch.BranchCompanyName = dsBranchReturnValue.Tables[0].Rows[0]["BranchCompanyName"].ToString(); branchReturnValue.Branch.BranchCreditAccountKey = dsBranchReturnValue.Tables[0].Rows[0]["BranchCreditAccountKey"].ToString(); branchReturnValue.Branch.BranchLondonRate = dsBranchReturnValue.Tables[0].Rows[0]["BranchLondonRate"].ToString(); branchReturnValue.Branch.BranchLSCYear = dsBranchReturnValue.Tables[0].Rows[0]["BranchLSCYear"].ToString(); branchReturnValue.Branch.BranchNetId = dsBranchReturnValue.Tables[0].Rows[0]["BranchNetId"].ToString(); branchReturnValue.Branch.BranchNoVAT = dsBranchReturnValue.Tables[0].Rows[0]["BranchNoVAT"].ToString(); branchReturnValue.Branch.BranchPsiId = dsBranchReturnValue.Tables[0].Rows[0]["BranchPsiId"].ToString(); branchReturnValue.Branch.BranchRef = dsBranchReturnValue.Tables[0].Rows[0]["BranchRef"].ToString(); branchReturnValue.Branch.BranchStarsId = dsBranchReturnValue.Tables[0].Rows[0]["BranchStarsId"].ToString(); branchReturnValue.Branch.BranchSupNum1 = dsBranchReturnValue.Tables[0].Rows[0]["BranchSupNum1"].ToString(); branchReturnValue.Branch.BranchVatPeriodEnd = dsBranchReturnValue.Tables[0].Rows[0]["BranchVatPeriodEnd"].ToString(); branchReturnValue.Branch.BranchCivilUnifiedContract = dsBranchReturnValue.Tables[0].Rows[0]["BranchCivilUnifiedContract"].ToString(); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { branchReturnValue.Success = false; branchReturnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { branchReturnValue.Success = false; branchReturnValue.Message = ex.Message; } return(branchReturnValue); }
/// <summary> /// Gets the client bank Id, office bank Id and partner member Id based on the branch and dept id /// </summary> /// <param name="oHostSecurityToken">The Host Security Token from IWS</param> /// <param name="branchOrganisationId">The branch organisation id.</param> /// <param name="departmentId">The department id.</param> /// <returns></returns> public BranchReturnValue GetBranch(HostSecurityToken oHostSecurityToken, Guid orgId) { BranchReturnValue branchReturnValue = new BranchReturnValue(); if (Functions.ValidateIWSToken(oHostSecurityToken)) { oBranchDeptService = new BranchDeptService(); branchReturnValue = oBranchDeptService.GetBranch(Functions.GetLogonIdFromToken(oHostSecurityToken), orgId); } else { branchReturnValue = new BranchReturnValue(); branchReturnValue.Success = false; branchReturnValue.Message = "Invalid Token"; } return branchReturnValue; }