CreateEmployeeWithUser

This call adds one or more employee records in PureSafety and also adds PureSafety user names and passwords for each new record.

The new employee record includes the following information:
  • Employee code
  • Employee's first name
  • Employee's last name
  • Employee's PureSafety user name
  • Employee's PureSafety password
Information Employee Web Service 1 Employee Web Service

Usage

Use this call if you want to create user login information in the PureSafety when creating new employee records through the Employee Web Services.

Use this call if you want to create user login information in the PureSafety when creating new employee records through the Employee Web Services.

Syntax

CreateEmployeeWithUser(UserLoginWebServiceEntity userLoginWebServiceEntity, string firstName, string lastName, string employeeCode, string loginName, string loginPassword, bool isActive, bool forcePasswordChange)

CreateEmployeeWithUser(UserLoginWebServiceEntity userLoginWebServiceEntity, string firstName, string lastName, string employeeCode, string loginName, string loginPassword, bool isActive, bool forcePasswordChange, string language, string timeZone)

Fields

Required Fields

  • WebServiceLoginName
  • WebServiceLoginPassword
  • EmployeeCode
  • FirstName
  • LastName
  • LoginName
  • LoginPassword
  • IsActive
  • ForcePasswordChange
  • WebServiceLoginName
  • WebServiceLoginPassword
  • EmployeeCode
  • FirstName
  • LastName
  • LoginName
  • LoginPassword
  • IsActive
  • ForcePasswordChange
  • Language
  • Time Zone

Response

  • True if successful
  • False if there were errors
  • True if successful
  • False if there were errors

Sample Code - C# (Employee Web Service 1)

public void Sample()
{
    UserLoginWebServiceEntity userLoginWebServiceEntity = new UserLoginWebServiceEntity();
        
    userLoginWebServiceEntity.WebServiceLoginName = "username";
	userLoginWebServiceEntity.WebServiceLoginPassword = "password";
    
	string employeeCode = "JB01";
	string firstName = "Jim";
	string lastName = "Bob";
	string loginName = "jim.bob";
	string loginPassword = "Password123!";
	bool isActive = true;
    bool forcePasswordChange = false;
	    
    // Invoke the call  
    
    try
    {
		EmployeeWebServiceContractClient employeeWebService = new EmployeeWebServiceContractClient();
        employeeWebService.CreateEmployeeWithUser(userLoginWebServiceEntity, firstName, lastName, employeeCode, loginName, loginPassword, isActive, forcePasswordChange);
    }
    catch (Exception e)
    {
        Console.WriteLine(e.Message);
    }
}   

Sample Code - C# (Employee Web Service 2)

public void CSharpSample() {
			UserLoginWebServiceEntity userLoginWebServiceEntity = new UserLoginWebServiceEntity() {
					WebServiceLoginName = "username",
					WebServiceLoginPassword = "password"
			};
			try {
				EmployeeWebServiceContractClient employeeWebService = new EmployeeWebServiceContractClient();
				// Invoke the call
				if (!employeeWebService.CreateEmployeeWithUser(
						userLoginWebServiceEntity, 
						"Jim",
						"Bob",
						"JB01",
						"jim.bob",
						"Password123!",
						true,
						false,
						"English",					//NEW for v2
						"Central Standard Time")	//NEW for v2
					)
					throw new Exception("Method call was not successful.");
			} catch (FaultException<PureSafetyFaultDetail> detail) {
				Console.WriteLine(String.Format("ErrorCode: {0}, ErrorDescription: {1}", detail.Detail.ErrorCode, detail.Detail.ErrorDescription));
			} catch (Exception ex) {
				Console.WriteLine(ex.Message);
			}
		}  

Sample Code - Java (Employee Web Service 1)

public void JavaSample()
{
UserLoginWebServiceEntity userLoginWebServiceEntity = 
new UserLoginWebServiceEntity("username","password");

String employeeCode = "JB01";
String firstName = "Jim";
String lastName = "Bob";
String loginName = "jim.bob";
String loginPassword = "Password123!";
boolean isActive = true;
boolean forcePasswordChange = false;

try {	// Invoke the call
EmployeeWebServiceLocator locator = new EmployeeWebServiceLocator();
EmployeeWebServiceContract employeeWebService = locator.getbasicEndpoint();
       employeeWebService.createEmployeeWithUser(
		userLoginWebServiceEntity, 
		firstName,
		lastName,
		employeeCode,
		loginName,
		loginPassword,
		isActive,
		forcePasswordChange
);
}
catch (Exception e) {
e.printStackTrace();
}
}

Sample Code - Java (Employee Web Service 2)

public void JavaExample() {
		UserLoginWebServiceEntity userLoginWebServiceEntity = new UserLoginWebServiceEntity (
				"username",
				"password"
		);
		try { //Invoke the call
			EmployeeWebServiceLocator locator = new EmployeeWebServiceLocator();
			EmployeeWebServiceContract employeeWebService = locator.getbasicEndpoint();
			if (!employeeWebService.createEmployeeWithUser(
					userLoginWebServiceEntity, 
					"Jim",
					"Bob",
					"JB01",
					"jim.bob",
					"Password123!",
					true,
					false,
					"English",					//NEW for v2
					"Central Standard Time")	//NEW for v2
				)
				throw new Exception("Method call was not successful.");
		} catch (PureSafetyFaultDetail detail) {				
			System.out.println(String.format("ErrorCode: %s, ErrorDescription: %s", detail.getErrorCode(), detail.getErrorDescription()));
		} catch (Exception ex) {
			System.out.println(ex.getMessage());
		}
	}