private void ParseResults(string res) { JobBatchResponse rs = JsonConvert.DeserializeObject <JobBatchResponse>(res); if (rs == null) { throw new Exception("Unrecognised response from IDOL OnDemand"); } if (rs.actions.Count != _batch.Requests.Count) { throw new Exception("Mismatched results count from IDOL OnDemand"); } for (int i = 0; i < rs.actions.Count; i++) { Action a = rs.actions[i]; IODRequest r = _batch.Requests[i]; if (a.action != r.Action) { throw new Exception("Mismatched results action from IDOL OnDemand"); } IODStatus status; Enum.TryParse <IODStatus>(a.status, out status); string result = (a.result == null) ? null : a.result.ToString(); r.SetResult(status, result); } }
public void AddRequest(IODRequest req) { _batch.Requests.Add(req); }