private void Query1(HttpContext context) { var hashtable = new Hashtable(); var infoReleaseDal = new PowerCutDal(); var businesstype = context.Request.Params["key"]; var total = 0; var page = int.Parse(context.Request["page"] ?? "1"); var rows = int.Parse(context.Request["rows"] ?? "10"); try { var data = infoReleaseDal.QueryByPage(new PowerCut() { BusinessType = businesstype, }, page, rows, ref total); var list = ConvertHelper<PowerCut>.ConvertToList(data); hashtable["rows"] = list.ToList(); hashtable["total"] = total; hashtable["isSuccess"] = true; var json = _jss.Serialize(hashtable); context.Response.Write(json); } catch (Exception e) { hashtable["isSuccess"] = false; var json = _jss.Serialize(hashtable); context.Response.Write(json); Log.Debug(e); } }
/// <summary> /// 查询信息 /// </summary> /// <param name="httpContext"></param> public void QueryPublishInfo(HttpContext httpContext) { var hashtable = new Hashtable(); var infoReleaseDal = new PowerCutDal(); var businesstype = httpContext.Request.Params["businesstype"]; //获取分页数据 var total = 0; var page = int.Parse(httpContext.Request["page"] ?? "1"); var rows = int.Parse(httpContext.Request["rows"] ?? "10"); try { var data = infoReleaseDal.QueryByPage(new PowerCut() { BusinessType = businesstype }, page, rows, ref total); var list = ConvertHelper<PowerCut>.ConvertToList(data); hashtable["rows"] = list.ToList(); hashtable["total"] = total; var json = _jss.Serialize(hashtable); httpContext.Response.Write(json); } catch (Exception e) { Log.Debug("方法名:QueryPowerInfo,描述:查询停电信息方法出错,错误原因:" + e.Message); hashtable["isSuccess"] = false; var json = _jss.Serialize(hashtable); httpContext.Response.Write(json); } }