using SQLData; using System; using System.Collections.Generic; using System.Data; using System.Text; using System.Web; namespace SiteCore.Handler { public partial class sync { public void get_ech_line() { string st = GetString("st"); string et = GetString("et"); StringBuilder sql = new StringBuilder(); if (st != "" && et != "") { sql.AppendFormat("select * from s_win where ctime>='{0}' and ctime<='{1}' order by ctime asc;", st, et); } else { string ct = GetString("ct"); DateTime dTime = DateTime.Now; DateTime eTime = DateTime.Now; if (ct == "1") { if (dTime.Hour >= 0 && dTime.Hour <= 10) { dTime = dTime.AddDays(-1); } eTime = dTime; } else { if (dTime.Hour >= 0 && dTime.Hour <= 10) { dTime = dTime.AddDays(-2); eTime = eTime.AddDays(-1); } else { dTime = dTime.AddDays(-1); } } sql.AppendFormat("select * from s_win where ctime>='{0}' and ctime<='{1}' order by ctime asc;", dTime.ToString("yyyy-MM-dd"), eTime.ToString("yyyy-MM-dd")); } //sql.AppendFormat("select * from s_winstr ;"); DataSet ds = DbHelper.DbConn.ExecuteDataset(sql.ToString()); //DataTable dt= DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0]; DataTable dt = ds.Tables[0]; // DataTable sDt = ds.Tables[1]; if (dt != null && dt.Rows.Count > 0) { List lst = new List(); int suc = 0; foreach (DataRow dr in dt.Rows) { getLineStr(dr["cstr"].ToString(), ref suc, ref lst); } if (lst.Count > 0) { string data = string.Join(",", lst.ToArray()); returnSuccessMsg(data); return; //litCon.Text = ""; } } returnSuccess("[]"); } private void getLineStr(string cstr, ref int suc, ref List lst) { string[] sArr = cstr.Split(','); for (int i = 0; i < sArr.Length; i++) { if (sArr[i] == "1") { suc++; } else if (sArr[i] == "0") { suc--; } lst.Add(suc.ToString()); } } public void get_dd_kai() { string sql = "select top 1 svalue from s_winstr ;"; object result = DbHelper.DbConn.ExecuteScalar(sql); if (result != null && result.ToString() != "") { returnSuccessMsg(result.ToString()); return; } returnSuccessMsg(""); } public void get_ech_kai() { string sql = "select top 1 svalue from s_winstr ;"; object result = DbHelper.DbConn.ExecuteScalar(sql); if (result != null && result.ToString() != "") { returnSuccessMsg(result.ToString()); return; } returnSuccessMsg(""); } public static string termCon = ""; public void set_ech_term() { string con = GetString("con"); if (con.Length > 0) { termCon = con; } } public void get_ech_term() { returnSuccessMsg(termCon); } public static string ech_control = ""; public static string set_ech_control = ""; public void get_server_ech_control() { returnSuccessMsg(ech_control); } public void get_client_ech_control() { con.Response.Write(set_ech_control); set_ech_control = ""; } //设置 public void get_set_ech_control() { string con = GetString("con"); if (con.Length > 0) { ech_control = HttpUtility.UrlDecode(con); } } public void get_client_set_ech_control() { string con = GetString("con"); if (con.Length > 0) { set_ech_control = HttpUtility.UrlDecode(con); } returnSuccessMsg("1"); } } }