/// <summary> /// Get details about User. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="UserIds">Array of user ids</param> /// <returns></returns> public WorkTypeReturnValue GetWorkType(HostSecurityToken oHostSecurityToken, Guid workTypeId) { WorkTypeReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oUtilitiesService = new UtilitiesService(); returnValue = oUtilitiesService.GetWorkType(Functions.GetLogonIdFromToken(oHostSecurityToken), workTypeId); } else { returnValue = new WorkTypeReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return(returnValue); }
public WorkTypeReturnValue GetWorkType(Guid logonId, Guid workTypeId) { //UserReturnValue userReturnValue = new UserReturnValue(); DsWorkTypes dsWorkTypeReturnValue = new DsWorkTypes(); WorkTypeReturnValue workTypeReturnValue = new WorkTypeReturnValue(); workTypeReturnValue.WorkType = new WorkType(); //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"); } dsWorkTypeReturnValue = SrvWorkTypeLookup.GetWorkTypesOnWorkTypeId(workTypeId); workTypeReturnValue.WorkType.ApplicationID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["ApplicationID"].ToString()); workTypeReturnValue.WorkType.BillingCodeCategoryID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["BillingCodeCategoryID"].ToString()); workTypeReturnValue.WorkType.ChargeDescID = Guid.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["ChargeDescID"].ToString()); workTypeReturnValue.WorkType.CLHeaderID = Guid.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["CLHeaderID"].ToString()); workTypeReturnValue.WorkType.DeptNo = dsWorkTypeReturnValue.Tables[0].Rows[0]["DeptNo"].ToString(); workTypeReturnValue.WorkType.ExtendedInfoTypeDefaultCatID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["ExtendedInfoTypeDefaultCatID"].ToString()); workTypeReturnValue.WorkType.ExtInfoTypeDefaultCatName = dsWorkTypeReturnValue.Tables[0].Rows[0]["ExtInfoTypeDefaultCatName"].ToString(); workTypeReturnValue.WorkType.NominalID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["NominalID"].ToString()); workTypeReturnValue.WorkType.WorkCatID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkCatID"].ToString()); workTypeReturnValue.WorkType.WorkTypeArchived = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeArchived"].ToString(); workTypeReturnValue.WorkType.WorkTypeCode = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeCode"].ToString(); workTypeReturnValue.WorkType.WorkTypeDept = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeDept"].ToString()); workTypeReturnValue.WorkType.WorkTypeDescription = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeDescription"].ToString(); workTypeReturnValue.WorkType.WorkTypeDisbLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeDisbLimit"].ToString(); workTypeReturnValue.WorkType.WorkTypeID = Guid.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeID"].ToString()); workTypeReturnValue.WorkType.WorkTypeIsLA = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeIsLA"].ToString(); workTypeReturnValue.WorkType.WorkTypeOverallLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeOverallLimit"].ToString(); workTypeReturnValue.WorkType.WorkTypeQuote = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeQuote"].ToString(); workTypeReturnValue.WorkType.WorkTypeTimeLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeTimeLimit"].ToString(); workTypeReturnValue.WorkType.WorkTypeWipLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeWipLimit"].ToString(); //userReturnValue.User.Lastname = systemUserReturnValue.Tables[0].Rows[0]["Lastname"].ToString(); //userReturnValue.User.MemOrOrgId = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["MemOrOrgId"].ToString()); //userReturnValue.User.Name = systemUserReturnValue.Tables[0].Rows[0]["Name"].ToString(); //userReturnValue.User.Title = systemUserReturnValue.Tables[0].Rows[0]["Title"].ToString(); //userReturnValue.User.Uid = int.Parse(systemUserReturnValue.Tables[0].Rows[0]["Uid"].ToString()); //userReturnValue.User.UserDefaBranch = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaBranch"].ToString()); //userReturnValue.User.UserDefaDepartment = int.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaDepartment"].ToString()); //userReturnValue.User.UserDefaEarner = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaEarner"].ToString()); //userReturnValue.User.UserDefaPartner = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaPartner"].ToString()); //userReturnValue.User.UserDefaWorkType = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaWorkType"].ToString()); //userReturnValue.User.UserType = int.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserType"].ToString()); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { workTypeReturnValue.Success = false; workTypeReturnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { workTypeReturnValue.Success = false; workTypeReturnValue.Message = ex.Message; } return workTypeReturnValue; }
/// <summary> /// Get details about User. /// </summary> /// <param name="oHostSecurityToken">HostSecurityToken obtained when security provider of IWS is called</param> /// <param name="UserIds">Array of user ids</param> /// <returns></returns> public WorkTypeReturnValue GetWorkType(HostSecurityToken oHostSecurityToken, Guid workTypeId) { WorkTypeReturnValue returnValue = null; if (Functions.ValidateIWSToken(oHostSecurityToken)) { oUtilitiesService = new UtilitiesService(); returnValue = oUtilitiesService.GetWorkType(Functions.GetLogonIdFromToken(oHostSecurityToken), workTypeId); } else { returnValue = new WorkTypeReturnValue(); returnValue.Success = false; returnValue.Message = "Invalid Token"; } return returnValue; }
public WorkTypeReturnValue GetWorkType(Guid logonId, Guid workTypeId) { //UserReturnValue userReturnValue = new UserReturnValue(); DsWorkTypes dsWorkTypeReturnValue = new DsWorkTypes(); WorkTypeReturnValue workTypeReturnValue = new WorkTypeReturnValue(); workTypeReturnValue.WorkType = new WorkType(); //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"); } dsWorkTypeReturnValue = SrvWorkTypeLookup.GetWorkTypesOnWorkTypeId(workTypeId); workTypeReturnValue.WorkType.ApplicationID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["ApplicationID"].ToString()); workTypeReturnValue.WorkType.BillingCodeCategoryID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["BillingCodeCategoryID"].ToString()); workTypeReturnValue.WorkType.ChargeDescID = Guid.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["ChargeDescID"].ToString()); workTypeReturnValue.WorkType.CLHeaderID = Guid.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["CLHeaderID"].ToString()); workTypeReturnValue.WorkType.DeptNo = dsWorkTypeReturnValue.Tables[0].Rows[0]["DeptNo"].ToString(); workTypeReturnValue.WorkType.ExtendedInfoTypeDefaultCatID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["ExtendedInfoTypeDefaultCatID"].ToString()); workTypeReturnValue.WorkType.ExtInfoTypeDefaultCatName = dsWorkTypeReturnValue.Tables[0].Rows[0]["ExtInfoTypeDefaultCatName"].ToString(); workTypeReturnValue.WorkType.NominalID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["NominalID"].ToString()); workTypeReturnValue.WorkType.WorkCatID = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkCatID"].ToString()); workTypeReturnValue.WorkType.WorkTypeArchived = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeArchived"].ToString(); workTypeReturnValue.WorkType.WorkTypeCode = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeCode"].ToString(); workTypeReturnValue.WorkType.WorkTypeDept = int.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeDept"].ToString()); workTypeReturnValue.WorkType.WorkTypeDescription = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeDescription"].ToString(); workTypeReturnValue.WorkType.WorkTypeDisbLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeDisbLimit"].ToString(); workTypeReturnValue.WorkType.WorkTypeID = Guid.Parse(dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeID"].ToString()); workTypeReturnValue.WorkType.WorkTypeIsLA = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeIsLA"].ToString(); workTypeReturnValue.WorkType.WorkTypeOverallLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeOverallLimit"].ToString(); workTypeReturnValue.WorkType.WorkTypeQuote = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeQuote"].ToString(); workTypeReturnValue.WorkType.WorkTypeTimeLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeTimeLimit"].ToString(); workTypeReturnValue.WorkType.WorkTypeWipLimit = dsWorkTypeReturnValue.Tables[0].Rows[0]["WorkTypeWipLimit"].ToString(); //userReturnValue.User.Lastname = systemUserReturnValue.Tables[0].Rows[0]["Lastname"].ToString(); //userReturnValue.User.MemOrOrgId = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["MemOrOrgId"].ToString()); //userReturnValue.User.Name = systemUserReturnValue.Tables[0].Rows[0]["Name"].ToString(); //userReturnValue.User.Title = systemUserReturnValue.Tables[0].Rows[0]["Title"].ToString(); //userReturnValue.User.Uid = int.Parse(systemUserReturnValue.Tables[0].Rows[0]["Uid"].ToString()); //userReturnValue.User.UserDefaBranch = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaBranch"].ToString()); //userReturnValue.User.UserDefaDepartment = int.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaDepartment"].ToString()); //userReturnValue.User.UserDefaEarner = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaEarner"].ToString()); //userReturnValue.User.UserDefaPartner = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaPartner"].ToString()); //userReturnValue.User.UserDefaWorkType = Guid.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserDefaWorkType"].ToString()); //userReturnValue.User.UserType = int.Parse(systemUserReturnValue.Tables[0].Rows[0]["UserType"].ToString()); } finally { // Remove the logged on user's ApplicationSettings from the // list of concurrent sessions Host.UnloadLoggedOnUser(); } } catch (System.Data.SqlClient.SqlException) { workTypeReturnValue.Success = false; workTypeReturnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { workTypeReturnValue.Success = false; workTypeReturnValue.Message = ex.Message; } return(workTypeReturnValue); }