public static ERROR_TYPE[] Status_GetErrors(JOB_STATUS_TYPE stat) { if (stat.details is JOB_STATUS_DETAILS_STARTED_TYPE) { return(((JOB_STATUS_DETAILS_STARTED_TYPE)stat.details).errorList); } else if (stat.details is JOB_STATUS_DETAILS_FINISHED_TYPE) { return(((JOB_STATUS_DETAILS_FINISHED_TYPE)stat.details).errorList); } else if (stat.details is JOB_STATUS_DETAILS_SUSPENDED_TYPE) { return(((JOB_STATUS_DETAILS_SUSPENDED_TYPE)stat.details).errorList); } else if (stat.details is JOB_STATUS_DETAILS_ERROR_TYPE) { return(((JOB_STATUS_DETAILS_ERROR_TYPE)stat.details).errorList); } else { return(null); } }
/// <summary> /// Gets the job status. /// </summary> /// <param name="jobID">Job ID.</param> /// <param name="errorInfo">Error info.</param> /// <returns></returns> /// <remarks> /// Sequence Diagram:<br/> /// <img src="SequenceDiagrams/SD_PrintReleaseDevice.Mfp.JobStatus.GetJobStatus.jpg"/> /// </remarks> private string GetJobStatus(OSA_JOB_ID_TYPE jobID, out ERROR_TYPE[] errorInfo) { errorInfo = null; string returnValue = string.Empty; bool create = CreateWS(); if (create) { OSA_JOB_ID_TYPE jobIDType = new OSA_JOB_ID_TYPE(); jobIDType.jobtype = E_MFP_JOB_TYPE.PRINT; JOB_STATUS_TYPE jobStatus = null; try { jobStatus = mfpWebService.GetJobStatus(jobID, ref OsaDirectManager.Core.g_WSDLGeneric); } catch (Exception) { } returnValue = Convert.ToString(jobStatus.status); switch (jobStatus.status) { case E_JOB_STATUS_TYPE.QUEUED: { JOB_STATUS_DETAILS_QUEUED_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_QUEUED_TYPE; // Process the details here // ... } errorInfo = null; returnValue = "Queued"; break; case E_JOB_STATUS_TYPE.FINISHED: { JOB_STATUS_DETAILS_FINISHED_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_FINISHED_TYPE; // Process the details here // ... } errorInfo = null; returnValue = "Finished"; break; case E_JOB_STATUS_TYPE.CANCELED: { JOB_STATUS_DETAILS_CANCELED_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_CANCELED_TYPE; } errorInfo = null; returnValue = "Cancelled"; break; case E_JOB_STATUS_TYPE.ERROR: { try { JOB_STATUS_DETAILS_ERROR_TYPE details = jobStatus.details as JOB_STATUS_DETAILS_ERROR_TYPE; ERROR_TYPE[] errors = details.errorList; errorInfo = errors; } catch (Exception ex) { // } } returnValue = "Error"; break; // ... other status types follow } } return(returnValue); }