public HttpResponseMessage GetCityLIST(string stcode) { string result = ""; string where = "1=1"; try { if (rule.Judge(stcode)) { where += " and fldSTCode='" + stcode + "'"; } string sql = "select * from tblFW_RegCity where " + where + " and fldParentID='2'"; DataTable dt = rule.GetMiddleData(sql); 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 GetSectiondata(DataParameter DP) { string result = ""; string defwhere = "1=1"; string defwhere2 = "1=1"; string where1 = ""; string where2 = ""; string where3 = ""; try { if (rule.Judge(DP.stcode)) { defwhere += " and fldSTCode='" + DP.stcode + "'"; defwhere2 += " and fldSTCode='" + DP.stcode + "'"; } if (rule.Judge(DP.stname)) { defwhere += " and fldSTName='" + DP.stname + "'"; defwhere2 += " and fldSTName='" + DP.stname + "'"; } if (rule.Judge(DP.lcode)) { defwhere += " and fldLCode='" + DP.lcode + "'"; defwhere2 += " and fldLCode='" + DP.lcode + "'"; } if (rule.Judge(DP.lname)) { defwhere += " and fldLName='" + DP.lname + "'"; defwhere2 += " and fldLName='" + DP.lname + "'"; } if (rule.JudgeLevel(DP.level)) { defwhere += " and fldSLevel='" + DP.level + "'"; defwhere2 += " and fldSLevel='" + DP.level + "'"; } if (rule.Judge(DP.TimeType)) { defwhere += " and fldDType='" + DP.TimeType + "'"; defwhere2 += " and fldDType='累计'"; } else { result = rule.JsonStr("error", "时间类型不正确!", ""); return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); } #region if (rule.istime(DP.BeginDate) && rule.istime(DP.EndDate)) { if (DP.TimeType == "month") { DateTime dtime = DateTime.Parse(DP.BeginDate); if (dtime.Month < 10) { string ti = dtime.Year + "年0" + dtime.Month + "月"; where1 += " and fldDate='" + ti + "'"; where2 += rule.strtime(ti, "累计"); where3 += " and fldDate='" + (dtime.Year - 1) + "年0" + dtime.Month + "月" + "'"; } else { string ti = dtime.Year + "年" + dtime.Month + "月"; where1 += " and fldDate='" + ti + "'"; where2 += rule.strtime(ti, "累计"); where3 += " and fldDate='" + (dtime.Year - 1) + "年" + dtime.Month + "月" + "'"; } } if (DP.TimeType == "sea") { DateTime dtime = DateTime.Parse(DP.EndDate); string ti3 = dtime.Year + "年" + dtime.Month + "月"; string ti = ""; string ti2 = ""; if (dtime.Month == 3) { ti = dtime.Year + "年1季度"; ti2 = (dtime.Year - 1) + "年1季度"; } if (dtime.Month == 6) { ti = dtime.Year + "年2季度"; ti2 = (dtime.Year - 1) + "年2季度"; } if (dtime.Month == 9) { ti = dtime.Year + "年3季度"; ti2 = (dtime.Year - 1) + "年3季度"; } if (dtime.Month == 12) { ti = dtime.Year + "年4季度"; ti2 = (dtime.Year - 1) + "年4季度"; } where1 += " and fldDate='" + ti + "'"; where2 += rule.strtime(ti3, "累计"); where3 += " and fldDate='" + ti2 + "'"; } if (DP.TimeType == "year") { DateTime dtime = DateTime.Parse(DP.EndDate); string ti3 = dtime.Year + "年"; string ti = ""; string ti2 = (dtime.Year - 1) + "年"; where1 += " and fldDate='" + ti3 + "'"; where2 += rule.strtime(ti3, "累计"); where3 += " and fldDate='" + ti2 + "'"; } } else { result = rule.JsonStr("error", "时间格式不正确!", ""); return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); } #endregion //当期 string sql = "select * from vwtblEQIW_L_SectionData where " + defwhere + where1; //累计 string sql2 = "select * from vwtblEQIW_L_SectionData where " + defwhere2 + where2; //同期 string sql3 = "select * from vwtblEQIW_L_SectionData where " + defwhere + where3; DataTable dt = rule.GetMiddleData(sql); DataTable dt2 = rule.GetMiddleData(sql2); DataTable dt3 = rule.GetMiddleData(sql3); retudt tt = new retudt(); tt.DQ = dt; tt.LJ = dt2; tt.TQ = dt3; result = rule.JsonStr("ok", "", tt); } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }
public HttpResponseMessage Getisodata(DataParameter DP) { string result = ""; string defwhere = "1=1"; string defwhere2 = "1=1"; string where1 = ""; string level = ""; string where2 = ""; string where3 = ""; try { if (rule.Judge(DP.stcode)) { defwhere += " and fldSTCode like '%" + DP.stcode.Substring(0, 4) + "%'"; } if (rule.Judge(DP.stname)) { defwhere += " and fldSTName='" + DP.stname + "'"; } if (rule.Judge(DP.pcode)) { defwhere += " and fldPCode='" + DP.pcode + "'"; } #region if (rule.istime(DP.BeginDate) && rule.istime(DP.EndDate)) { if (DP.TimeType == "year") { DateTime dtime = DateTime.Parse(DP.EndDate); int ti3 = dtime.Year; int ti2 = (dtime.Year - 1); where1 += " and fldYear='" + ti3 + "'"; where3 += " and fldYear='" + ti2 + "'"; } } else { result = rule.JsonStr("error", "时间格式不正确!", ""); return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); } #endregion //当期 string sql = "select * from vwtblEQISO_Point where " + defwhere + where1; //同期 string sql3 = "select * from vwtblEQISO_Point where " + defwhere + where3; DataTable dt = rule.GetMiddleData(sql); DataTable dt3 = rule.GetMiddleData(sql3); retudt tt = new retudt(); tt.DQ = dt; tt.TQ = dt3; result = rule.JsonStr("ok", "", tt); } catch (Exception e) { result = rule.JsonStr("error", e.Message, ""); } return(new HttpResponseMessage { Content = new StringContent(result, System.Text.Encoding.UTF8, "application/json") }); }