public HttpResponseMessage Gethalfhour(parm reparm) { string result = string.Empty; try { int count = 0; string where = parwhere(reparm); //查询分页的数据 DataTable dt = rule.getpaging("vwtblAgentPay", "*", "1=1" + where, reparm.page, reparm.limit, reparm.sort, out count); getdata getdata = new getdata(); getdata.Table = dt; getdata.total = count; result = rule.JsonStr("ok", "成功", getdata); } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage GetAccountflowlist(parm reparm) { string result = string.Empty; try { int count = 0; string where = parwhere(reparm); DataTable dt = rule.getpaging("vwAccountflow", "*", "1=1" + where, reparm.page, reparm.limit, reparm.sort, out count); getdata getdata = new getdata(); getdata.Table = dt; getdata.total = count; result = rule.JsonStr("ok", "成功", getdata); } catch (Exception e) { //错误保存日志 throw new InsertException(e.Message, " Accountflow", "GetAccountflowlist", reparm.ToString()); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
// public HttpResponseMessage GetSection(string where, int PageIndex, int PageSize, string flag) { string result = string.Empty; try { int count = 0; DataTable dt = rule.getpaging("vwEQIW_R_Section_report", "*", "1=1" + where, PageIndex, PageSize, "fldSTCode", out count); string stcode = "[]"; string year = "[]"; string RVTown = "[]"; string RSTown = "[]"; string rekhcityname = "[]"; string rekhtownname = "[]"; string reSLevel = "[]"; string reRLevel = "[]"; string rebyn = "[]"; string reattribute = "[]"; string rerfunction = "[]"; string rername = "[]"; string rersname = "[]"; string reWaterArea = "[]"; string reRSWaterWork = "[]"; string reControl = "[]"; string rekhscategory = "[]"; string reSCategory = "[]"; if (flag == "1") { DataTable dt1 = rule.getdt("select * from vwEQIW_R_Section_report where 1=1" + where); //城市代码 var fldSTCode = (from x in dt1.AsEnumerable() select new tblEQIW_R_Section { fldSTCode = x.Field <string>("fldSTCode"), fldSTName = x.Field <string>("fldSTName") } ).DistinctBy(x => new { x.fldSTCode, x.fldSTName }).OrderBy(x => x.fldSTCode); stcode = JsonHelper.SerializeObject(fldSTCode); //时间 var fldYear = (from x in dt1.AsEnumerable() select new file { value = x.Field <decimal>("fldYear").ToString(), name = x.Field <decimal>("fldYear").ToString() } ).OrderByDescending(x => x.value).DistinctBy(x => new { x.value }); year = JsonHelper.SerializeObject(fldYear); //所在区县 var fldRVTown = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldRVTown").ToString(), name = x.Field <string>("fldRVTown").ToString() } ).DistinctBy(x => new { x.value }); if (fldRVTown.First().value != "") { RVTown = JsonHelper.SerializeObject(fldRVTown); } //断面名称 var fldRSName = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldRSCode").ToString(), name = x.Field <string>("fldRSName").ToString() } ).DistinctBy(x => new { x.value }); if (fldRSName.First().value != "") { rersname = JsonHelper.SerializeObject(fldRSName); } //考核城市 var khcityname = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldkhcityname").ToString(), name = x.Field <string>("fldkhcityname").ToString() } ).DistinctBy(x => new { x.value }); if (khcityname.First().value != "") { rekhcityname = JsonHelper.SerializeObject(khcityname); } //考核县区 var khtownname = ((from x in dt1.AsEnumerable() where x["fldkhtownname"].ToString() != "" select new file { value = x.Field <string>("fldkhtownname").ToString(), name = x.Field <string>("fldkhtownname").ToString() } ).DistinctBy(x => new { x.value })).ToList(); if (khtownname.Count > 0) { rekhtownname = JsonHelper.SerializeObject(khtownname); } //控制级别 var SLevel = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldSLevel").ToString(), name = x.Field <string>("fldSLevel").ToString() } ).DistinctBy(x => new { x.value }); if (SLevel.First().value != "") { reSLevel = JsonHelper.SerializeObject(SLevel); } //交界级别 var byn = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldbyn").ToString(), name = x.Field <string>("fldbyn").ToString() } ).DistinctBy(x => new { x.value }); if (byn.First().value != "") { rebyn = JsonHelper.SerializeObject(byn); } //断面属性 var attribute = ((from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldAttribute").ToString(), name = x.Field <string>("fldAttribute").ToString() } ).DistinctBy(x => new { x.value })).ToList(); if (attribute.Count > 0) { reattribute = JsonHelper.SerializeObject(attribute); } //断面功能 var rfunction = ((from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldrfunction").ToString(), name = x.Field <string>("fldrfunction").ToString() } ).DistinctBy(x => new { x.value })).ToList(); if (rfunction.Count > 0) { rerfunction = JsonHelper.SerializeObject(rfunction); } //河流名称 var RName = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldRCode").ToString(), name = x.Field <string>("fldRName").ToString() } ).DistinctBy(x => new { x.value }); if (RName.First().value != "") { rername = JsonHelper.SerializeObject(RName); } //所在流域 var WaterArea = ((from x in dt1.AsEnumerable() where x["fldWaterArea"].ToString() != "" select new file { value = x.Field <string>("fldWaterArea").ToString(), name = x.Field <string>("fldWaterArea").ToString() } ).DistinctBy(x => new { x.value })).ToList(); if (WaterArea.Count > 0) { reWaterArea = JsonHelper.SerializeObject(WaterArea); } //所在区县 var fldRSTown = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldRSTown").ToString(), name = x.Field <string>("fldRSTown").ToString() } ).DistinctBy(x => new { x.value }); if (fldRSTown.First().value != "") { RSTown = JsonHelper.SerializeObject(fldRSTown); } //所在河流级别 var RLevel = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldrlevel").ToString(), name = x.Field <string>("fldrlevel").ToString() } ).DistinctBy(x => new { x.value }); if (RLevel.First().value != "") { reRLevel = JsonHelper.SerializeObject(RLevel); } //所属水系 var RSWaterWork = ((from x in dt1.AsEnumerable() where x["fldRSWaterWork"].ToString() != "" select new file { value = x.Field <string>("fldRSWaterWork").ToString(), name = x.Field <string>("fldRSWaterWork").ToString() } ).DistinctBy(x => new { x.value })).ToList(); if (RSWaterWork.Count > 0) { reRSWaterWork = JsonHelper.SerializeObject(RSWaterWork); } //出入境情况 var Control = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldControl").ToString(), name = x.Field <string>("fldControl").ToString() } ).DistinctBy(x => new { x.value }); if (Control.First().value != "") { reControl = JsonHelper.SerializeObject(Control); } //考核属性 var khscategory = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldkhscategory").ToString(), name = x.Field <string>("fldkhscategory").ToString() } ).DistinctBy(x => new { x.value }); if (khscategory.First().value != "") { rekhscategory = JsonHelper.SerializeObject(khscategory); } //断面类别 var SCategory = (from x in dt1.AsEnumerable() select new file { value = x.Field <string>("fldSCategory").ToString(), name = x.Field <string>("fldSCategory").ToString() } ).DistinctBy(x => new { x.value }); if (SCategory.First().value != "") { reSCategory = JsonHelper.SerializeObject(SCategory); } } string d = JsonHelper.SerializeObject(dt); string text = "[{data:" + d + ",count:" + count + ",fldSTCode:" + stcode + ",fldYear:" + year + ",fldRVTown:" + RVTown + ",khcityname:" + rekhcityname + ",khtownname:" + rekhtownname + ",reSLevel:" + reSLevel + ",rebyn:" + rebyn + ",reattribute:" + reattribute + ",rerfunction:" + rerfunction + ",rersname:" + rersname + ",rername:" + rername + ",reWaterArea:" + reWaterArea + ",fldRSTown:" + RSTown + ",reRLevel:" + reRLevel + ",reRSWaterWork:" + reRSWaterWork + ",reControl:" + reControl + ",rekhscategory:" + rekhscategory + ",reSCategory:" + reSCategory + "}]"; if (dt.Rows.Count > 0) { result = rule.JsonStr("ok", "查询成功", text); } else { result = rule.JsonStr("nodata", "没有数据", text); } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }