ServiceRouterUpdateUserScheduleDetail Method | |
Namespace: AppOne.Services.V2Assembly: AppOne.Web.Service (in AppOne.Web.Service.dll) Version: 1.0.141
Syntax Remarks Example {
"AuthToken":"String_Content",
"AutoAdd":true,
"Payload":[{
"ParentID":2147483647,
"EnableHomeLaborLevelAssignment":true,
"EndDateTime":"\/Date(928174800000-0700)\/",
"PayTypeID":2147483647,
"StartDateTime":"\/Date(928174800000-0700)\/",
"LL01ID":2147483647,
"LL02ID":2147483647,
"LL03ID":2147483647,
"LL04ID":2147483647,
"LL05ID":2147483647,
"LL06ID":2147483647,
"LL07ID":2147483647,
"LL08ID":2147483647,
"LL09ID":2147483647,
"LL10ID":2147483647,
"LL11ID":2147483647,
"LL12ID":2147483647,
"LL13ID":2147483647,
"LL14ID":2147483647,
"LL15ID":2147483647,
"ScheduleDetailID":2147483647
}]
}
{
"Report": {
"APIVersion": "2.0",
"ProcessTime": "0.0627879",
"RequestTime": "/Date(1482262075642-0700)/",
"ResponseTime": "/Date(1482262075705-0700)/",
"Results": 1
},
"Results": [ {
"ID": 4382,
"Messages": ["Schedule detail successfully updated"],
"Status": 1
}]
}
public void V2_UpdateUserScheduleDetail_SOAP_Test()
{
try
{
var actionTestLogic = new Action<SoapServiceV2.ServiceRouterClient>((client) =>
{
List<int> scheduleIds = new List<int>();
List<int> scheduleDetailIds = new List<int>();
#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
#region Update Schedule
bool pass = true;
SoapServiceV2.UpdateUserScheduleDetailRequest request3 = new SoapServiceV2.UpdateUserScheduleDetailRequest();
List<SoapServiceV2.UpdateUserScheduleDetailModel> payLoadUpdate = new List<UpdateUserScheduleDetailModel>();
SoapServiceV2.UpdateUserScheduleDetailModel payLoadItemUpdate = new UpdateUserScheduleDetailModel
{
ParentID = scheduleId,
ScheduleDetailID = scheduleDetailId,
StartDateTime = ChangeTime(DateTime.Now,12, 0, 0, 0),
EndDateTime = ChangeTime(DateTime.Now, 1, 0, 0, 0),
PayTypeID = PayType.PayTypes.Break.GetHashCode(),
EnableHomeLaborLevelAssignment = true
};
payLoadUpdate.Add(payLoadItemUpdate);
request3.input = new SoapServiceV2.UpdateUserScheduleDetailIn
{
AuthToken = AuthToken,
Payload = payLoadUpdate
};
SoapServiceV2.UpdateUserScheduleDetailResponse response3 = client.UpdateUserScheduleDetail(request3);
#endregion
pass = (response3.UpdateUserScheduleDetailResult.Results != null && response3.UpdateUserScheduleDetailResult.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