public string SerializeJobCreationResults(JobCreationResults jobResults)
 {
     var result = new PassthroughResponse();
     if (jobResults.ErrorCode.IsNotNullOrEmpty() || jobResults.HttpStatusCode != HttpStatusCode.Accepted)
     {
         result.Error = new PassthroughErrorResponse { StatusCode = jobResults.HttpStatusCode, ErrorId = jobResults.ErrorCode };
     }
     result.Data = jobResults.JobId;
     return this.SerializeJobDetails(result);
 }
 public string SerializeJobList(JobList jobs)
 {
     var result = new PassthroughResponse();
     if (jobs.ErrorCode.IsNotNullOrEmpty() || jobs.HttpStatusCode != HttpStatusCode.Accepted)
     {
         result.Error = new PassthroughErrorResponse { StatusCode = jobs.HttpStatusCode, ErrorId = jobs.ErrorCode };
     }
     result.Data = jobs.Jobs.Select(j => j.JobId).ToList();
     return this.SerializeJobDetails(result);
 }
 private string SerializeJobDetails(PassthroughResponse result)
 {
     DataContractSerializer ser = new DataContractSerializer(typeof(PassthroughResponse));
     using (var stream = new MemoryStream())
     {
         using (var reader = new StreamReader(stream))
         {
             ser.WriteObject(stream, result);
             stream.Flush();
             stream.Position = 0;
             return reader.ReadToEnd();
         }
     }
 }
 public string SerializeJobDetails(Hadoop.Client.JobDetails jobDetails)
 {
     var result = new PassthroughResponse();
     if (jobDetails.ErrorCode.IsNotNullOrEmpty() || jobDetails.HttpStatusCode != HttpStatusCode.Accepted)
     {
         result.Error = new PassthroughErrorResponse { StatusCode = jobDetails.HttpStatusCode, ErrorId = jobDetails.ErrorCode };
     }
     var details = new Microsoft.ClusterServices.RDFEProvider.ResourceExtensions.JobSubmission.Models.JobDetails()
     {
         ErrorOutputPath = jobDetails.ErrorOutputPath,
         ExitCode = jobDetails.ExitCode,
         LogicalOutputPath = jobDetails.LogicalOutputPath,
         Name = jobDetails.Name,
         PhysicalOutputPath = new Uri(jobDetails.PhysicalOutputPath),
         Query = jobDetails.Query,
         SubmissionTime = jobDetails.SubmissionTime.Ticks.ToString()
     };
     Microsoft.ClusterServices.RDFEProvider.ResourceExtensions.JobSubmission.Models.JobStatusCode statusCode;
     Assert.IsTrue(Microsoft.ClusterServices.RDFEProvider.ResourceExtensions.JobSubmission.Models.JobStatusCode.TryParse(jobDetails.StatusCode.ToString(), out statusCode));
     details.StatusCode = statusCode;
     result.Data = details;
     return this.SerializeJobDetails(result);
 }