Created
November 14, 2012 14:46
-
-
Save raholland79/4072533 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String serviceType = "0"; | |
switch (this.cboServiceType.Text) | |
{ | |
case "LTL": | |
serviceType = "0"; | |
break; | |
case "LTL and Parcel": | |
serviceType = "1"; | |
break; | |
case "Parcel": | |
serviceType = "2"; | |
break; | |
default: | |
serviceType = "0"; | |
break; | |
} | |
this.Refresh(); | |
XmlDocument oTemplateDoc = new XmlDocument(); | |
oTemplateDoc.Load("http://sfs.smarttms.com/WebServices/SimpleQuote.xml"); | |
com.smarttms.www.SmartServices oSmartService = new com.smarttms.www.SmartServices(); | |
com.smarttms.www.AuthHeader oAuthHeaderProd = new com.smarttms.www.AuthHeader(); | |
oAuthHeaderProd.sUsername = this.txtUsername.Text; | |
oAuthHeaderProd.sPassword = this.txtPassword.Text; | |
oSmartService.AuthHeaderValue = oAuthHeaderProd; | |
oSmartService.Timeout = 120000; | |
XmlDocument oDoc = new XmlDocument(); | |
oDoc = oTemplateDoc; | |
XmlNode oNode = oDoc.SelectSingleNode("/QUOTES/QUOTE"); | |
oNode.SelectSingleNode("USER_ID").InnerText = "UM00021414"; | |
oNode.SelectSingleNode("ORIG_POSTAL_CODE").InnerText = txtOrig.Text; | |
oNode.SelectSingleNode("DEST_POSTAL_CODE").InnerText = txtDest.Text; | |
oNode.SelectSingleNode("ITEMS/ITEM/DENSITY_CLASS").InnerText = txtClass.Text; | |
oNode.SelectSingleNode("ITEMS/ITEM/CUBE").InnerText = ""; | |
oNode.SelectSingleNode("ITEMS/ITEM/WEIGHT").InnerText = txtWeight.Text; | |
oNode.SelectSingleNode("ITEMS/ITEM/LENGTH").InnerText = this.txtLength.Text; | |
oNode.SelectSingleNode("ITEMS/ITEM/WIDTH").InnerText = this.txtWidth.Text; | |
oNode.SelectSingleNode("ITEMS/ITEM/HEIGHT").InnerText = this.txtHeight.Text; | |
oNode.SelectSingleNode("ITEMS/ITEM/UNITS").InnerText = "1"; | |
oNode.SelectSingleNode("SERVICE_TYPE").InnerText = serviceType; | |
oNode.SelectSingleNode("DATE_ENTERED").InnerText = ShipDate.Text.ToString(); | |
if (chkAccessorial.CheckedItems.Count != 0) | |
{ | |
XmlNode oAccClone = oNode.SelectSingleNode("ACC_ITEMS/ACC_ITEM").CloneNode(true); | |
oNode.SelectSingleNode("ACC_ITEMS").RemoveChild(oNode.SelectSingleNode("ACC_ITEMS/ACC_ITEM")); | |
// if you want to pass in some sample accessorials | |
for (int x = 0; x <= chkAccessorial.CheckedItems.Count - 1; x++) | |
{ | |
switch (chkAccessorial.CheckedItems[x].ToString()) | |
{ | |
case "Inside Pickup": | |
oAccClone.SelectSingleNode("ACC_CHARGE_ID").InnerText = "1"; | |
break; | |
case "Inside Delivery": | |
oAccClone.SelectSingleNode("ACC_CHARGE_ID").InnerText = "2"; | |
break; | |
case "Pickup Liftgate": | |
oAccClone.SelectSingleNode("ACC_CHARGE_ID").InnerText = "5"; | |
break; | |
case "Delivery Liftgate": | |
oAccClone.SelectSingleNode("ACC_CHARGE_ID").InnerText = "7"; | |
break; | |
case "Pickup Notification (Appt)": | |
oAccClone.SelectSingleNode("ACC_CHARGE_ID").InnerText = "47"; | |
break; | |
case "Delivery Notification (Appt)": | |
oAccClone.SelectSingleNode("ACC_CHARGE_ID").InnerText = "15"; | |
break; | |
} | |
oNode.SelectSingleNode("ACC_ITEMS").AppendChild(oDoc.ImportNode(oAccClone.CloneNode(true), true)); | |
} | |
} | |
XmlNode oResultNode = oSmartService.GetSimpleQuote(oDoc, "M0”); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment