/// <summary> /// Gets the matter type id for the project. /// </summary> /// <param name="logonId">Logon id obtained when logging on to the logon service.</param> /// <param name="projectId">The project id.</param> /// <returns></returns> public MatterTypeReturnValue GetMatterTypeId(Guid logonId, Guid projectId) { MatterTypeReturnValue returnValue = new MatterTypeReturnValue(); 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: if (!SrvMatterCommon.WebAllowedToAccessMatter(projectId)) throw new Exception("Access denied"); break; default: throw new Exception("Access denied"); } returnValue.MatterTypeId = SrvMatterCommon.GetMatterTypeId(projectId); } 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 matter type id for the project. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="projectId">The project id.</param> /// <returns></returns> public MatterTypeReturnValue GetMatterTypeId(HostSecurityToken oHostSecurityToken, Guid projectId) { MatterTypeReturnValue returnValue = new MatterTypeReturnValue(); if (Functions.ValidateIWSToken(oHostSecurityToken)) { oMatterService = new MatterService(); returnValue = oMatterService.GetMatterTypeId(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { returnValue = new MatterTypeReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }