public HttpResponseBase GetTicketMasterList() { string json = string.Empty; int tranInt = 0; try { List<TicketMasterQuery> store = new List<TicketMasterQuery>(); TicketMasterQuery query = new TicketMasterQuery(); query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25"); int totalCount = 0; _ITicketMaster = new TicketMasterMgr(mySqlConnectionString); if (!string.IsNullOrEmpty(Request.Params["master_status"])) { query.master_status = int.Parse(Request.Params["master_status"]); } else { query.master_status = -1; } if (!string.IsNullOrEmpty(Request.Params["order_payment"])) { query.order_payment = int.Parse(Request.Params["order_payment"]); } else { query.order_payment = -1; } if (!string.IsNullOrEmpty(Request.Params["ticket_master_id"])) { query.ticket_master_id = int.Parse(Request.Params["ticket_master_id"]); } if (!string.IsNullOrEmpty(Request.Params["order_name"])) { query.order_name = (Request.Params["order_name"]); } if (!string.IsNullOrEmpty(Request.Params["ticket_start"])) { query.order_start = (int)CommonFunction.GetPHPTime(Request.Params["ticket_start"]); } if (!string.IsNullOrEmpty(Request.Params["ticket_end"])) { query.order_end = (int)CommonFunction.GetPHPTime(Request.Params["ticket_end"]); } if (!string.IsNullOrEmpty(Request.Params["bill_check"])) { query.billing_checked = int.Parse(Request.Params["bill_check"]); } if (!string.IsNullOrEmpty(Request.Params["course_search"])) { if (int.TryParse(Request.Params["course_search"], out tranInt)) { query.course_id = tranInt; } else { query.course_name = Request.Params["course_search"]; } } if (!string.IsNullOrEmpty(Request.Params["course_start"])) { query.start_date = DateTime.Parse(Request.Params["course_start"]); } if (!string.IsNullOrEmpty(Request.Params["course_end"])) { query.end_date = DateTime.Parse(Request.Params["course_end"]); } if (!string.IsNullOrEmpty(Request.Params["relation_id"])) { query.ticket_master_id = int.Parse(Request.Params["relation_id"]); } if (!string.IsNullOrEmpty(Request.Params["isSecret"])) { query.isSecret = Request.Params["isSecret"].ToString(); } DataTable dt = _ITicketMaster.GetTicketMasterList(query, out totalCount); #region wasted code //dt.Columns.Add("s_order_createdate", typeof(string)); //for (int i = 0; i < dt.Rows.Count; i++) //{ // if (query.isSecret == "true") // { // dt.Rows[i]["order_name"] = dt.Rows[i]["order_name"].ToString().Substring(0, 1) + "**"; // } // string time = dt.Rows[i]["order_createdate"].ToString(); // DateTime longTime = CommonFunction.GetNetTime(long.Parse(time)); // dt.Rows[i]["s_order_createdate"] = CommonFunction.DateTimeToString(longTime); //} #endregion IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(dt, Formatting.Indented, timeConverter) + "}";//返回json數據 } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,msg:0}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }