/// <summary>Serialize a BTOrder to a string</summary>
        /// <param name="holder"></param>
        /// <returns></returns>
        public static string SerializeOrder(SerializedOrderHolder holder)
        {
            StringWriter           orderAsString = new StringWriter();
            XmlTextWriter          xmlTextWriter = new XmlTextWriter(orderAsString);
            DataContractSerializer serializer    = new DataContractSerializer(typeof(SerializedOrderHolder), knownTypes);

            serializer.WriteObject(xmlTextWriter, holder);

            return(orderAsString.ToString());
        }
        public static SerializedOrderHolder DeSerializeOrder(string order)
        {
            SerializedOrderHolder  holder        = null;
            StringReader           orderAsString = new StringReader(order);
            XmlTextReader          xmlreader     = new XmlTextReader(orderAsString);
            DataContractSerializer serializer    = new DataContractSerializer(typeof(SerializedOrderHolder), knownTypes);

            holder = serializer.ReadObject(xmlreader) as SerializedOrderHolder;

            return(holder);
        }
        public static SerializedOrderHolder DeSerializeOrder(string order)
        {
            SerializedOrderHolder holder = null;

            if ((HLConfigManager.Configurations.DOConfiguration.IsChina))
            {
                if (order.Contains("<BTOrder xmlns:d2p1=\"http://schemas.datacontract.org/2004/07/MyHerbalife3.Ordering.Providers.OrderImportBtWS\">"))
                {
                    order = order.Replace("d2p2:OrderItem", "d2p2:OnlineOrderItem");
                    order = order.Replace("i:type=\"d2p2:Order\"", "i:type=\"d2p2:OnlineOrder\"");
                }
            }
            StringReader           orderAsString = new StringReader(order);
            XmlTextReader          xmlreader     = new XmlTextReader(orderAsString);
            DataContractSerializer serializer    = new DataContractSerializer(typeof(SerializedOrderHolder), knownTypes);

            holder = serializer.ReadObject(xmlreader) as SerializedOrderHolder;

            return(holder);
        }
Esempio n. 4
0
 public bool deSerializeAndSubmitOrder(PaymentGatewayResponse response, out string error, out SerializedOrderHolder holder)
 {
     return(OrderProvider.deSerializeAndSubmitOrder(response, out error, out holder));
 }