public string ExportSOORderXMLTT(int StockOrderID)
        {
            string Result = "Export Failed";

            Wrapper WS = new Wrapper();

            XmlDocument  xmldoc = new XmlDocument();
            XmlNode      Rootelement;
            XmlElement   element;
            XmlElement   ChildElement;
            XmlElement   DataElement;
            XmlElement   Body;
            XmlAttribute AttributeX;
            //XmlText xmltext;

            DataSet ds = WS.GetExportDataTT(StockOrderID);


            Rootelement = xmldoc.CreateElement("Shipped_Products_Customers");
            xmldoc.AppendChild(Rootelement);

            AttributeX       = xmldoc.CreateAttribute("xmlns");
            AttributeX.Value = "http://TomTom.BizTalk.Schemas.IE_SPC.IE_SPC_2";
            Rootelement.Attributes.Append(AttributeX);

            element = xmldoc.CreateElement("CNTRLAREA");
            Rootelement.AppendChild(element);

            DataElement = xmldoc.CreateElement("SENDER");
            element.AppendChild(DataElement);

            ChildElement           = xmldoc.CreateElement("LOGICALID");
            ChildElement.InnerText = "Imperial Express";
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("REFERENCEID");
            ChildElement.InnerText = "45205313";
            DataElement.AppendChild(ChildElement);

            DataElement = xmldoc.CreateElement("RECIPIENT");
            element.AppendChild(DataElement);

            ChildElement           = xmldoc.CreateElement("LOGICALID");
            ChildElement.InnerText = "TOMTOMDIS";
            DataElement.AppendChild(ChildElement);

            DataElement = xmldoc.CreateElement("DATETIME");
            element.AppendChild(DataElement);

            AttributeX       = xmldoc.CreateAttribute("qualifier");
            AttributeX.Value = "DOCUMENT";
            DataElement.Attributes.Append(AttributeX);

            DateTime CurrentTime = DateTime.Now;

            ChildElement           = xmldoc.CreateElement("YEAR");
            ChildElement.InnerText = CurrentTime.ToString("yyyy");
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("MONTH");
            ChildElement.InnerText = CurrentTime.ToString("MM");
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("DAY");
            ChildElement.InnerText = CurrentTime.ToString("dd");
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("HOUR");
            ChildElement.InnerText = CurrentTime.ToString("hh");
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("MINUTE");
            ChildElement.InnerText = CurrentTime.ToString("mm");
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("SECOND");
            ChildElement.InnerText = CurrentTime.ToString("ss");
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("TIMEZONE");
            ChildElement.InnerText = "+0200";
            DataElement.AppendChild(ChildElement);

            // I'm leaving out Optional parameters
            DataElement = xmldoc.CreateElement("FILE_DETAIL");
            element.AppendChild(DataElement);

            ChildElement           = xmldoc.CreateElement("FILE_TYPE");
            ChildElement.InnerText = "D";
            DataElement.AppendChild(ChildElement);

            ChildElement = xmldoc.CreateElement("JOB_ID");
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("FILE_NUMBER");
            ChildElement.InnerText = "1";
            DataElement.AppendChild(ChildElement);

            ChildElement           = xmldoc.CreateElement("ROWS_PROCESSED");
            ChildElement.InnerText = ds.Tables[0].Rows.Count.ToString();
            DataElement.AppendChild(ChildElement);



            for (int x = 0; x < ds.Tables[0].Rows.Count; x++)
            {
                DataElement = xmldoc.CreateElement("LINE");
                element.AppendChild(DataElement);

                ChildElement           = xmldoc.CreateElement("Contract");
                ChildElement.InnerText = "Imperial Jetpark";
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Order_No");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["OrderReference"].ToString().Substring(1, ds.Tables[0].Rows[x]["OrderReference"].ToString().Length - 1);
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Line_No");
                ChildElement.InnerText = x + 1.ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Order_Cust_Ref");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["CustomerReference"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Customer_Po_No");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["shipperReference"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Consignment_Id");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["StockOrder_ID"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Pallet_ID");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["StockOrder_ID"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Carton_Type");
                ChildElement.InnerText = "TOM 12";
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Parcelno");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["Item_ID"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement = xmldoc.CreateElement("Pwrparcelno");
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Serial_No");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["ItemBarCode"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement = xmldoc.CreateElement("Alt_Serial_Num");
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Part_No");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["SKU"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement = xmldoc.CreateElement("Purch_Order_No");
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Shop_Order_No");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["CustomerReference"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Customer_Po_No");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["OrderReference"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement = xmldoc.CreateElement("Return_Order_No");
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Last_Scan_Date");
                ChildElement.InnerText = CurrentTime.ToString("yyyyMMdd");
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("Last_Scan_App");
                ChildElement.InnerText = "Imperial Warehouse";
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("COUNTRY");
                ChildElement.InnerText = "ZA";
                DataElement.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("CUSTOMER_NAME");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["AddressName"].ToString();
                DataElement.AppendChild(ChildElement);

                ChildElement = xmldoc.CreateElement("Serial_No_Connected_Device");
                DataElement.AppendChild(ChildElement);

                ChildElement = xmldoc.CreateElement("PartNoDataAssyversion");
                DataElement.AppendChild(ChildElement);
            }

            Result = xmldoc.OuterXml;
            xmldoc.Save(ImportPath + "TomTom" + ds.Tables[0].Rows[0]["OrderReference"].ToString().Replace("S", "") + ".xml");
            return(Result);
        }
        public string ExportSOORderXML(int StockOrderID)
        {
            string Result = "Export Failed";

            Wrapper WS = new Wrapper();

            XmlDocument xmldoc = new XmlDocument();
            //XmlNode node;
            XmlElement element;
            XmlElement ChildElement;
            XmlElement DataElement;
            XmlElement Body;
            //XmlText xmltext;

            DataSet ds = WS.GetExportData(StockOrderID);


            element = xmldoc.CreateElement("COL");
            xmldoc.AppendChild(element);

            DataElement = xmldoc.CreateElement("PickList");
            element.AppendChild(DataElement);

            element = xmldoc.CreateElement("Order");
            DataElement.AppendChild(element);



            DataElement           = xmldoc.CreateElement("OrderNum");
            DataElement.InnerText = ds.Tables[0].Rows[0]["shipperReference"].ToString();
            element.AppendChild(DataElement);

            DataElement           = xmldoc.CreateElement("ReleaseNum");
            DataElement.InnerText = ds.Tables[0].Rows[0]["OrderReference"].ToString().Replace("S", "");
            element.AppendChild(DataElement);

            DataElement           = xmldoc.CreateElement("OrderDate");
            DataElement.InnerText = DateTime.Now.ToString("yyyy.MM.dd");
            element.AppendChild(DataElement);

            DataElement           = xmldoc.CreateElement("DeliveryCustomerCode");
            DataElement.InnerText = ds.Tables[0].Rows[0]["CustomerReference"].ToString();
            element.AppendChild(DataElement);


            ChildElement = xmldoc.CreateElement("Items");
            element.AppendChild(ChildElement);

            Body = ChildElement;

            for (int x = 0; x < ds.Tables[0].Rows.Count; x++)
            {
                element = Body;


                ChildElement = xmldoc.CreateElement("Carton");
                element.AppendChild(ChildElement);

                element = ChildElement;

                ChildElement           = xmldoc.CreateElement("ProdCode");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["SKU"].ToString();
                element.AppendChild(ChildElement);

                ChildElement           = xmldoc.CreateElement("CartonNumber");
                ChildElement.InnerText = ds.Tables[0].Rows[x]["ItemBarCode"].ToString();
                element.AppendChild(ChildElement);
            }

            Result = xmldoc.OuterXml;
            xmldoc.Save(ImportPath + "PL" + ds.Tables[0].Rows[0]["OrderReference"].ToString().Replace("S", "") + ".xml");
            return(Result);
        }