Click or drag to resize
EmployeeService

[This is preliminary documentation and is subject to change.]

The EmployeeService web service contains web methods concerned with managing the employees in a specific configuration.

Employee Service
Employee Service
CreateOrUpdateEmployee method

The CreateOrUpdateEmployee methods creates new employees (or if an employee with the given username and domain already exists updates it) in the specified configuration.

C#
public void CreateOrUpdateEmployee(string config, Guid sessionGuid, Employee employee, ProfileCollection profiles, OrgUnitCollection associatedOrgUnits)
CreateEmployee method

Create new employee in specified configuration (if employee with given username and domain already exist nothing is done).

C#
public void CreateEmployee(string config, Guid sessionGuid, Employee employee, ProfileCollection profiles, OrgUnitCollection associatedOrgUnits)
UpdateEmployee method

Update employee in specified configuration (if employee with given username and domain doesn't already exist nothing is done).

C#
public void UpdateEmployee(string config, Guid sessionGuid, Employee employee, ProfileCollection profiles, OrgUnitCollection associatedOrgUnits)
ReadEmployee method

Read employee from specified configuration. Null is returned if the employee was not found

C#
public Employee ReadEmployee(string config, Guid sessionGuid, string domain, string userName)
SearchEmployeesByAssociated method

Search for employees with associated with the one or more of the organizational units as the logged in user. Search in specified configuration

C#
public EmployeeCollection SearchEmployeesByAssociated(string config, Guid sessionGuid, bool includeDeleted, bool includeHidden, bool includeInactive, string filterDomain, string filterUserName, string filterFirstName, string filterLastName, bool descending)
SearchEmployeesByEmployer method

Search for employees with same employer as the logged in user. Search in specified configuration

C#
public EmployeeCollection SearchEmployeesByEmployer(string config, Guid sessionGuid, bool includeDeleted, bool includeHidden, bool includeInactive, string filterDomain, string filterUserName, string filterFirstName, string filterLastName, bool descending)
GetProfileNames method

Get the names of all profiles in the specified configuration.

C#
public List<string> GetProfileNames(string config, Guid sessionGuid)
UpdatePassword method

Update the password of the user (i.e. the user calling this web service).

C#
public PasswordUpdateStatus UpdatePassword(string config, Guid sessionGuid, string oldPassword, string newPassword, string newPasswordConfirm)
CreateOrUpdateEmployeeLoginWithPlainPassword method

The CreateOrUpdateEmployeeLoginWithPlainPassword methods logs in with plain password and create new employee in specified configuration (or if employee with given username and domain already exists update it).

C#
public void CreateOrUpdateEmployeeLoginWithPlainPassword(string config, string domain, string userName, string password, bool contextManager, Employee employee, ProfileCollection profiles, OrgUnitCollection associatedOrgUnits, string parentType, string parentCode)
CreateOrUpdateEmployeeLoginWithHashedPassword method

The CreateOrUpdateEmployeeLoginWithHashedPassword methods logs in with hashed password and create new employee in specified configuration (or if employee with given username and domain already exists update it).

C#
public void CreateOrUpdateEmployeeLoginWithHashedPassword(string config, string domain, string userName, string passwordHash, bool contextManager, Employee employee, ProfileCollection profiles, OrgUnitCollection associatedOrgUnits, string parentType, string parentCode)
CreateOrUpdateEmployeeLoginWithNoPassword method

The CreateOrUpdateEmployeeLoginWithNoPassword methods logs in with blank password and create new employee in specified configuration (or if employee with given username and domain already exists update it.").

C#
public void CreateOrUpdateEmployeeLoginWithNoPassword(string config, string domain, string userName, string validationString, Employee employee, ProfileCollection profiles, OrgUnitCollection associatedOrgUnits, string parentType, string parentCode)
Using EmployeeSerivce web service

In the following example we login and create a user on a specific configuration

C#
// CreateOrUpdateEmployee method example

string config = "GOP";                        // or "Projektdata" - name of configuration
string domain = "1351";                        // domain for the user we login with
string username = "Admin1351";                // username for the user we login with
string password = "secret";                    // password for the user we login with

//first we login with a user that can create other users
LoginService loginService = new LoginService();
LogOnInfo logOnInfo = loginService.LogInPlainPassword(config, domain, username, password, false);

if (logOnInfo.Status != LogOnStatus.Ok)
return; // could not log on

// then we create an employee object for the employee we wish to create (or update)
Employee employee = new Employee();
employee.Domain = "myDomain";                // domain of new user
employee.Username = "someUser":                // username of new user
employee.OrgUnitCode = "1351";                // organizational code (SKS code) of new user
employee.OrgUnitType = "sgh";                // organizational type (SKS type) of new user
employee.Password = "somePassword";            // password for the new user

// then we create some profiles for the new user
Profile profile1 = new Profile { Name = "ReadGOP"};
Profile profile2 = new Profile { Name = "EditGOP"};
Profile[] profiles = {profile1, profile2};

// then we create some associated org units for the new user
OrgUnit associatedOrgUnit1 = new OrgUnit{Code="135103", Type="afd"};
OrgUnit associatedOrgUnit2 = new OrgUnit{Code="135102", Type="afd"};
OrgUnit[] associatedOrgUnits = {associatedOrgUnit1, associatedOrgUnit2};

// and finally we create the new user (or update existing)
EmployeeService employeeService = new EmployeeService();
employeeService.CreateOrUpdateEmployee(logOnInfo.ConfigName, logOnInfo.SessionGuid,
employee, profiles, associatedOrganizationalUnits);