日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

json全套

發布時間:2024/4/17 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 json全套 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

JS文件

function pager1_InitData() {//基礎配置$("#pager1").myPagination({currPage: 1,pageCount: 1,pageSize: 10,cssStyle: 'quotes',info: {cookie_currPage: true, //開啟 Coookie保存頁數模式cookie_currPageKey: "pager1_H" //保存 cookie 值為 demo1_currPage},ajax: {on: true, //開啟狀態callback: 'pager1call', //回調函數url: "/AJAXFUNC/OrderHandler.ashx", //訪問服務器地址dataType: 'json', //返回類型param: { on: true, type: '2', ispaid: 'null', payway: '0', bdate: $("[id$='all_beginDate']").val(), edate: $("[id$='all_endDate']").val(), name: $("[id$='all_ticketName']").val() },pageContId: "pageCount"}}); }

?

JS文件中的回調函數

function pager1call(data) {var orderInfo = data;$("#all_TicketOrder").html("");var html = "";for (var i = 0; ; i++) {if (orderInfo.listPo[i] == undefined) {break;}else {html += "<tr>";html += "<td width='70' height='35' class='xian'>";html += "" + orderInfo.listPo[i].orderid + "</td>";html += "<td width='120' class='xian'>";html += orderInfo.listPo[i].upname + "</td>";html += "<td width='110' class='xian'>";html += "" + orderInfo.listPo[i].createtime + "</td>";html += "<td width='130' class='xian'>";html += "" + orderInfo.listPo[i].name + "</td>";html += "<td width='100' class='xian'>";html += "" + orderInfo.listPo[i].endtime + "</td>";html += "<td width='80' class='xian'>";html += "" + orderInfo.listPo[i].totalmoney + "</td>";html += "<td width='80' class='xian'>";}}$("#all_TicketOrder").html(html);if (orderInfo.pageCount == 0) {$("#allEmptyOrder").attr("style", "");}else {$("#allEmptyOrder").attr("style", "display:none");} }

?

ashx文件,json

public class OrderHandler : IHttpHandler {BLLtourol_B2COrder blltourol_b2corder = new BLLtourol_B2COrder();System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();public void ProcessRequest(HttpContext context){context.Response.ContentType = "text/plain";string type = context.Request["type"];int userid = int.Parse(System.Web.Security.Membership.GetUser().ProviderUserKey.ToString());string name = context.Request["name"];bool? ispaid;if (context.Request["ispaid"] == "null"){ispaid = null;}else{ispaid = bool.Parse(context.Request["ispaid"]);}int payway = int.Parse(context.Request["payway"]);string bdate = context.Request["bdate"];string edate = context.Request["edate"];int pageindex = int.Parse(context.Request["page"]) - 1;int pagesize = 10;if (type == ((int)EnterpriseType.景區).ToString()){context.Response.Write(GetAtractionView(userid, ispaid, payway, name, bdate, edate, pageindex, pagesize));}}public bool IsReusable{get{return false;}}public string GetAtractionView(int userid, bool? ispaid, int payway, string name, string bdate, string edate, int pageindex, int pagesize){int count = 0;DataTable dt = blltourol_b2corder.GetList4TableTicket(userid, ispaid, payway, name, bdate, edate, pageindex, pagesize, out count);return jss.Serialize(new ProductOrder2() { pageCount = (int)Math.Ceiling(count * 1.0 / 10), listPo = list4ticket(dt, count) });//把list轉換為JSON格式的字符串}public List<ProductOrder> list4ticket(DataTable dt, int count){List<ProductOrder> listPv = new List<ProductOrder>();for (int i = 0; i < dt.Rows.Count; i++){ProductOrder pv = new ProductOrder();pv.orderid = dt.Rows[i]["Orderid"].ToString();pv.name = dt.Rows[i]["TicketName"].ToString();pv.upname = dt.Rows[i]["Name"].ToString();pv.createtime = DateTime.Parse(dt.Rows[i]["Createtime"].ToString()).ToString("yyyy-MM-dd");pv.endtime = DateTime.Parse(dt.Rows[i]["Endtime"].ToString()).ToString("yyyy-MM-dd");pv.totalmoney = dt.Rows[i]["TotalMoney"].ToString();pv.paystate = dt.Rows[i]["Paystate"].ToString();pv.payway = dt.Rows[i]["Payway"].ToString();pv.state = dt.Rows[i]["State"].ToString();listPv.Add(pv);}return listPv;} }public class ProductOrder {public string orderid { get; set; }public string name { get; set; }public string upname { get; set; }public string createtime { get; set; }public string endtime { get; set; }public string totalmoney { get; set; }public string paystate { get; set; }public string payway { get; set; }public string state { get; set; } }public class ProductOrder2 {public int pageCount { get; set; }public List<ProductOrder> listPo { get; set; } }

轉載于:https://www.cnblogs.com/TivonStone/p/3532614.html

總結

以上是生活随笔為你收集整理的json全套的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。