private void client_list(String date, String user_id) { //String sql = "SELECT TOP " + Convert.ToInt32(Request["rows"].ToString()) + " id ,User_ID, Code, Name, Type_ID, Address,'' as call_order,'' as job_content,''as states FROM sqb_client where user_id='"+user_id+"' and(id >= ( SELECT ISNULL(MAX(id),0) FROM (SELECT TOP (" + Convert.ToInt32(Request["rows"].ToString()) + "*(" + Convert.ToInt32(Request["page"].ToString()) + "-1)+1) id FROM sqb_client ORDER BY id ) A ))"; String sql = "SELECT TOP " + Convert.ToInt32(Request["rows"].ToString()) + " id ,User_ID, Code, Name, Type_ID, Address,'' as call_order,'' as job_content,''as states FROM (SELECT ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,* FROM sqb_client where user_id='" + user_id + "') A WHERE RowNumber > (" + Convert.ToInt32(Request["rows"].ToString()) + "*(" + Convert.ToInt32(Request["page"].ToString()) + "-1))"; SqlConn conn = new SqlConn(); SqlConnection con = conn.GetConn(conn.GetConnStr()); con.Open(); mytable = SqlQuery.GetNotOpenDataTable(sql, con); if (mytable.Rows.Count != 0) { for (int i = 0; i < mytable.Rows.Count; i++) { sql = "select call_order,job_content from client_list where CONVERT(varchar(100), date, 23)='" + date + "' and code='" + mytable.Rows[i]["code"] + "' order by call_order"; tb = SqlQuery.GetNotOpenDataTable(sql, con); try { mytable.Rows[i]["job_content"] = tb.Rows[0]["job_content"].ToString(); mytable.Rows[i]["states"] = mytable.Rows[i]["code"].ToString() + mytable.Rows[i]["id"]; mytable.Rows[i]["call_order"] = tb.Rows[0]["call_order"].ToString(); } catch (Exception ex) { mytable.Rows[i]["states"] = mytable.Rows[i]["id"].ToString(); } } con.Close(); for (int i = 0; i < mytable.Rows.Count; i++) { json1 += "{\"id\":\"" + mytable.Rows[i]["id"] + "\",\"user_id\":\"" + mytable.Rows[i]["user_id"] + "\",\"client_code\":\"" + mytable.Rows[i]["code"] + "\",\"client_name\":\"" + mytable.Rows[i]["name"] + "\",\"mendian_type\":\"" + mytable.Rows[i]["Type_ID"] + "\",\"address\":\"" + mytable.Rows[i]["address"] + "\",\"no\":\"" + mytable.Rows[i]["Call_Order"] + "\",\"job_content\":\"" + mytable.Rows[i]["job_content"] + "\",\"baifang\":\"" + mytable.Rows[i]["states"] + "\"},"; } sql = "select count(*) from sqb_client"; tb = SqlQuery.GetDataTable(sql); json1 = "{ \"total\":\"" + tb.Rows[0][0].ToString() + "\",\"rows\":" + "[" + json1.Substring(0, json1.Length - 1) + "]" + "}"; Response.Write(json1); Response.End(); } }
/// <summary> /// constructed function /// </summary> /// <param name="option"></param> public RewardController(IOptions <SiteConfig> option) { Config = option.Value; connStr = SqlConn.GetConn(Config); }
/// <summary> /// constructed function /// </summary> /// <param name="option"></param> public PowPoolDailyRewardController(IOptions <SiteConfig> option) { Config = option.Value; connStr = SqlConn.GetConn(Config); zone = int.Parse(AppConfigurtaionServices.Configuration.GetSection("Zone").Value); }
public DposDetailsController(IOptions <SiteConfig> option) { Config = option.Value; connStr = SqlConn.GetConn(Config); }