示例#1
0
        public Order InformationOrder(string data)
        {
            string key, value;
            var    order = new Order();

            try
            {
                string[] strArray = data.Split('\n');
                for (int i = 1; i < strArray.Length - 1; i++)
                {
                    string[] strArrayTemp = strArray[i].Split('=');
                    key   = strArrayTemp[0];
                    value = HttpUtility.UrlDecode(strArrayTemp[1]);
                    switch (key)
                    {
                    case "mc_gross":
                        order.GrossTotal = double.Parse(value);
                        break;

                    case "invoice":
                        order.InvoiceNumber = int.Parse(value);
                        break;

                    case "payment_status":
                        order.PaymentStatus = value;
                        break;

                    case "first_name":
                        order.PayerFirstName = value;
                        break;

                    case "mc_fee":
                        order.PaymentFee = double.Parse(value);
                        break;

                    case "business":
                        order.BusinessEmail = value;
                        break;

                    case "payer_email":
                        order.PayerEmail = value;
                        break;

                    case "Tx Token":
                        order.TxToken = value;
                        break;

                    case "last_name":
                        order.PayerLastName = value;
                        break;

                    case "receiver_email":
                        order.ReceiverEmail = value;
                        break;

                    case "item_name":
                        order.ItemName = value;
                        break;

                    case "mc_currency":
                        order.Currency = value;
                        break;

                    case "txn_id":
                        order.ReceiverEmail = value;
                        break;

                    case "custom":
                        order.Custom = value;
                        break;

                    case "subscr_id":
                        order.SubscriberId = value;
                        break;
                    }
                }
                return(order);
            }
            catch
            {
                return(null);
            }
        }
示例#2
0
 public static string DeUnicode(string srcText)
 {
     return(HttpUtility.UrlDecode(srcText));
 }