Beispiel #1
0
        static bool startUploadJob(HttpRequestMessageProperty httpRequest, string jobID)
        {
            try
            {
                BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName);
                using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                {

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

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

                    StartUploadJobResponse resp = client.startUploadJob(req);

                    // update the status of the request (success / fail) and any messages returned
                    if (resp.ack == BDX.AckValue.Success)
                    {
                        LMSMessage += Environment.NewLine + " job has been successfully scheduled";
                        //log into database
                        //" has been successfully scheduled. \n";
                        return true;
                    }
                    else
                    {
                        throw new Exception(resp.errorMessage[0].message);
                        //"This job might have already been scheduled.\n";
                        return false;
                    }

                }
            }
            catch (Exception ex)
            {
                LMSMessage += Environment.NewLine + " startUploadJob:" + ex.Message;
                return false;
            }
        }
Beispiel #2
0
        private bool startUploadJob(frmLMSMain sender, HttpRequestMessageProperty httpRequest, string jobID)
        {
            string txt = "";

                sender.UploadStatus += "\nCalling startUploadJob.\n";
                try
                {
                    BulkDataExchangeServicePortClient client = new BulkDataExchangeServicePortClient(BDXconfigName);
                    using (OperationContextScope scope = new OperationContextScope(client.InnerChannel))
                    {

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

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

                        StartUploadJobResponse resp = client.startUploadJob(req);

                        // update the status of the request (success / fail) and any messages returned
                        if (resp.ack == BDX.AckValue.Success)
                        {
                            txt += "Job with JobID " + jobID + " has been successfully scheduled. \n";
                            txt += "\n" + resp.timestamp;
                            Console.WriteLine(txt);
                            sender.UploadStatus += txt;
                            return true;
                        }
                        else
                        {
                            txt = resp.timestamp + " :: " + "This job might have already been scheduled.\n";
                            Console.WriteLine(txt);
                            sender.UploadStatus += txt;

                            if (resp.errorMessage != null)
                            {
                                ErrorAdmin.updateResponseStatus(resp, sender, true);
                            }
                            return false;
                        }

                    }
                }
                catch (Exception ex)
                {
                    sender.UploadStatus += ex + "\n";
                    return false;
                }
        }