| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- 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<string> lst = new List<string>();
- 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 = "<script type=\"javascript\">showLine([" + data + "]);</script>";
- }
- }
- returnSuccess("[]");
- }
- private void getLineStr(string cstr, ref int suc, ref List<string> 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");
- }
- }
- }
|