Click or drag to resize

WSLaborLevelDetailAddLaborLevelDetail Method

Adds a list of AddLaborLevelDetailModel and returns a list of AddResult status structures

Namespace: AppOne.Services.V2.Methods
Assembly: AppOne.Web.Service (in AppOne.Web.Service.dll) Version: 1.0.141
Syntax
public AddLaborLevelDetailOut AddLaborLevelDetail(
	AddLaborLevelDetailIn input
)

Parameters

input  AddLaborLevelDetailIn
A new AddLaborLevelDetailIn object

Return Value

AddLaborLevelDetailOut
The newly created ID of the passed in AddLaborLevelDetailOut
Exceptions
ExceptionCondition
ServiceExceptionInvalid/missing data and general error exceptions
Remarks
Adds a list of AddLaborLevelDetailModel and returns a list of AddResult structures.
The structures give a status for each AddLaborLevelDetailModel passed in.

Note  Note
Every labor-level-detail ParentID will correspond to a labor-level ID. If the provided ParentID does not exist then the AddResult return structure for the specified ParentID will fail.
Example
JSON Request
{
    "AuthToken":"...",
    "ValidateCustomFieldName" : false,
    "Payload":[{
        "Code":"custom-code",
        "CustomFields":[{
            "Name":"Multi_LL_CF",
            "Value":"test2"
        }],
        "EmployeeNotesRequired":false,
        "EndDate":"\/Date(1578121200000-0700)\/",
        "Name":"custom-name",
        "ParentID":${Data#LLID},
        "StartDate":"\/Date(1262588400000-0700)\/"
    },
    {
        "Code":"custom-code-1",
        "CustomFields":[{
            "Name":"Multi_LL_CF",
            "Value":"test2"
        }],
        "EmployeeNotesRequired":false,
        "EndDate":"\/Date(1578121200000-0700)\/",
        "Name":"custom-name-1",
        "ParentID":1,
        "StartDate":"\/Date(1262588400000-0700)\/"
    }]
}
JSON Response
{
   "Report":    {
      "APIVersion": "2.0",
      "ProcessTime": "0.0321037",
      "RequestTime": "/Date(1485295445783-0700)/",
      "ResponseTime": "/Date(1485295445815-0700)/",
      "Results": 2
   },
   "Results":    [
            {
         "ID": 23947,
         "Messages": ["PASS: Labor level detail successfully added for code 'custom-code'."],
         "Status": 1
      },
            {
         "ID": 0,
         "Messages": ["FAIL: Labor level with ID (ParentID) '1' does not exist in the system.  Labor level details require a valid labor level ParentID."],
         "Status": 0
      }
   ]
}
SOAP: C# WCF Sample
public void V2_AddLaborLevelDetail_SOAP_Test()
{
    try
    {
        var actionTestLogic = new Action<SoapServiceV2.ServiceRouterClient>((client) =>
        {
            int countTest_1 = 0;
            SoapServiceV2.AddLaborLevelDetailRequest request1 = new SoapServiceV2.AddLaborLevelDetailRequest();
            List<AddLaborLevelDetailModel> payload = new List<AddLaborLevelDetailModel>();
            AddLaborLevelDetailModel model = new AddLaborLevelDetailModel { 
                Code = DateTime.Now.ToShortDateString(),
                StartDate = DateTime.Now,
                EndDate = DateTime.Now,
                Name = "Name_" + DateTime.Now.ToShortDateString(),
                ParentID = 89
            };

            payload.Add(model);

            request1.input = new SoapServiceV2.AddLaborLevelDetailIn
            {
                AuthToken = AuthToken,
                ValidateCustomFieldName = false,
                Payload = payload
            };

            SoapServiceV2.AddLaborLevelDetailResponse response1 = client.AddLaborLevelDetail(request1);
            countTest_1 = (response1.AddLaborLevelDetailResult.Results != null) ? response1.AddLaborLevelDetailResult.Results.Count : 0;
            Assert.IsTrue(countTest_1 > 0);
        });

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