private string DeleteShiftRequest( string shiftStartDate, string shiftEndDate, bool overADateBorder, string jobPath, string kronosId, string startTime, string endTime) { var secondDayNumber = overADateBorder ? 2 : 1; Request req = new Request { Action = ApiConstants.RemoveSpecifiedScheduleItems, Schedule = new Schedule { Employees = new Employees().Create(kronosId), QueryDateSpan = $"{shiftStartDate}-{shiftEndDate}", ScheduleItems = new ScheduleItems { ScheduleShift = new List <ScheduleShift> { new ScheduleShift { StartDate = shiftStartDate, ShiftSegments = new ShiftSegments().Create(startTime, endTime, 1, secondDayNumber, jobPath), }, }, }, }, }; return(req.XmlSerialize()); }
private string CreateUpcomingShiftsRequestEmployees(string startDate, string endDate, List <ResponseHyperFindResult> employees) { Request request = new Request() { Action = ApiConstants.LoadAction, Schedule = new Schedule() { Employees = new Employees().Create(employees.Select(x => x.PersonNumber).ToArray()), QueryDateSpan = $"{startDate} - {endDate}", }, }; return(request.XmlSerialize()); }
private string CreateEditRequest( string shiftStartDate, string shiftEndDate, bool overADateBorder, string jobPath, string kronosId, string startTime, string endTime, string shiftToReplaceStartDate, string shiftToReplaceEndDate, string shiftToReplaceStartTime, string shiftToReplaceEndTime, Comments comments) { // Ensure the query date range spans both the old shift and the shift to replace with var queryDateSpanStart = DateTime.Parse(shiftStartDate, CultureInfo.InvariantCulture) <= DateTime.Parse(shiftToReplaceStartDate, CultureInfo.InvariantCulture) ? shiftStartDate : shiftToReplaceStartDate; var queryDateSpanEnd = DateTime.Parse(shiftEndDate, CultureInfo.InvariantCulture) >= DateTime.Parse(shiftToReplaceEndDate, CultureInfo.InvariantCulture) ? shiftEndDate : shiftToReplaceEndDate; var secondDayNumber = overADateBorder ? 2 : 1; Request req = new Request { Action = ApiConstants.ReplaceShift, Schedule = new Schedule { Employees = new Employees().Create(kronosId), QueryDateSpan = $"{queryDateSpanStart}-{queryDateSpanEnd}", ScheduleItems = new ScheduleItems { ScheduleShift = new List <ScheduleShift> { new ScheduleShift { StartDate = shiftStartDate, ReplaceStartDate = shiftToReplaceStartDate, ReplaceEndDate = shiftToReplaceEndDate, ReplaceStartTime = shiftToReplaceStartTime, ReplaceEndTime = shiftToReplaceEndTime, ShiftSegments = new ShiftSegments().Create(startTime, endTime, 1, secondDayNumber, jobPath), Comments = comments, }, }, }, }, }; return(req.XmlSerialize()); }