public HttpResponseMessage Reissuenotice(List <tblOrdertable> ordertables) { string result = string.Empty; string orid = ""; try { //循环多条订单 for (int i = 0; i < ordertables.Count; i++) { //获得商户的Key RuleCommon rule = new RuleCommon(); DataTable Merchant = rule.getdt("select * from tbleMerchant where fldMerchID='" + ordertables[i].fldMerchID + "'"); //获得异步通知地址 AsynParameterPay asynParameter = new AsynParameterPay(); asynParameter.Amount = ordertables[i].fldOrderAmount.ToString(); asynParameter.MerchantId = ordertables[i].fldMerchID; asynParameter.OrderID = ordertables[i].fldOrdernum; asynParameter.OrderTime = ordertables[i].fldchangstautetime.ToString(); asynParameter.Paystate = ordertables[i].fldStaute; asynParameter.Paytype = ordertables[i].fldRateName.ToString(); asynParameter.ProductName = ordertables[i].fldOrederdetailed.ToString(); string getpram = JsonHelper.SerializeObject(asynParameter); //json 转换成Dictionary Dictionary <string, string> valuePairs = JsonHelper.DeserializeStringToDictionary <string, string>(getpram); //排序 RulePayBehavior behavior = new RulePayBehavior(); string pxrams = behavior.AsciiDesc(valuePairs); //添加key值 pxrams += "key=" + Merchant.Rows[0]["fldSecretKey"].ToString(); //md5加密 string signkey = behavior.EncryptionMd5(pxrams); asynParameter.Sign = signkey; //转换成json 格式 string prams = JsonHelper.SerializeObject(asynParameter); //请求 通知 RulePayRequest rulePayRequest = new RulePayRequest(); string rest = rulePayRequest.PostUrl(ordertables[i].fldNotice.ToString(), prams); if (rest == "ok") { result = "成功" + i + 1; } } result = rule.JsonStr("ok", "成功", result); } catch (Exception e) { //错误保存日志 throw new InsertException(e.Message, " Ordertable", "Reissuenotice", "补发通知失败,失败订单号:" + orid); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage GetFilter(string type, string field) { string returntxt = ""; string strsql = ""; if (type.Contains(",") == true) { if (type.Split(',')[1] != "") { string strLocalpathother = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/Config/" + type.Split(',')[1] + ".json"); //配置的json文件地址 strLocalpath = strLocalpathother; //这个操作是为了区分各个系统 以防更改了河北的配置导致重庆的也一同更改了 } } DataTable dt = new DataTable(); try { string getjson = rule.GetJson(strLocalpath);//json配置文件转换 JArray jsonObj = JArray.Parse(getjson); for (int i = 0; i < jsonObj.Count; i++) { string typemodel = jsonObj[i]["type"].ToString(); if (type.Split(',')[0] == typemodel) { JArray jsonObjs = JArray.Parse(jsonObj[i]["condition"].ToString()); JArray jsonend = JArray.Parse(jsonObjs[0]["one"].ToString()); for (int j = 0; j < jsonend.Count; j++) { if (jsonend[j]["value"].ToString() == field) { string isTranslate = jsonend[j]["istranslate"].ToString(); if (isTranslate == "yes") { dt = rule.GetFiled(jsonObj[i]["table"].ToString(), field, jsonend[j]["dictionaries"].ToString()); } else { strsql = "select distinct " + field + " as 'label'," + field + " as 'value' from " + jsonObj[i]["table"].ToString() + ""; dt = rule.getdt(strsql); } returntxt = rule.JsonStr("ok", "", dt); } } } } } catch (Exception e) { returntxt = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(returntxt, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage GetCityList() { string retstr = "";//需要返回的字符串 try { DataTable dt = rule.getdt("select fldSTCode,fldSTName,fldAutoId,fldParentID from LAPtblFW_RegCity"); string datastr = JsonHelper.SerializeObject(dt); retstr += rule.JsonStr("ok", "", datastr); } catch (Exception e) { retstr = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(retstr, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage Execute_usp_getEQIN_F_Value_ByAllForGis() { string result = null; DataTable dt = new DataTable(); try { dt = rule.ExecProcessPrd("usp_getEQIN_F_Value_ByAllForGis", null, null); dt.Columns.Add("fldStaLod", typeof(string)); dt.Columns.Add("fldStaLad", typeof(string)); DataTable dt2 = rule.getdt("select * from tblEQIN_F_Point"); foreach (DataRow item in dt.Rows) { foreach (DataRow item2 in dt2.Rows) { if ( item["fldSTCode"].ToString() == item2["fldSTCode"].ToString() && item["fldPCode"].ToString() == item2["fldPCode"].ToString() && item["fldYear"].ToString() == item2["fldYear"].ToString() ) { item["fldStaLod"] = item2["fldStaLod"]; item["fldStaLad"] = item2["fldStaLad"]; } } } result = rule.JsonStr("ok", "", dt); } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage Updatestate(string fldAutoID) { string result = string.Empty; try { rule.getdt("update tblAgentPay set fldPayState='待审核' where fldAutoID in (" + fldAutoID + ")"); result = rule.JsonStr("ok", "成功", ""); } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage GetSection(string year) { string result = string.Empty; try { DataTable dt = new DataTable(); dt = rule.getdt("select * from tblEQIW_N_Section where fldyear=" + year); result = rule.JsonStr("ok", "", dt); return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); } }
public HttpResponseMessage GetUserList() { string result = string.Empty; try { string sql = "select [fldAutoID],[fldUserName] from LAPtblFW_User"; DataTable dt = rule.getdt(sql); if (dt.Rows.Count > 0) { result = rule.JsonStr("ok", "", dt); } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage GetOneHour_data(string vname, string btype, string strwhere) { string json = "[{data: "; try { RuletblEQIW_R_HourData_Auto rules = new RuletblEQIW_R_HourData_Auto(); if (strwhere == null || strwhere == "undefind") { strwhere = "" ; } DataTable dt = rules.getOneHour_Data(vname, strwhere); string sql1 = "select * from tblEQIW_R_Item_Auto"; DataTable tableitem = rule.getdt(sql1); DataRow dr = dt.NewRow(); dr["fldSTName"] = "城市名称"; dr["fldRName"] = "河流名称"; dr["fldRSName"] = "断面名称"; dr["fldDate"] = "监测日期"; dr["fldTime"] = "监测时间"; for (int i = 6; i < dt.Columns.Count; i++) { DataRow[] dataRows = tableitem.Select("fldItemCode='" + dt.Columns[i].ToString().Substring(3) + "'"); if (dataRows.Length > 0) { dr[dt.Columns[i].ToString()] = dataRows[0]["fldUnit"].ToString(); } } dt.Rows.InsertAt(dr, 0); string jsondt = JsonHelper.SerializeObject(dt); json += jsondt; #region 拼数据对应列名 json += ",head: ["; RuletblEQIA_R_Item itemnames = new RuletblEQIA_R_Item(); //拼标题并汉化 for (int i = 0; i < dt.Columns.Count; i++) { string engname = "'" + dt.Columns[i].ColumnName + "'"; DataTable dtDesc = rule.ChinesizeTitleNamebyViewName(vname, engname);//根据视图名称在字典表中查出对应字段的中文名称 if (dtDesc.Rows.Count > 0) { if (i == dt.Columns.Count - 1) { json += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "']}]"; } else { json += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "',"; } } else { string itemcode = dt.Columns[i].ColumnName.Substring(3); tblEQIA_R_Item name = itemnames.ByItemCodes(itemcode, btype, ""); if (i == dt.Columns.Count - 1) { //最后一列的时候添加“]”↓ json += "'" + name.fldItemName + "']}]"; } else { json += "'" + name.fldItemName + "',"; } } } #endregion if (dt.Rows.Count > 0) { json = rule.JsonStr("ok", "", json.ToString());//有数据 } else { json = rule.JsonStr("nodata", "没有数据", json.ToString());//没数据 } } catch (Exception e) { json = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(json, 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") }); }
public HttpResponseMessage GetAutoAvge(Query_WithDate_Info info) { string result = string.Empty; try { RuletblEQIW_R_HourData_Auto auto = new RuletblEQIW_R_HourData_Auto(); DataTable dt = null; //获得点位对应的因子 DataTable dt1 = new DataTable(); //string sql = "select * from tblRSNameCorItemName"; //dt1 = rule.getdt(sql); string sql1 = "select * from tblEQIW_R_Item_Auto"; DataTable tableitem = rule.getdt(sql1); //获得不同的数据源 if (info.type == "hour") { dt = auto.GetHourData(info.fldBeginDate, info.fldEndDate, info.fldSTCode, info.fldItemCode); dt.Columns.Remove("fldYear"); dt.Columns.Remove("fldMonth"); dt.Columns.Remove("fldDay"); dt.Columns.Remove("fldHour"); DataRow dr = dt.NewRow(); dr["fldSTName"] = "城市名称"; dr["fldSTCode"] = "城市代码"; dr["fldRName"] = "河流名称"; dr["fldRCode"] = "河流代码"; dr["fldRSName"] = "断面名称"; dr["fldRSCode"] = "断面代码"; dr["fldDate"] = "监测日期"; dr["fldTime"] = "监测时间"; for (int i = 8; i < dt.Columns.Count; i++) { DataRow[] dataRows = tableitem.Select("fldItemName='" + dt.Columns[i].ToString() + "'"); if (dataRows.Length > 0) { dr[dt.Columns[i].ToString()] = dataRows[0]["fldUnit"].ToString(); } } dt.Rows.InsertAt(dr, 0); } else { //获得均值 dt = auto.GetAutoAvg(info.type, info.fldBeginDate, info.fldEndDate, info.fldSTCode, info.fldItemCode); dt.Columns.Remove("fldYear"); dt.Columns.Remove("fldMonth"); dt.Columns.Remove("fldDay"); dt.Columns.Remove("fldCount"); DataRow dr = dt.NewRow(); dr["fldSTName"] = "城市名称"; dr["fldSTCode"] = "城市代码"; dr["fldRName"] = "河流名称"; dr["fldRCode"] = "河流代码"; dr["fldRSName"] = "断面名称"; dr["fldRSCode"] = "断面代码"; dr["fldDate"] = "监测日期"; for (int i = 7; i < dt.Columns.Count; i++) { DataRow[] dataRows = tableitem.Select("fldItemName='" + dt.Columns[i].ToString() + "'"); if (dataRows.Length > 0) { dr[dt.Columns[i].ToString()] = dataRows[0]["fldUnit"].ToString(); } } dt.Rows.InsertAt(dr, 0); } //替换空值和没有仪器的值 for (int i = 0; i < dt.Rows.Count; i++) { for (int j = 0; j < dt.Columns.Count; j++) { ////先判断断面代码 //if (dt.Rows[i]["fldRSName"].ToString() == dt1.Rows[j]["fldRSCName"].ToString()) //{ // string coritem = dt1.Rows[j]["fldItemName"].ToString(); // //再判断因子 // for (int h = 8; h < dt.Columns.Count; h++) // { // //不包含这个因子 且数据为空时为无仪器的数据 // if (!coritem.Contains(dt.Columns[h].ColumnName.ToString()) && dt.Rows[i][h].ToString() == "") // { // dt.Rows[i][h] = "无仪器"; // } // //包含这个因子 但是没有数据用/表示 // if (coritem.Contains(dt.Columns[h].ColumnName.ToString()) && dt.Rows[i][h].ToString() == "") // { // dt.Rows[i][h] = "/"; // } // } //} if (dt.Rows[i][j].ToString() == "") { dt.Rows[i][j] = "-"; } } } result = rule.JsonStr("ok", "", dt); } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }