Example #1
0
        private GetJobStatusResponse GetJobStatus(string jobId)
        {
            var jobStatusRequest = new GetJobStatusRequest();

            jobStatusRequest.jobId = jobId;

            _CurrentOperationName = "getJobStatus";

            return(base.getJobStatus(jobStatusRequest));
        }
Example #2
0
        static string getJobStatus(bool isUpload, HttpRequestMessageProperty httpRequest, string jobID)
        {
            string fileRefID = "";
            //nCalling getJobStatus every minute to see if the job has completed.\n";
            try
            {
                BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName);
                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                {

                    OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                    while (fileRefID == "")
                    {
                        //Sleep between successive requests
                        Thread.Sleep(WaitngJobCompletedinSeconds * 1000);

                        GetJobStatusRequest req = new GetJobStatusRequest();
                        req.jobId = jobID.Trim();

                        GetJobStatusResponse resp = client.getJobStatus(req);

                        if (resp.ack == BDX.AckValue.Success)
                        {
                            if (resp.jobProfile != null)
                            {
                                foreach (JobProfile jobProfile in resp.jobProfile)
                                {
                                    if (jobProfile.fileReferenceId != null)
                                    {
                                        // log into data base
                                        LMSMessage += Environment.NewLine + " job has completed " + jobProfile.jobId;
                                        //resp.timestamp + " :: " + "Job Type: " + jobProfile.jobType + "::Job ID: " + jobProfile.jobId + "::" + "FileRefID: " + jobProfile.fileReferenceId + "::" + "Job Status: " + jobProfile.jobStatus + "\n\n";
                                        fileRefID = jobProfile.fileReferenceId;
                                        LMSJobStatus = jobProfile.jobStatus.ToString(); // "Job Completed";
                                    }
                                    else
                                    {
                                        //txt = resp.timestamp + " :: " + "Job Type: " + jobProfile.jobType + "::Job ID: " + jobProfile.jobId + "::" + "Job Status: " + jobProfile.jobStatus + "\n"; ;
                                    }
                                }
                            }
                        }
                        else
                        {
                            throw new Exception(resp.errorMessage[0].message);
                        }

                    }
                    return fileRefID;

                }
            }
            catch (Exception ex)
            {
                LMSMessage += Environment.NewLine + " getJobStatus:" + ex.Message;
                return "";
            }
        }
Example #3
0
        private string getJobStatus(frmLMSMain sender, bool isUpload, HttpRequestMessageProperty httpRequest, string jobID)
        {
            string txt = "";
                string fileRefID = "";

                if (isUpload)
                    sender.UploadStatus += "\nCalling getJobStatus every minute to see if the job has completed.\n";
                else
                    sender.DownloadStatus += "\nCalling getJobStatus every minute to see if the job has completed.\n";
                try
                {
                    BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName);
                    using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                    {

                        OperationContext.Current.OutgoingMessageProperties.Add(HttpRequestMessageProperty.Name, httpRequest);

                        while (fileRefID == "")
                        {
                            //Sleep between successive requests
                            Thread.Sleep(60000);

                            GetJobStatusRequest req = new GetJobStatusRequest();
                            req.jobId = jobID.Trim();

                            GetJobStatusResponse resp = client.getJobStatus(req);

                            // update the status of the request (success / fail) and any messages returned
                            if (resp.errorMessage != null)
                            {
                                ErrorAdmin.updateResponseStatus(resp, sender, isUpload);
                            }

                            if (resp.jobProfile != null)
                            {
                                foreach (JobProfile jobProfile in resp.jobProfile)
                                {
                                    if (jobProfile.fileReferenceId != null)
                                    {
                                        txt = resp.timestamp + " :: " + "Job Type: " + jobProfile.jobType + "::Job ID: " + jobProfile.jobId + "::" + "FileRefID: " + jobProfile.fileReferenceId + "::" + "Job Status: " + jobProfile.jobStatus + "\n\n";
                                        fileRefID = jobProfile.fileReferenceId;
                                        Console.WriteLine(txt);
                                        if (isUpload)
                                            sender.UploadStatus += txt;
                                        else
                                            sender.DownloadStatus += txt;
                                    }
                                    else
                                    {
                                        txt = resp.timestamp + " :: " + "Job Type: " + jobProfile.jobType + "::Job ID: " + jobProfile.jobId + "::" + "Job Status: " + jobProfile.jobStatus + "\n";;
                                        Console.WriteLine(txt);
                                        if (isUpload)
                                            sender.UploadStatus += txt;
                                        else
                                            sender.DownloadStatus += txt;
                                    }
                                }
                            }
                        }
                        return fileRefID;

                    }
                }
                catch (Exception ex)
                {
                     if (isUpload)
                        sender.UploadStatus += ex + "\n";
                    else
                        sender.DownloadStatus += ex + "\n";

                    return "";
                }
        }