JavaScriptSerializer C# 3.5 自带生成Json,不用在去引用Newtonsoft.Json.dll

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using Travel.Payment.BackUI.AppCode.OrderAPI;
using Travel.Payment.Proxy.PaymentService;
using System.Runtime.Serialization;

 

namespace Travel.Payment.BackUI.CommenPage
{
    /// <summary>
    /// Summary description for $codebehindclassname$
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class ajax : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            Post(context.Request, context.Response, context);
        }

        private void Post(HttpRequest Request, HttpResponse Response, HttpContext context)
        {
            string operType = Request.Params["OperType"] ?? "";
            switch (operType)
            {
                //得到订单详细,返回数据Json形式
                case "GetOrderDetails":
                    OrderAPI apiOrder = new OrderAPI();
                    long OrderId = long.Parse(Request.Params["OrderId"] ?? "0");
                    apiOrder.Reply =
                        OrderAPI.IPS.QueryOrderPayInfo(new QueryOrderPayInfoRequest
                        {
                            Operator = apiOrder.Request.Operator,
                            OperatorRole = apiOrder.Request.OperatorRole,
                            ValidChargeResult = apiOrder.Request.ValidChargeResult,
                            IncludeDetail = apiOrder.Request.IncludeDetail,
                            OrderId = OrderId
                        });
                    //string stmp = JsonConvert.SerializeObject(apiOrder.Reply.OrderPayInfo);
                    System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                    string stmp = serializer.Serialize(apiOrder.Reply.OrderPayInfo);
                    //DataContractJsonSerializer()
                    Response.Write(stmp);
                    //Travel.Payment.Proxy.PaymentService.PayOrderInfo payOrderInfo = queryOrderPayInfoReply.OrderPayInfo;
                    //Travel.Payment.Proxy.PaymentService.PayOrderItem payOrderItem = payOrderInfo.PayItems.FirstOrDefault();
                    //this.Label1.Text = payOrderInfo.OrderId.ToString();
                    //国际票还是国内票
                    Label7.Text = " ";
                    //this.Label2.Text = payOrderInfo.OrderPrice.ToString();
                    //Label8.Text = payOrderInfo.OrderPriceDue.ToString();
                    //Label3.Text = payOrderInfo.HadPayAmount.ToString();
                    //Label9.Text = payOrderInfo.OldBankCode.ToString();
                    //Label4.Text = payOrderInfo.OrderTime.ToString();
                    break;
            }
        }

 

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

 

转载于:https://www.cnblogs.com/liulf/archive/2010/07/16/1779085.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值