ServiceRouterAddUserScheduleDetail Method | |
Namespace: AppOne.Services.V2Assembly: AppOne.Web.Service (in AppOne.Web.Service.dll) Version: 1.0.141
Syntax Remarks Example {
"AuthToken":"...",
"Payload":[{
"ParentID":3510,
"EnableHomeLaborLevelAssignment":true,
"EndDateTime":"\/Date(1469016000000)\/",
"PayTypeID":-2,
"StartDateTime":"\/Date(1469012400000)\/",
"LL01ID":3,
"LL02ID":0,
"LL03ID":0
}]
}
{
"Report": {
"APIVersion": "2.0",
"ProcessTime": "0.1479955",
"RequestTime": "/Date(1469050621061)/",
"ResponseTime": "/Date(1469050621209)/",
"Results": 1
},
"Results": [ {
"ID": 4380,
"Messages": ["Schedule detail successfully added"],
"Status": 1
}]
}
public void V2_AddUserScheduleDetail_SOAP_Test()
{
try
{
var actionTestLogic = new Action<SoapServiceV2.ServiceRouterClient>((client) =>
{
List<int> scheduleIds = new List<int>();
List<int> scheduleDetailIds = new List<int>();
bool pass = true;
#region Add Schedule
SoapServiceV2.AddUserScheduleRequest request1 = new SoapServiceV2.AddUserScheduleRequest();
List<SoapServiceV2.AddUserScheduleModel> payLoad = new List<AddUserScheduleModel>();
SoapServiceV2.AddUserScheduleModel payLoadItem = new AddUserScheduleModel
{
EmpIdentifier = "123",
StartDateTime = ChangeTime(DateTime.Now, 8, 0, 0, 0),
EndDateTime = ChangeTime(DateTime.Now, 16, 0, 0, 0),
PayTypeID = PayType.PayTypes.Work.GetHashCode(),
EnableHomeLaborLevelAssignment = true
};
payLoad.Add(payLoadItem);
request1.input = new SoapServiceV2.AddUserScheduleIn
{
AuthToken = AuthToken,
Payload = payLoad
};
SoapServiceV2.AddUserScheduleResponse response1 = client.AddUserSchedule(request1);
int scheduleId = response1.AddUserScheduleResult.Results.Where(s => s.ID != 0).Select(s => s.ID).SingleOrDefault();
#endregion
#region Add Schedule Detail
SoapServiceV2.AddUserScheduleDetailRequest request2 = new SoapServiceV2.AddUserScheduleDetailRequest();
List<SoapServiceV2.AddUserScheduleDetailModel> detailPayLoad = new List<AddUserScheduleDetailModel>();
SoapServiceV2.AddUserScheduleDetailModel detailPayLoadItem1 = new AddUserScheduleDetailModel
{
StartDateTime = ChangeTime(DateTime.Now, 12, 0, 0, 0),
EndDateTime = ChangeTime(DateTime.Now, 12, 30, 0, 0),
PayTypeID = PayType.PayTypes.Lunch.GetHashCode(),
EnableHomeLaborLevelAssignment=true,
ParentID=scheduleId
};
detailPayLoad.Add(detailPayLoadItem1);
request2.input = new SoapServiceV2.AddUserScheduleDetailIn
{
AuthToken = AuthToken,
Payload = detailPayLoad
};
SoapServiceV2.AddUserScheduleDetailResponse response2 = client.AddUserScheduleDetail(request2);
int scheduleDetailId = response2.AddUserScheduleDetailResult.Results.Where(s => s.ID != 0).Select(s => s.ID).SingleOrDefault();
#endregion
pass = (response2.AddUserScheduleDetailResult.Results != null && response2.AddUserScheduleDetailResult.Results.Count > 0) ? true : false;
Assert.IsTrue(pass);
#region Delete Schedule Detail
scheduleDetailIds.Add(scheduleDetailId);
DeleteScheduleDetails(scheduleDetailIds);
#endregion
#region Delete Schedule
scheduleIds.Add(scheduleId);
DeleteSchedules(scheduleIds);
#endregion
});
RunServiceClient(actionTestLogic);
}
catch (FaultException<SoapServiceV2.ServiceException> fe)
{
Assert.Fail(fe.Detail.Message);
}
}
See Also