public TimeTransactionReturnValue GetTimeTransaction(HostSecurityToken oHostSecurityToken, Guid projectId) { TimeTransactionReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.GetTimeTransaction(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { returnValue = new TimeTransactionReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public TimeTransactionReturnValue GetTimeTransaction(Guid logonId, Guid projectId) { TimeTransactionReturnValue returnValue = new TimeTransactionReturnValue(); 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"); } // Create a data list creator for a list DataListCreator<TimeTransaction> dataListCreator = new DataListCreator<TimeTransaction>(); Collection<SrvTimeTransaction> transactions = SrvDraftBillCommon.GetTimeTransaction(projectId); returnValue.Transactions = dataListCreator.Create<SrvTimeTransaction>(transactions, new ImportMapping[] { new ImportMapping("Date", "TimeDate"), new ImportMapping("FeeEarner", "FeeReference"), new ImportMapping("Description", "TimeTypeDescription"), new ImportMapping("Charge", "TimeCharge"), new ImportMapping("Cost", "TimeCost"), new ImportMapping("TimeId", "TimeId"), new ImportMapping("Time", "TimeElapsed") }); } 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; }
public TimeTransactionReturnValue GetTimeTransaction(HostSecurityToken oHostSecurityToken, Guid projectId) { TimeTransactionReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oAccountService = new AccountsService(); returnValue = oAccountService.GetTimeTransaction(Functions.GetLogonIdFromToken(oHostSecurityToken), projectId); } else { returnValue = new TimeTransactionReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }