private void signUpButton_Click(object sender, EventArgs e) { _busy = true; messageTextBox.Text = "Sending Consignment Request..."; signUpButton.Enabled = false; TNTShipRequest.RequestTypes type = (_thisShipment.PackageTrackingNo == "") ? TNTShipRequest.RequestTypes.Full : TNTShipRequest.RequestTypes.PrintOnly; try { _tntCon.NewShipRequest(_thisShipment.ShipmentDate.Value, type); _tntCon.AddConsignment(new SalesOrder() { SalesOrderId = _thisShipment.Number, //It cannot be the GUID, it's too long; this ones unique too SalesOrderNumber = _thisShipment.Number, //This could be a number assigned by the customer (not available now) InvoiceValue = (double)_thisShipment.AmountIncludingVAT, Vat = _thisShipment.VatRegistrationNo, //address CompanyName = _thisShipment.ShipToName + " " + _thisShipment.ShipToName2, StreetAddress1 = _thisShipment.ShipToAddress, StreetAddress2 = _thisShipment.ShipToAddress2, StreetAddress3 = "", City = _thisShipment.ShipToCity, Province = "", PostCode = _thisShipment.ShipToPostCode, CountryAbb = _thisShipment.ShipToCountryRegionCode, //contact ContactName = _thisShipment.ShipToContactName, //probleem: ship-to Contact niet correct gejoined vanaf Sales Header aan AL-kant (op naam, niet op id). Dit kan dubbele rijen geven. ContactDialCode = "000", ContactTelephone = _thisShipment.ShipToContactPhone, ContactEmail = _thisShipment.ShipToContactEmail, //shipping agent specific ShippingAgentID = _thisShipment.ShippingAgentCode, //TNT does not need it. Add a filter somewhere. ShippingAgentService = correctTNTServiceCode( _thisShipment.ShippingAgentServiceCode, _thisShipment.ShipToCountryRegionCode), DeliveryInstructions = (bool)_thisShipment.ShipOptionHoldForPickup ? "Hold for pickup" : "", //package info PackageFormatCode = _thisShipment.ShippingPackageDimensions, PackageTrackingNo = _thisShipment.PackageTrackingNo, }); _tntCon.StartSendingAsync(); } catch (Exception ex) { MessageBox.Show("Error creating request for TNT: " + ex.Message); _busy = false; } }
/// <summary> /// Start building a new TNTShipRequest /// </summary> /// <param name="CollectionDate">Date at which to book a collection</param> /// <param name="Type">Full or "PrintOnly"</param> public void NewShipRequest(DateTime CollectionDate, TNTShipRequest.RequestTypes Type) { if (ReplaceShipDate != null) { CollectionDate = (DateTime)ReplaceShipDate; } this.shipReq = new TNTShipRequest(CollectionDate, Type, this.pa, Debug); this.Status = Statusses.BuildRequest; this.accessCode = ""; //this.conRefs = new List<string>(); this.bookingRef = ""; this.docStatus = new Dictionary <DocTypes, DocStatusses>() { { DocTypes.Label, DocStatusses.Initial }, { DocTypes.Manifest, DocStatusses.Initial }, { DocTypes.Connote, DocStatusses.Initial }, { DocTypes.Invoice, DocStatusses.Initial }, }; this.docIndex = new DocTypesEnum().GetEnumerator(); }