public void ProcessRequest(HttpContext context) { try { context.Response.ContentType = "text/plain"; string sbid = context.Request["sbid"]; if (!string.IsNullOrEmpty(sbid)) { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = " isbid=" + sbid; DataSet duser = SqlHelper.GetList("v_sbzl_bjzl2", "*", "id", int.Parse(rows), int.Parse(page), false, false, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_sbzl_bjzl2 where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query() { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = "1=1"; //使用存储过程及临时表实现递归方式列表 SqlParameter[] parms = { new SqlParameter("@where", strWhere) }; SqlHelper.ExeNonQuery("proc_getDepartCode", CommandType.StoredProcedure, parms); DataSet duser = SqlHelper.GetList("v_zxzbjl", "*", "drq", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_zxzbjl where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query() { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = GetWhere(); DataSet duser = SqlHelper.GetList("wxgzz", "*", "id", int.Parse(rows), int.Parse(page), false, false, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from wxgzz where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
private void Query(string id) { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = ""; if (!string.IsNullOrEmpty(id)) { strWhere = " ilxid=" + id; } else { strWhere = " 1=1"; } DataSet duser = SqlHelper.GetList("v_djlx_mx", "*", "ilxid", int.Parse(rows), int.Parse(page), false, false, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_djlx_mx where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query(string ygid) { try { //一页显示几行数据,使用该语句在firefox下一页显示不全。 //string rows = HttpContext.Current.Request["rows"]; string rows = "50"; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = " iygid=" + ygid; DataTable dt = new DataTable(); //获取数据源 dt = SqlHelper.GetTable("select * from v_ygqx where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query(string jsid) { try { //一页显示几行数据,使用该语句在firefox下一页显示不全。 //string rows = HttpContext.Current.Request["rows"]; string rows = "50"; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = ""; if (string.IsNullOrEmpty(jsid)) { strWhere = " 1=1 "; } else { if (jsid == "0") { strWhere = " 1>2"; } else { strWhere = " ijsid=" + jsid; } } DataSet duser = new DataSet(); DataTable dt1 = new DataTable(); DataTable dt = new DataTable(); //获取数据源 dt = SqlHelper.GetTable("select * from v_qxgl where " + strWhere); if (dt.Rows.Count > 0) //加载已有权限 { duser = SqlHelper.GetList("v_qxgl", "*", "id", int.Parse(rows), int.Parse(page), false, false, strWhere); } else { dt = SqlHelper.GetTable("select * from v_qxgl2 where " + strWhere); //没有该操作员的权限,加载权限为空 duser = SqlHelper.GetList("v_qxgl2", "*", "id", int.Parse(rows), int.Parse(page), false, false, strWhere); } dt1 = duser.Tables[0]; string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
private void search() { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = ""; string qsrq = HttpContext.Current.Request["qsrq"]; string jzrq = HttpContext.Current.Request["jzrq"]; string scx = HttpContext.Current.Request["scx"]; string jl = HttpContext.Current.Request["jl"]; //string ry = HttpContext.Current.Request["ry"]; strWhere = " drq>='" + qsrq + "' and drq<='" + jzrq + "' and cgzxx like '%" + jl + "%'"; if (scx != "") { strWhere = strWhere + " and cscx='" + scx + "'"; } //if (ry != "") //{ // strWhere = strWhere + " and cwxr='" + ry + "'"; //} //使用存储过程及临时表实现递归方式列表 SqlParameter[] parms = { new SqlParameter("@where", strWhere) }; SqlHelper.ExeNonQuery("proc_getDepartCode", CommandType.StoredProcedure, parms); DataSet duser = SqlHelper.GetList("v_zxzbjl", "*", "drq", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_zxzbjl where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
private void search() { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = ""; string ksrq = HttpContext.Current.Request["ksrq"]; string jsrq = HttpContext.Current.Request["jsrq"]; string line = HttpContext.Current.Request["line"]; string nr = HttpContext.Current.Request["nr"]; //string zdr = HttpContext.Current.Request["zdr"]; strWhere = " dsj>='" + ksrq + "' and dsj<='" + jsrq + "' and cyy like '%" + nr + "%'"; if (line != "") { strWhere = strWhere + " and cscx='" + line + "'"; } //if (zdr != "") //{ // strWhere = strWhere + " and czdr='" + zdr + "'"; //} //使用存储过程及临时表实现递归方式列表 SqlParameter[] parms = { new SqlParameter("@where", strWhere) }; SqlHelper.ExeNonQuery("proc_getDepCode", CommandType.StoredProcedure, parms); DataSet duser = SqlHelper.GetList("v_zzqzjl", "*", "dsj", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_zzqzjl where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query(string bmid) { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = GetWhere(); if (bmid == "1" || string.IsNullOrEmpty(bmid)) { bmid = "1"; } //使用存储过程及临时表实现递归方式列表 SqlParameter[] parms = { new SqlParameter("@id", bmid) }; SqlHelper.ExeNonQuery("get_bmzl2", CommandType.StoredProcedure, parms); DataSet duser = SqlHelper.GetList("v_ygzl", "*", "id", int.Parse(rows), int.Parse(page), false, false, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_ygzl where " + strWhere + " order by cygbh asc"); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); //str = JSonHelper.SerializeObject(dt1); //str ="{ " + "\"total\":" + dt.Rows.Count + "," + "\"rows\":" + str + "}"; HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
//个人通知 private void Show(string user, string sState) { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = "1=1"; if (!string.IsNullOrEmpty(sState) && sState == "s") { if (!string.IsNullOrEmpty(user)) { strWhere = strWhere + " and cdxmc='" + user + "'"; } } else { HttpContext.Current.Response.Write("{ \"total\":0,\"rows\":[]"); return; } DataSet duser = SqlHelper.GetList("tmp_gcstzb", "*", "id", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from tmp_gcstzb where " + strWhere + " order by drq desc"); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
private void search() { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = ""; string rq1 = HttpContext.Current.Request["rq1"]; string rq2 = HttpContext.Current.Request["rq2"]; string proline = HttpContext.Current.Request["proline"]; string txt = HttpContext.Current.Request["txt"]; strWhere = " drq>='" + rq1 + "' and drq<='" + rq2 + "' and csxnr like '%" + txt + "%'"; if (proline != "") { strWhere = strWhere + " and cscx='" + proline + "'"; } DataSet duser = SqlHelper.GetList("v_zxdbsx", "*", "id", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_zxdbsx where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query(string csbid, string sState) { try { if (sState == "" || string.IsNullOrEmpty(sState)) { HttpContext.Current.Response.Write("{ \"total\":0,\"rows\":[]"); return; } //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = "1=1"; if (!string.IsNullOrEmpty(sState) && sState == "s") { if (!string.IsNullOrEmpty(csbid)) { strWhere = strWhere + " and isbid=" + csbid; } } else { HttpContext.Current.Response.Write("{ \"total\":0,\"rows\":[]"); return; } string qsrq = HttpContext.Current.Request["qsrq"]; if (!string.IsNullOrEmpty(qsrq)) { strWhere = strWhere + " and dzysj>='" + qsrq + "'"; } string jzrq = HttpContext.Current.Request["jzrq"]; if (!string.IsNullOrEmpty(jzrq)) { strWhere = strWhere + " and dzysj<='" + jzrq + "'"; } string ckey = HttpContext.Current.Request["ckey"]; string ctext = HttpContext.Current.Request["cmemo"]; if (!string.IsNullOrEmpty(ckey)) { switch (ckey) { case "设备编码": strWhere = strWhere + " and csbbh like '%" + ctext + "%'"; break; case "设备名称": strWhere = strWhere + " and csbmc like '%" + ctext + "%'"; break; case "生产线": strWhere = strWhere + " and cscx like '%" + ctext + "%'"; break; case "所属专业": strWhere = strWhere + " and csszy like '%" + ctext + "%'"; break; case "作业项目": strWhere = strWhere + " and czyxm like '%" + ctext + "%'"; break; case "作业人员": strWhere = strWhere + " and czyry like '%" + ctext + "%'"; break; case "制单人": strWhere = strWhere + " and cczy like '%" + ctext + "%'"; break; case "备注": strWhere = strWhere + " and cbz like '%" + ctext + "%'"; break; } } DataSet duser = SqlHelper.GetList("v_llb", "*", "dzysj", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_llb where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
public void ProcessRequest(HttpContext context) { try { context.Response.ContentType = "text/plain"; StringBuilder sb = new StringBuilder(); string action = context.Request["action"]; string value = context.Request["txt"]; string state = context.Request["state"]; string sbid = context.Request["sbid"]; //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; if (state == "1") { string strWhere = ""; if (!string.IsNullOrEmpty(value)) { strWhere = " typename='" + value + "'"; } else { strWhere = " 1>2"; } DataSet duser = SqlHelper.GetList("v_djcs", "*", "iNumber", int.Parse(rows), int.Parse(page), false, false, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_djcs where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } else if (state == "2") { string strWhere = ""; if (string.IsNullOrEmpty(sbid)) { strWhere = " 1=1"; } else { strWhere = " isbid=" + sbid; } DataSet duser = SqlHelper.GetList("v_sbzl_djcs", "*", "iNumber", int.Parse(rows), int.Parse(page), false, false, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_sbzl_djcs where " + strWhere); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query(string csbid, string sState) { try { if (sState == "" || string.IsNullOrEmpty(sState)) { HttpContext.Current.Response.Write("{ \"total\":0,\"rows\":[]"); return; } //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string strWhere = "1=1"; if (!string.IsNullOrEmpty(sState) && sState == "s") { if (!string.IsNullOrEmpty(csbid)) { strWhere = strWhere + " and isbid=" + csbid; } } else { HttpContext.Current.Response.Write("{ \"total\":0,\"rows\":[]"); return; } string qsrq = HttpContext.Current.Request["qsrq"]; if (!string.IsNullOrEmpty(qsrq)) { strWhere = strWhere + " and dtxrq>='" + qsrq + "'"; } string jzrq = HttpContext.Current.Request["jzrq"]; if (!string.IsNullOrEmpty(jzrq)) { strWhere = strWhere + " and dtxrq<='" + jzrq + "'"; } string ckey = HttpContext.Current.Request["ckey"]; string ctext = HttpContext.Current.Request["cmemo"]; if (!string.IsNullOrEmpty(ckey)) { switch (ckey) { case "单号": strWhere = strWhere + " and cdh like '%" + ctext + "%'"; break; case "设备编号": strWhere = strWhere + " and csbbh like '%" + ctext + "%'"; break; case "设备名称": strWhere = strWhere + " and csbmc like '%" + ctext + "%'"; break; case "生产线": strWhere = strWhere + " and cscx like '%" + ctext + "%'"; break; case "停机种类": strWhere = strWhere + " and ctjzl like '%" + ctext + "%'"; break; case "现象描述": strWhere = strWhere + " and cxxms like '%" + ctext + "%'"; break; case "解决方案": strWhere = strWhere + " and cjjfa like '%" + ctext + "%'"; break; case "原因分析": strWhere = strWhere + " and cyyfx like '%" + ctext + "%'"; break; case "改善对策": strWhere = strWhere + " and cgsdc like '%" + ctext + "%'"; break; case "作业人": strWhere = strWhere + " and ctjr like '%" + ctext + "%'"; break; case "制单人": strWhere = strWhere + " and cczy like '%" + ctext + "%'"; break; case "辅助人员": strWhere = strWhere + " and cfzry like '%" + ctext + "%'"; break; case "备注": strWhere = strWhere + " and cbz like '%" + ctext + "%'"; break; } } DataSet duser = SqlHelper.GetList("v_tjjl", "*", "id", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_tjjl where " + strWhere + " order by dtxrq desc"); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
//生成检修计划 private void Search() { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; if (HttpContext.Current.Request["data"] == "no") { HttpContext.Current.Response.Write("{ \"total\":0,\"rows\":[]"); return; } string value = HttpContext.Current.Request["data"]; string[] strr = value.Split('&'); string s_where = "czt='持续中'"; string s_csbbh = strr[0].Split('=')[1]; if (s_csbbh.Trim().Length > 0) { s_where = s_where + " and csbbh like '%" + s_csbbh + "%'"; } string s_csbmc = strr[1].Split('=')[1]; if (s_csbmc.Trim().Length > 0) { s_where = s_where + " and csbmc like '%" + s_csbmc + "%'"; } string s_cscx = strr[2].Split('=')[1]; if (s_cscx.Trim().Length > 0) { s_where = s_where + " and iscxid = '" + s_cscx + "'"; } string s_csszy = strr[3].Split('=')[1]; if (s_csszy.Trim().Length > 0) { s_where = s_where + " and izyid='" + s_csszy + "'"; } string s_csxlx = strr[4].Split('=')[1]; if (s_csxlx.Trim().Length > 0) { s_where = s_where + " and csxlx like '%" + s_csxlx + "%'"; } string s_cdbr = strr[5].Split('=')[1]; if (s_cdbr.Trim().Length > 0) { s_where = s_where + " and cdbr like '%" + s_cdbr + "%'"; } string s_cnr = strr[6].Split('=')[1]; if (s_cnr.Trim().Length > 0) { s_where = s_where + " and csxnr like '%" + s_cnr + "%'"; } string s_cclfs = strr[7].Split('=')[1]; if (s_cclfs.Trim().Length > 0) { s_where = s_where + " and cclfs like '%" + s_cclfs + "%'"; } DataSet duser = SqlHelper.GetList("v_dbsx", "*", "czt", int.Parse(rows), int.Parse(page), false, false, s_where); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_dbsx where " + s_where + " order by drq desc"); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); }
/// <summary> /// 获取文件列表 /// </summary> public void Query() { try { string strConn = ConfigurationManager.ConnectionStrings["sqlCon"].ConnectionString; SqlConnection con = new SqlConnection(strConn); con.Open(); SqlTransaction sqltra = con.BeginTransaction(); //开始事务 SqlCommand cmd = new SqlCommand(); cmd.Connection = con; //获取数据连接 cmd.Transaction = sqltra; //,在执行SQL时 string sql = "delete from bflb"; cmd.CommandText = sql; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); string dirPath = ConfigurationManager.ConnectionStrings["bakpath"].ConnectionString; if (Directory.Exists(dirPath)) { //获得目录信息 DirectoryInfo dir = new DirectoryInfo(dirPath); //获得目录文件列表 FileInfo[] files = dir.GetFiles("*.bak"); //string[] fileNames = new string[files.Length]; //int i = 0; foreach (FileInfo fileInfo in files) { //fileNames[i] = fileInfo.Name; //i++; SqlParameter[] parms = { new SqlParameter("@bfwj", fileInfo.Name), }; SqlCommand com = new SqlCommand(); com.Connection = con; //获取数据连接 com.Transaction = sqltra; //,在执行SQL时 com.CommandText = "insert_bflb"; com.CommandType = CommandType.StoredProcedure; foreach (SqlParameter p in parms) { com.Parameters.Add(p); } com.ExecuteNonQuery(); } sqltra.Commit(); //提交事务 if (con.State == ConnectionState.Open) { con.Close(); } con.Dispose(); } string strWhere = "1=1"; //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; DataSet duser = SqlHelper.GetList("bflb", "*", "id", int.Parse(rows), int.Parse(page), false, false, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from bflb"); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 查询的方法 /// </summary> private void Query() { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string state = HttpContext.Current.Request["state"]; if (string.IsNullOrEmpty(state)) { HttpContext.Current.Response.Write("{ \"total\":0,\"rows\":[]"); return; } string strWhere = "1=1"; string qsrq = HttpContext.Current.Request["qsrq"]; if (!string.IsNullOrEmpty(qsrq)) { strWhere = strWhere + " and drq>='" + qsrq + "'"; } string jzrq = HttpContext.Current.Request["jzrq"]; if (!string.IsNullOrEmpty(jzrq)) { strWhere = strWhere + " and drq<='" + jzrq + "'"; } string ckey = HttpContext.Current.Request["ckey"]; string ctext = HttpContext.Current.Request["cmemo"]; if (!string.IsNullOrEmpty(ckey)) { switch (ckey) { case "对象": strWhere = strWhere + " and cdx like '%" + ctext + "%'"; break; case "对象名称": strWhere = strWhere + " and cdxmc like '%" + ctext + "%'"; break; case "记录": strWhere = strWhere + " and cjl like '%" + ctext + "%'"; break; case "制单人": strWhere = strWhere + " and cczy like '%" + ctext + "%'"; break; } } DataSet duser = SqlHelper.GetList("v_gcstz", "*", "id", int.Parse(rows), int.Parse(page), false, true, strWhere); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_gcstz where " + strWhere + " order by drq desc"); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }
/// <summary> /// 高级查询 /// </summary> /// <returns></returns> public void Search() { try { //一页显示几行数据 string rows = HttpContext.Current.Request["rows"]; //当前页 string page = HttpContext.Current.Request["page"]; string value = HttpContext.Current.Request["data"]; string[] strr = value.Split('&'); string s_where = "1=1"; string s_csbbh = strr[0].Split('=')[1]; if (s_csbbh.Trim().Length > 0) { s_where = s_where + " and csbbh like '%" + s_csbbh + "%'"; } string s_csbmc = strr[1].Split('=')[1]; if (s_csbmc.Trim().Length > 0) { s_where = s_where + " and csbmc like '%" + s_csbmc + "%'"; } string s_csszy = strr[2].Split('=')[1]; if (s_csszy.Trim().Length > 0) { s_where = s_where + " and izyid='" + s_csszy + "'"; } string s_cscx = strr[3].Split('=')[1]; if (s_cscx.Trim().Length > 0) { s_where = s_where + " and iscxid = '" + s_cscx + "'"; } string s_cjllx = strr[4].Split('=')[1]; if (s_cjllx.Trim().Length > 0) { s_where = s_where + " and typename like '%" + s_cjllx + "%'"; } string s_cdjr = strr[5].Split('=')[1]; if (s_cdjr.Trim().Length > 0) { s_where = s_where + " and cdjr like '%" + s_cdjr + "%'"; } sys ex = new sys(); string s_dtp1 = strr[6].Split('=')[1]; if (ex.isDate(s_dtp1) == true) { s_dtp1 = s_dtp1.Replace("+", " "); //替换+为空,日期提交后格式为:2016-05-30+10:00:00 if (s_dtp1.Trim().Length > 0) { s_where = s_where + " and drq>= '" + s_dtp1 + "'"; } } string s_dtp2 = strr[7].Split('=')[1]; if (ex.isDate(s_dtp2) == true) { s_dtp2 = s_dtp2.Replace("+", " "); if (s_dtp2.Trim().Length > 0) { s_where = s_where + " and drq<= '" + s_dtp2 + "'"; } } DataSet duser = SqlHelper.GetList("v_djjl", "*", "id", int.Parse(rows), int.Parse(page), false, true, s_where); DataTable dt1 = duser.Tables[0]; //获取数据源 DataTable dt = SqlHelper.GetTable("select * from v_djjl where " + s_where + " order by drq desc"); string str = string.Empty; //将数据转换成json格式 str = JSonHelper.CreateJsonParameters(dt1, true, dt.Rows.Count); HttpContext.Current.Response.Write(str); } catch (Exception ex) { sys e = new sys(); e.GetLog(ex); } }