public UserReturnValue GetUser(Guid logonId, Guid memberId) { //UserReturnValue userReturnValue = new UserReturnValue(); DsSystemUsersAll systemUserReturnValue = new DsSystemUsersAll(); UserReturnValue userReturnValue = new UserReturnValue(); userReturnValue.User = new User(); //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"); } systemUserReturnValue = SrvUserCommon.GetSystemUser(); userReturnValue.User.Forename = systemUserReturnValue.Tables[0].Rows[0]["Forename"].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) { userReturnValue.Success = false; userReturnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { userReturnValue.Success = false; userReturnValue.Message = ex.Message; } return userReturnValue; }
public UserReturnValue GetUser(Guid logonId, Guid memberId) { //UserReturnValue userReturnValue = new UserReturnValue(); DsSystemUsersAll systemUserReturnValue = new DsSystemUsersAll(); UserReturnValue userReturnValue = new UserReturnValue(); userReturnValue.User = new User(); //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"); } systemUserReturnValue = SrvUserCommon.GetSystemUser(); userReturnValue.User.Forename = systemUserReturnValue.Tables[0].Rows[0]["Forename"].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) { userReturnValue.Success = false; userReturnValue.Message = Functions.SQLErrorMessage; } catch (Exception ex) { userReturnValue.Success = false; userReturnValue.Message = ex.Message; } return(userReturnValue); }