Click or drag to resize

WSTimeUpdateUserTimePunch Method

Updates a Punch that already exists in the system and returns a UpdateUserTimePunchOut response with a result model List<UpdateUserTimePunchResult>

Namespace: AppOne.Services.V2.Methods
Assembly: AppOne.Web.Service (in AppOne.Web.Service.dll) Version: 1.0.141
Syntax
public UpdateUserTimePunchOut UpdateUserTimePunch(
	UpdateUserTimePunchIn input
)

Parameters

input  UpdateUserTimePunchIn
A new UpdateUserTimePunchIn object

Return Value

UpdateUserTimePunchOut
A UpdateUserTimePunchOut object
Remarks
Use this method to update up to 50 punches at one time that already exist in the system. The punches can be for one employee or multiple employees. Each update is represented by a UpdateUserTimePunchObject consisting of:

An ID that you specify (the best practice recommendation is to autonumber each transaction). This can be an unique number and has no reference to the Time record being updated. The number only needs to be unique for each call to the web service. It is entirely acceptable to start with an ID of 1 each time you send a request. This result is echoed back in the response to indicate the status of the update.

An OriginalPunch object which is used by the system to find the punch that is being updated

An PunchUpdates object which represents the updates that will be made to the punch found using the information in the OriginalPunch info.

Note  Note
Please note the following

1. This endpoint searches by looking for a transaction within the same minute specified in the TransactionDateTime. This time should be passed in as though the employee is located in the UTC timezone. The conversion to The EE Timezone when saving the record is done by the system.

For example: Entering an Epoch Milliseconds value of 1688202000000 will look for a punch on the user time card of Saturday, "July 1, 2023 9:00:00 AM" in the employee time zone (no matter what time zone the employee is in)

2. Either the Badge # or the EmpIdentifier should be specified in the OriginalPunchInfo - sending both will result in an error message being returned.

3. When specifying values to be changed - a value of an empty string for a Labor Level will be interpreted as an intent to unassign the labor level. If you wish to not change a value you may set its value to null and it will be ignored.

4. This endpoint only allows existing punches to be updated. It does not delete or add punches to the system.
Note  Note
Business Rules:
Punching in and out is the core of the time-web system. The WSTime class encapsulate the needed methods/operations to interact with a users time entry. Users can be assigned to different preferences and policies. These policies are what will affect the results of a users time entry into the system.

Setup:
Employee > Dashboard
Manager > Time Cards

Example
JSON Request
{
    "AuthToken": "VXBkYXRlVXNlclRpbWVQdW5jaC1TYW1wbGUtSlNPTi1JTg==",
    "RecordsToUpdate": [
        {
            "ID": 1,
            "OriginalPunch": {
                "TransactionDateTime": "\/Date(1689152400000)\/",
                "EmpIdentifier": "adm",
                "BadgeNumber": "",
                "TransactionType": 2
            },
            "PunchUpdates": {
                "LaborLevel1": "1",
                "LaborLevel2": "5",
                "LaborLevel3": null,
                "LaborLevel4": null,
                "LaborLevel5": null,
                "LaborLevel6": null,
                "LaborLevel7": null,
                "LaborLevel8": null,
                "LaborLevel9": null,
                "LaborLevel10": null,
                "LaborLevel11": null,
                "LaborLevel12": null,
                "LaborLevel13": null,
                "LaborLevel14": null,
                "LaborLevel15": null,
                "TransactionType": 2,
                "TransactionDateTime": "\/Date(1689156000000)\/"
            }
        }
    ]
}
JSON Response
{
    "ResultStatus": 0,
    "ResultStatusDescription": "Completed",
    "Results": [
        {
            "ID": 1,
            "Status": 0,
            "StatusDescription": "Updated"
        }
    ],
    "ResultsIdentifier": "e21a798b-7ec1-43f6-9ebe-f59ebaea016d",
    "Report": {
        "APIVersion": "2.0",
        "ProcessTime": "0.0541909",
        "RequestTime": "/Date(1689284559724-0700)/",
        "ResponseTime": "/Date(1689284559779-0700)/",
        "Results": 1
    }
}
SOAP: C# WCF Sample
public class UpdateUserTimePunchSample
{
    public void V2_UpdateUserTimePunch_Example{

        UpdateUserTimePunchIn input = new UpdateUserTimePunchIn() {
            AuthToken = "VXBkYXRlVXNlclRpbWVQdW5jaC1TYW1wbGUtSlNPTi1JTg=="
                RecordsToUpdate = new List < UpdateUserTimePunchObject > () {
                new UpdateUserTimePunchObject() {
                    ID = 1,
                    OriginalPunch = new PunchInformation() {
                        BadgeNumber = "1234",
                        EmpIdentifier = "",
                        TransactionType = 2,
                        TransactionDateTime = new DateTime(2020, 1, 1)

                    },
                    PunchUpdates = new TimeSlicePreModel() {
                        Accuracy = 0,
                        TransactionType = 2,
                        TransactionDateTime = new DateTime(2021, 2, 1),
                        LaborLevel1 = string.Empty,
                        LaborLevel2 = string.Empty,
                        LaborLevel3 = string.Empty,
                        LaborLevel4 = string.Empty,
                        LaborLevel5 = string.Empty,
                        LaborLevel6 = string.Empty,
                        LaborLevel7 = string.Empty,
                        LaborLevel8 = string.Empty,
                        LaborLevel9 = string.Empty,
                        LaborLevel10 = string.Empty,
                        LaborLevel11 = string.Empty,
                        LaborLevel12 = string.Empty,
                        LaborLevel13 = string.Empty,
                        LaborLevel14 = string.Empty,
                        LaborLevel15 = string.Empty
                    }
                }
            }
        }

        var Test = new ServiceRouter.UpdateUserTimePunch(input);
    }
}
See Also