예제 #1
0
        public FedexProcessShipmentReply RequestShipment()
        {
            FedexProcessShipmentReply result = null;

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(this.m_FedexAccount.URL);

            byte[] bytes;
            bytes = System.Text.Encoding.ASCII.GetBytes(this.m_ProcessShipmentRequest.ToString());
            request.ContentType   = "text/xml; encoding='utf-8'";
            request.ContentLength = bytes.Length;
            request.Method        = "POST";
            System.IO.Stream requestStream = request.GetRequestStream();
            requestStream.Write(bytes, 0, bytes.Length);
            requestStream.Close();
            HttpWebResponse response;

            response = (HttpWebResponse)request.GetResponse();
            if (response.StatusCode == HttpStatusCode.OK)
            {
                System.IO.Stream responseStream = response.GetResponseStream();
                string           responseStr    = new System.IO.StreamReader(responseStream).ReadToEnd();
                result = new FedexProcessShipmentReply(responseStr);
            }
            else
            {
                result = new FedexProcessShipmentReply(false);
            }

            return(result);
        }
예제 #2
0
        private void HyperLinkGetTrackingNumber_Click(object sender, RoutedEventArgs e)
        {
            if (this.IsOKToGetTrackingNumber() == true)
            {
                Fedex.FedexAccountProduction fedExAccount    = new Fedex.FedexAccountProduction();
                FedexShipmentRequest         shipmentRequest = new FedexShipmentRequest(fedExAccount,
                                                                                        this.m_ClientOrder.PLastName, this.m_PaymentType, this.m_ServiceType, this.m_TrackingNumber,
                                                                                        this.m_ShipToName, this.m_ShipToPhone, this.m_ShipToAddress1,
                                                                                        this.m_ShipToAddress2, this.m_ShipToCity, this.m_ShipToState,
                                                                                        this.m_ShipToZip, this.m_AccountNo);
                FedexProcessShipmentReply result = shipmentRequest.RequestShipment();

                if (result.RequestWasSuccessful == true)
                {
                    this.m_TrackingNumber = result.TrackingNumber;
                    this.m_ZPLII          = ZPLPrinterTCP.DecodeZPLFromBase64(result.ZPLII);
                    this.NotifyPropertyChanged(string.Empty);
                }
                else
                {
                    MessageBox.Show(result.Message);
                }
            }
            else
            {
                MessageBox.Show("We are unable to get the tracking number at this point because there are problems with the data.");
            }
        }
예제 #3
0
        private void HyperLinkPrintReturnLabel_Click(object sender, RoutedEventArgs e)
        {
            FedexAccountProduction  fedExAccount       = new FedexAccountProduction();
            FedexReturnLabelRequest returnLabelRequest = new FedexReturnLabelRequest($"{this.m_ClientOrder.PFirstName} {this.m_ClientOrder.PLastName}",
                                                                                     this.m_ClientOrder.PPhone, this.m_ClientOrder.PAddress1, null, this.m_ClientOrder.PCity, this.m_ClientOrder.PState, this.m_ClientOrder.PZipCode, fedExAccount);
            FedexProcessShipmentReply result = returnLabelRequest.RequestShipment();

            ZPLPrinterTCP zplPrinter = new ZPLPrinterTCP("10.1.1.33");

            zplPrinter.Print(ZPLPrinterTCP.DecodeZPLFromBase64(result.ZPLII));

            MessageBox.Show("Fedex labels have been sent to the printer.");
        }