/// <summary> /// Allows POS to assign and update shift data within Freshtxt. With this single call, new section/station /// assignments can be made as well as server assignments to those sections. /// </summary> /// <param name="shiftData">Shift assignments object</param> /// <returns>ServerAssignmentResponse</returns> public ServerAssignmentResponse AssignShift(ShiftAssignments shiftData) { var content = new MultipartForm() .Set("shiftData", shiftData.ToString()); SendRequest <TableServiceResponse>("pos/assignShift", content); return(GetServerAssignments()); }
public void AssignShifts() { var assignments = new ShiftAssignments(); assignments.Add("Russell", new int[] { 1, 2, 3, 4 }); assignments.Add("Shane", new int[] { 200, 201, 202, 203 }); assignments.Add("Mark", new int[] { 304, 305, 306 }); assignments.Add("Salina", new int[] { 409, 408, 409 }); var response = _service.AssignShift(assignments); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); // check return values Assert.IsNotNull(response.Assignments); Assert.IsTrue(response.Assignments.ContainsKey("Russell")); foreach (var table in response.Assignments["Russell"]) { Assert.IsTrue(new List <int>() { 1, 2, 3, 4 }.Contains(table)); } Assert.IsTrue(response.Assignments.ContainsKey("Shane")); foreach (var table in response.Assignments["Shane"]) { Assert.IsTrue(new List <int>() { 200, 201, 202, 203 }.Contains(table)); } Assert.IsTrue(response.Assignments.ContainsKey("Mark")); foreach (var table in response.Assignments["Mark"]) { Assert.IsTrue(new List <int>() { 304, 305, 306 }.Contains(table)); } Assert.IsTrue(response.Assignments.ContainsKey("Salina")); foreach (var table in response.Assignments["Salina"]) { Assert.IsTrue(new List <int>() { 409, 408, 409 }.Contains(table)); } }