Example #1
0
        private void GetFaxStatus()
        {
            if (lstJobIds.SelectedItem == null)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            Guid jobId = new Guid(lstJobIds.SelectedItem.ToString());

            //
            // Initialize the web service
            //
            PolkaApi.SoapWebService webService = new Polka.Api.DemoApp.PolkaApi.SoapWebService();

            webService.Url = this._SoapUrl;

            try
            {
                //
                // Call the Get Fax Status method
                //
                PolkaApi.ApiResultOfListOfJobStatusContainer result = webService.GetFaxStatus(txtUsername.Text, txtPassword.Text, new Guid(txtProductId.Text), new Guid[] { jobId });

                //
                // Parse the results of the call
                //
                if ((result.Success == true) && (result.Result.Length > 0))
                {
                    StringBuilder sb = new StringBuilder();

                    PolkaApi.JobStatusContainer jobStatus = result.Result[0];

                    sb.AppendLine("Job");
                    sb.AppendLine("--Job Id: " + jobStatus.JobId.ToString());
                    sb.AppendLine("--Job State: " + jobStatus.JobState);
                    sb.AppendLine("--Job Cost: " + jobStatus.JobEstimate.ToString());

                    sb.AppendLine("Call");
                    sb.AppendLine("--Phone Number: " + jobStatus.Calls[0].PhoneNumber);
                    sb.AppendLine("--Call Result: " + jobStatus.Calls[0].CallResult);
                    sb.AppendLine("--Job Pages: " + jobStatus.Calls[0].JobPages);
                    sb.AppendLine("--Pages Sent: " + jobStatus.Calls[0].PagesSent);

                    MessageBox.Show(sb.ToString(), "Job Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    throw new Exception(result.ErrorString);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            Cursor.Current = Cursors.Default;
        }