/// <summary> /// 获取峰谷平尖价格 /// </summary> /// <param name="context"></param> /// <returns></returns> public string GetPrice(HttpContext context) { var chargpricebll = new ChargPriceBll(); var chargprice = new ChargPrice(); string str; try { var dt = chargpricebll.Query(chargprice); str = ConvertToJson.DataTableToJson("rows", dt); str += "|"; } catch (Exception e) { Log.Error(e); throw; } return(str); }
public string InitTable(HttpContext context) { var chargpricebll = new ChargPriceBll(); var chargprice = new ChargPrice(); var jss = new JavaScriptSerializer(); string str; const int count = 0; try { var dt = chargpricebll.Query(chargprice); var list = ConvertHelper <ChargPrice> .ConvertToList(dt); str = jss.Serialize(list); str = str.Substring(1, str.Length - 2); str = "{\"total\":\"" + count + "\",\"rows\":[" + str + "]}"; } catch (Exception e) { Log.Error(e); throw; } return(str); }