//[SupportFilter] public HttpResponseMessage GetdllBystcode(string stcode, string type) { string result = string.Empty; try { if (string.IsNullOrEmpty(stcode)) { result = rule.JsonStr("error", "缺少城市", ""); } else { RuletblEQI_publi rulep = new RuletblEQI_publi(); List <tblEQI_Item_Group> list = rulep.GetdllBystcode(stcode, type); if (list != null && list.Count > 0) { result = rule.JsonStr("ok", "", list); } else { result = rule.JsonStr("nodata", "没有数据", ""); } } } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage Subtable(string type, string fldAutoId) { string fldAutoID = fldAutoId.ToString(); string listtype = type.ToString(); fldAutoID = fldAutoID.Replace('_', ','); RuletblDictionary dic = new RuletblDictionary(); string list = dic.ByParentIDAndValue("数据审核视图", listtype); string table = list.Split(',')[1]; string execsql = "select fldItemName,fldItemCode,fldItemValue,fldComment from " + table + " where fldAutoID in (" + fldAutoID + ")"; RuletblEQI_publi pub = new RuletblEQI_publi(); DataTable dtItemInfo = pub.getdt(execsql); string json = JsonHelper.SerializeObject(dtItemInfo); #region 返回数据给前台 return(new HttpResponseMessage { Content = new StringContent(json, System.Text.Encoding.UTF8, "application/xm") }); #endregion }
// [SupportFilter] public HttpResponseMessage Geteqicom_data(string type, string wherequery, string pageshow, string cityid) { string returnjson = "[{data: "; try { string sbtype = type; #region 拼接原始条件 string defaultwhere = "";//原始条件 if (wherequery == "undefined" || wherequery == "") { wherequery = " and fldSource=0"; } if (pageshow == "1") { defaultwhere = "fldCityID_Operate=" + cityid + " and fldFlag=0 and fldImport=1 "; } if (pageshow == "0") { defaultwhere = " fldFlag=1 "; } #endregion #region 基本数据获取 RuletblDictionary dic = new RuletblDictionary(); RuleEQICommon_Auditing rulAud = new RuleEQICommon_Auditing(); string list = dic.ByParentIDAndValue("数据审核视图", sbtype); RuletblEQI_publi exec = new RuletblEQI_publi(); string ViewName = list.Split(',')[0].ToString(); string ChinesizeViewName = list.Split(',')[1].ToString(); wherequery = defaultwhere + HttpUtility.UrlDecode(wherequery); DataTable dt = rulAud.GetAuditingDatabyBusinessType(sbtype, ViewName, wherequery, 0);//需要的数据数据 #endregion #region 数据源转化为Json格式 string json = JsonHelper.SerializeObject(dt); returnjson += json; #endregion #region 拼数据对应列名 returnjson += ",head: [";//标题 for (int i = 0; i < dt.Columns.Count; i++) { string engname = "'" + dt.Columns[i].ColumnName + "'"; DataTable dtDesc = rule.ChinesizeTitleNamebyViewName(ChinesizeViewName, engname);//根据视图名称在字典表中查出对应字段的中文名称 if (dtDesc.Rows.Count > 0) { if (i == dt.Columns.Count - 1) { returnjson += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "']}]"; } else { returnjson += "'" + dtDesc.Rows[0]["fldFieldDesc"].ToString() + "',"; } } } #endregion #region 对应列填数据 #endregion #region 最后返回数据给前台 if (dt.Rows.Count > 0) { returnjson = rule.JsonStr("ok", "", returnjson.ToString()); } else { returnjson = rule.JsonStr("nodata", "没有数据", returnjson.ToString()); } } catch (Exception e) { returnjson = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(returnjson, System.Text.Encoding.UTF8, "application/json") }); #endregion }
/// <summary> /// 功能描述:数据插入到临时表 /// 创建 人:周文卿 /// 创建时间:2017/07/11 /// 修改原因: /// 修改时间: /// 修改 人: /// </summary> /// <param name="inputdata">插入的实体类</param> /// <returns>json(是否成功)</returns> public HttpResponseMessage ItemSave(List <tbleqia_rd_table> inputdata) { string returntext = ""; try { Regex regexvalue = new Regex(@"^(\d*\.?\d+)+$"); Regex regexvalue2 = new Regex(@"^(\d*\.?\d+)?[lL]$"); List <tblEQIA_RDPI_Basedata_Pre> lstData = new List <tblEQIA_RDPI_Basedata_Pre>(); tblEQIA_RDPI_Basedata_Pre objData = new tblEQIA_RDPI_Basedata_Pre(); tblEQI_InputDate inputdate_new = new tblEQI_InputDate(); RuletblEQI_publi ruleSense = new RuletblEQI_publi(); for (int i = 0; i < inputdata.Count; i++) { List <tbaeqia_rd_value> valueall = inputdata[i].valueall; for (int j = 0; j < valueall.Count; j++) { RuletblDictionary ruleDict = new RuletblDictionary(); objData.fldSTCode = valueall[j].fldSTCode; objData.fldUserID = int.Parse(inputdata[i].fldUserID); objData.fldFlag = 0; objData.fldCityID_Operate = int.Parse(inputdata[i].fldCityID_Operate); objData.fldCityID_Submit = inputdata[i].fldCityID_Submit; objData.fldDate_Operate = DateTime.Now; decimal dValue = -1; string samphvalue = valueall[j].monitorvalue; #region 因子值的处理 if (samphvalue != "") { if (regexvalue2.IsMatch(samphvalue)) { if (samphvalue.ToLower() == "l") { string itemname = ""; itemname = ruleSense.GetSenseNameBytbl("EQIA_RD", inputdata[i].itemcode); decimal temp = Convert.ToDecimal(valueall[j].monitorvalue); if (temp <= 0) { returntext = "项目的检出限<=0,不能输入 L 作为监测值'"; } dValue = -temp; } else { dValue = -Convert.ToDecimal(samphvalue.Replace("l", "").Replace("L", "")); } if (dValue == -1) { dValue = Convert.ToDecimal(-0.99999999); } } else { dValue = Convert.ToDecimal(samphvalue); } } #endregion tblEQIA_RDPI_Basedata_Pre objTmp = objData.Clone(); objTmp.fldPCode = valueall[j].fldPCode; DateTime time = DateTime.Parse(valueall[j].fldDate.ToString()); objTmp.fldSYear = time.Year; objTmp.fldSMonth = time.Month; objTmp.fldSDay = time.Day; objTmp.fldSHour = 0; objTmp.fldSMinute = 0; objTmp.fldEYear = time.Year; objTmp.fldEMonth = time.Month; objTmp.fldEDay = time.Day; objTmp.fldEHour = 0; objTmp.fldEMinute = 0; objTmp.fldFlag = 0; objTmp.fldImport = 0; objTmp.fldItemCode = inputdata[i].itemcode; objTmp.fldItemValue = dValue; lstData.Add(objTmp); } } RuletblEQIA_RDPI_Basedata_Pre rule_basedata = new RuletblEQIA_RDPI_Basedata_Pre(); bool issave = rule_basedata.InsertAll(lstData); if (issave) { RuleWriteOperateLog rule_wol = new RuleWriteOperateLog(); rule_wol.WriteLog(0, "录入降尘数据到临时表", "", int.Parse(inputdata[0].fldUserID), int.Parse(inputdata[0].fldCityID_Operate)); returntext = rule.JsonStr("ok", "录入成功!您保存的数据,已进入“待提交审核的数据”状态", ""); } else { returntext = rule.JsonStr("error", "录入失败 !请重试!", ""); } } catch (InputException ex) { returntext = rule.JsonStr("error", ex.Message, ""); } catch (InsertException ex) { returntext = rule.JsonStr("error", ex.Message, ""); } catch (Exception ex) { returntext = rule.JsonStr("error", ex.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(returntext, System.Text.Encoding.UTF8, "application/json") }); }