private void HyperLinkGetTrackingNumber_Click(object sender, RoutedEventArgs e)
        {
            if (this.IsOKToGetTrackingNumber() == true)
            {
                Business.MaterialTracking.Model.FedexAccountProduction fedExAccount    = new Business.MaterialTracking.Model.FedexAccountProduction();
                Business.MaterialTracking.Model.FedexShipmentRequest   shipmentRequest = new Business.MaterialTracking.Model.FedexShipmentRequest(fedExAccount,
                                                                                                                                                  this.m_FakeAccessionNo, 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);
                Business.MaterialTracking.Model.FedexProcessShipmentReply result = shipmentRequest.RequestShipment();

                if (result.RequestWasSuccessful == true)
                {
                    this.m_TrackingNumber = result.TrackingNumber;
                    this.m_ZPLII          = Business.Label.Model.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.");
            }
        }
        public Business.MaterialTracking.Model.FedexProcessShipmentReply RequestShipment()
        {
            Business.MaterialTracking.Model.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);;
        }
Example #3
0
        private void ButtonPrintFedexReturnLabel_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 5; i++)
            {
                Business.MaterialTracking.Model.FedexAccountProduction    fedExAccount       = new Business.MaterialTracking.Model.FedexAccountProduction();
                Business.MaterialTracking.Model.FedexReturnLabelRequest   returnLabelRequest = new Business.MaterialTracking.Model.FedexReturnLabelRequest(this.m_Client.ClientName, this.m_Client.Telephone, this.m_Client.Address, null, this.m_Client.City, this.m_Client.State, this.m_Client.ZipCode, fedExAccount);
                Business.MaterialTracking.Model.FedexProcessShipmentReply result             = returnLabelRequest.RequestShipment();

                Business.Label.Model.ZPLPrinterTCP zplPrinter = new Business.Label.Model.ZPLPrinterTCP(Business.User.UserPreferenceInstance.Instance.UserPreference.FedExLabelPrinter);
                zplPrinter.Print(Business.Label.Model.ZPLPrinterTCP.DecodeZPLFromBase64(result.ZPLII));
            }

            MessageBox.Show("Fedex labels have been sent to the printer.");
        }
Example #4
0
        private void HyperLinkGetTrackingNumber_Click(object sender, RoutedEventArgs e)
        {
            Business.Task.Model.TaskOrderDetailFedexShipment taskOrderDetail = this.m_TaskOrder.TaskOrderDetailCollection.GetFedexShipment();
            taskOrderDetail.ValidateObject();
            if (taskOrderDetail.ValidationErrors.Count == 0)
            {
                if (this.IsOKToGetTrackingNumber(taskOrderDetail) == true)
                {
                    string masterAccessionNo = taskOrderDetail.TaskOrderDetailId.Split(new char[] { '.' })[0];
                    Business.Facility.Model.Facility facility = Business.Facility.Model.FacilityCollection.Instance.GetByFacilityId(taskOrderDetail.ShipToFacilityId);
                    Business.MaterialTracking.Model.FedexAccountProduction fedExAccount    = new Business.MaterialTracking.Model.FedexAccountProduction();
                    Business.MaterialTracking.Model.FedexShipmentRequest   shipmentRequest = new Business.MaterialTracking.Model.FedexShipmentRequest(fedExAccount,
                                                                                                                                                      masterAccessionNo, taskOrderDetail.PaymentType, taskOrderDetail.ServiceType, taskOrderDetail.TrackingNumber, taskOrderDetail.ShipToName,
                                                                                                                                                      taskOrderDetail.ShipToPhone, taskOrderDetail.ShipToAddress1, taskOrderDetail.ShipToAddress2, taskOrderDetail.ShipToCity,
                                                                                                                                                      taskOrderDetail.ShipToState, taskOrderDetail.ShipToZip, taskOrderDetail.AccountNo);
                    Business.MaterialTracking.Model.FedexProcessShipmentReply result = shipmentRequest.RequestShipment();

                    if (result.RequestWasSuccessful == true)
                    {
                        taskOrderDetail.TrackingNumber = result.TrackingNumber;
                        taskOrderDetail.ZPLII          = Business.Label.Model.ZPLPrinterTCP.DecodeZPLFromBase64(result.ZPLII);
                    }
                    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.");
                }
            }
            else
            {
                string message = "We are unable to get the tracking number at this point because" + Environment.NewLine + taskOrderDetail.Errors;
                MessageBox.Show(message);
            }
        }