Click or drag to resize

ServiceRouterAddUserTimeNonWorkShift Method

Returns a AddUserTimeNonWorkShiftOut response with a result model List<AddResult>

Namespace: AppOne.Services.V2
Assembly: AppOne.Web.Service (in AppOne.Web.Service.dll) Version: 1.0.141
Syntax
public AddUserTimeNonWorkShiftOut AddUserTimeNonWorkShift(
	AddUserTimeNonWorkShiftIn input
)

Parameters

input  AddUserTimeNonWorkShiftIn
A new AddUserTimeNonWorkShiftIn object

Return Value

AddUserTimeNonWorkShiftOut
A AddUserTimeNonWorkShiftOut object
Remarks
Use this method to add a list of AddUserTimeNonWorkShiftModel which contains the result for add a users non-work punch

ValidationType Options

NameDescription
BASIC This action will do minimal validation and is recommended if you do not want do full validation checking. The validation for this mode includes:
- Validation of the EmpIdentifier
- Currently only 'BASCIC' is supported
Note  Note
Business Rules:
Adding punches and non-work punches is the core of the time-web system. The WSUserTimeNonWorkShift class encapsulate the needed methods/operations to interact with a users non-work shift data.

Setup:
Manager > Time Cards

Example
JSON Request
{
    "AuthToken":"...",
    "ValidationType":"BASIC",
    "ProcessingMode":"REAL-TIME",    
    "Payload":[{
        "EmpIdentifier":"1234",
        "GeoLatitude":1.267,
        "GeoLongitude":1.4,
        "GeoValidate":true,
        "LaborLevelIDs":{
            "LL01ID":0,
            "LL02ID":0,
            "LL03ID":0,
            "LL04ID":0
        },
        "NotesEmp":"String_Content",
        "NotesMgr":"String_Content",
        "PayTypeID":9,
        "TransactionDateTime":"\/Date(1486506345483)\/",
        "TransactionHours":1.5,
        "WebKioskTerminalID":1
    }]
}
JSON Response
{
   "Report":    {
      "APIVersion": "2.0",
      "ProcessTime": "0.1612689",
      "RequestTime": "/Date(1486507266361-0700)/",
      "ResponseTime": "/Date(1486507266522-0700)/",
      "Results": 2
   },
   "Results":    [
      {
         "ID": 1156,
         "Messages": ["PASS: Transaction for StartNonWork Added successfully at 2/7/2017 10:25:45 PM"],
         "Status": 1
      },
      {
         "ID": 1157,
         "Messages": ["PASS: Transaction for EndNonWork Added successfully at 2/7/2017 11:55:45 PM"],
         "Status": 1
      }
   ]
}
SOAP: C# WCF Sample
 public void V2_AddUserTimeNonWorkShiftRequest_SOAP_Test()
{
    try
    {
        var actionTestLogic = new Action<SoapServiceV2.ServiceRouterClient>((client) =>
        {

            //TEST 1: BASIC VALIDATION WITH DEFAULT PROCESSING MODE
            bool pass = false;
            SoapServiceV2.AddUserTimeNonWorkShiftRequest request = new SoapServiceV2.AddUserTimeNonWorkShiftRequest();
            List<AddUserTimeNonWorkShiftModel> payLoad = new List<AddUserTimeNonWorkShiftModel>();

            AddUserTimeNonWorkShiftModel payLoadItem1 = new AddUserTimeNonWorkShiftModel
            {
                EmpIdentifier = ConfigurationManager.AppSettings["Test.UserInfo.EmpIdentifier"],
                GeoLatitude = 0,
                GeoLongitude = 0,
                GeoValidate = false,
                NotesEmp = "Emp Notes",
                NotesMgr = "Mgr Notes",
                PayTypeID = 1,
                ProcessingMode = "Default",
                TransactionDateTime = ChangeTime(DateTime.Now.AddDays(-2), 8, 0, 0, 0),
                TransactionHours = 8.3,
                WebKioskTerminalID = 0
            };

            payLoad.Add(payLoadItem1);

            request.input = new AddUserTimeNonWorkShiftIn
            {
                AuthToken = AuthToken,
                ValidationType = "BASIC",
                Payload = payLoad
            };

            AddUserTimeNonWorkShiftResponse response = client.AddUserTimeNonWorkShift(request);
            pass = (response.AddUserTimeNonWorkShiftResult.Results != null && response.AddUserTimeNonWorkShiftResult.Results.Select(p => p.Status).Contains(AddResultStatus.Success)) 
                    ? true : false;
            Assert.IsTrue(pass);

            //STRICT VALIDATION WITH REAL TIME PROCESSING MODE
            pass = false;
            request = new SoapServiceV2.AddUserTimeNonWorkShiftRequest();
            payLoad = new List<AddUserTimeNonWorkShiftModel>();

            payLoad.Add(new AddUserTimeNonWorkShiftModel
            {
                EmpIdentifier = ConfigurationManager.AppSettings["Test.UserInfo.EmpIdentifier"],
                GeoLatitude = 12.9330,
                GeoLongitude = 77.6148,
                GeoValidate = true,
                NotesEmp = "SAOP Emp Notes",
                NotesMgr = "SAOP Mgr Notes",
                PayTypeID = 1,
                ProcessingMode = "Real-time",
                TransactionDateTime = ChangeTime(DateTime.Now.AddDays(-3), 8, 0, 0, 0),
                TransactionHours = 9.3,
                WebKioskTerminalID = 4
            });

            request.input = new AddUserTimeNonWorkShiftIn
            {
                AuthToken = AuthToken,
                ValidationType = "STRICT-1",
                Payload = payLoad
            };

            response = client.AddUserTimeNonWorkShift(request);
            pass = (response.AddUserTimeNonWorkShiftResult.Results != null && response.AddUserTimeNonWorkShiftResult.Results.Select(p => p.Status).Contains(AddResultStatus.Success)) ? true : false;
            Assert.IsTrue(pass);

        });

        RunServiceClient(actionTestLogic);
    }
    catch (FaultException<SoapServiceV2.ServiceException> fe)
    {
        Assert.Fail(fe.Detail.Message);
    }
}
See Also