public HttpResponseBase PromoAdditionalPriceList() { PromoAdditionalPriceQuery query = new PromoAdditionalPriceQuery(); List<PromoAdditionalPriceQuery> store = new List<PromoAdditionalPriceQuery>(); string json = string.Empty; try { query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); if (!string.IsNullOrEmpty(Request.Params["limit"])) { query.Limit = Convert.ToInt32(Request.Params["limit"]); } if (!string.IsNullOrEmpty(Request.Params["ddlSel"])) { query.expired = Convert.ToInt32(Request.Params["ddlSel"]); } query.event_type = Request.Params["event_type"]; _promoadditionproceMgr = new PromoAdditionalPriceMgr(mySqlConnectionString); int totalCount = 0; store = _promoadditionproceMgr.Query(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; List<Parametersrc> ProductFreightStore = new List<Parametersrc>(); List<Parametersrc> DeviceStore = new List<Parametersrc>(); List<Parametersrc> EventTypeStore = new List<Parametersrc>(); _ptersrc = new ParameterMgr(mySqlConnectionString); ProductFreightStore = _ptersrc.GetElementType("product_freight");//---deliver_type DeviceStore = _ptersrc.GetElementType("device");//--device EventTypeStore = _ptersrc.GetElementType("event_type");//--event_type foreach (var item in store) { item.event_id = CommonFunction.GetEventId(item.event_type, item.id.ToString()); for (int i = 0; i < ProductFreightStore.Count; i++) { if (int.Parse(ProductFreightStore[i].ParameterCode) == item.deliver_type) { item.deliver_name = ProductFreightStore[i].parameterName; } } for (int i = 0; i < DeviceStore.Count; i++) { if (DeviceStore[i].ParameterCode == item.device) { item.device_name = DeviceStore[i].parameterName; } } //for (int i = 0; i < EventTypeStore.Count; i++) //{ // if (int.Parse(EventTypeStore[i].ParameterCode) == item.event_type) // { // item.device_name = EventTypeStore[i].parameterName; // } //} if (item.banner_image != "") { item.banner_image = imgServerPath + promoPath + item.banner_image; } else { item.banner_image = defaultImg; } } json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, 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,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }