private bool MakePhoto(string devCode, string devId) { DateTime addTime = DateTime.Now; string fileName = addTime.ToString("yyyyMMddhhmmss") + ".jpg";//图片保存路径和文件名 the path and file name to save' string folder = System.Web.HttpContext.Current.Server.MapPath("/Photos/" + devCode); if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string relatePath = "/Photos/" + devCode + "/" + fileName; string filePath = System.Web.HttpContext.Current.Server.MapPath(relatePath); if (!model.SaveJEPG(filePath)) { return(false); } modelPhoto.DevId = int.Parse(devId); modelPhoto.AddTime = addTime; modelPhoto.FileName = relatePath; bllPhoto.Add(modelPhoto); json.AddItem("Url", relatePath); json.AddItem("Time", DateTime.Now.ToString()); json.ItemOk(); json.success = true; json.totalCount = 1; return(true); }
public string GetBattleLines()//得到单条线列表 { JSONHelper json = new JSONHelper(); if (VerirySecurityIP(GetIP4Address())) { json.success = false; json.error = msgNoSafe + Context.Request.UserHostAddress + "<>" + GSSServerIP + ""; Log.Warn(json.error); return(json.ToString()); } try { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT F_NGSID, F_Name, F_ZoneID, F_MaxUser, F_Ip, F_Port,F_Main_State, F_Sub_State, F_DBISID, F_PingPort"); strSql.Append(" FROM T_BattleLine WITH(NOLOCK) "); DbHelperSQLP sp = new DbHelperSQLP(); sp.connectionString = ConnStrGameCoreDB; DataSet ds = sp.Query(strSql.ToString()); json.success = true; foreach (DataRow dr in ds.Tables[0].Rows) { json.AddItem("F_NGSID", dr["F_NGSID"].ToString()); json.AddItem("F_Name", dr["F_Name"].ToString().Trim()); json.AddItem("F_ZoneID", dr["F_ZoneID"].ToString()); json.AddItem("F_MaxUser", dr["F_MaxUser"].ToString()); json.AddItem("F_Ip", dr["F_Ip"].ToString().Trim()); json.AddItem("F_Port", dr["F_Port"].ToString()); json.AddItem("F_Main_State", dr["F_Main_State"].ToString()); json.AddItem("F_Sub_State", dr["F_Sub_State"].ToString()); json.AddItem("F_DBISID", dr["F_DBISID"].ToString()); json.AddItem("F_PingPort", dr["F_PingPort"].ToString()); json.ItemOk(); } json.totlalCount = ds.Tables[0].Rows.Count; return(json.ToString()); } catch (System.Exception ex) { Log.Warn("GetBattleLines", ex); json.success = false; json.error = msgWSVError + ex.Message + ""; return(json.ToString()); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/json"; var start = 0; var limit = 10; var sort = string.Empty; var dir = string.Empty; var query = string.Empty; if (!string.IsNullOrEmpty(context.Request["start"])) { start = int.Parse(context.Request["start"]); } if (!string.IsNullOrEmpty(context.Request["limit"])) { limit = int.Parse(context.Request["limit"]); } if (!string.IsNullOrEmpty(context.Request["sort"])) { sort = context.Request["sort"]; } if (!string.IsNullOrEmpty(context.Request["dir"])) { dir = context.Request["dir"]; } if (!string.IsNullOrEmpty(context.Request["query"])) { query = context.Request["query"]; } if (query.Trim() != "") { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" FROM T_User "); strSql.Append(" where F_UserName<>'" + query + "'"); DbHelperSQLP sp = new DbHelperSQLP(); sp.connectionString = "server=.;database=UserCoreDB;uid=sa;pwd=123"; DataSet ds = sp.Query(strSql.ToString()); string jsons = ""; JSONHelper json = new JSONHelper(); json.success = true; foreach (DataRow dr in ds.Tables[0].Rows) { json.AddItem("F_UserID", dr["F_UserID"].ToString()); json.ItemOk(); } json.totlalCount = ds.Tables[0].Rows.Count; jsons = json.ToString(); context.Response.Write(jsons); } }
/// <summary> /// 查询今日房价 /// </summary> /// <returns></returns> public string GetTodyPrice() { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = rtd.GetTodyPrice(); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("TypeName", dr["TypeName"].ToString()); jsonHelp.AddItem("TypePrice", dr["TypePrice"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
/// <summary> /// 查询所有状态为空闲的房间(删除客房时用到) /// </summary> /// <returns></returns> public string GetRoom() { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = rd.GetRoom(); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("RoomId", dr["RoomId"].ToString()); jsonHelp.AddItem("Number", dr["Number"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
RoomStateDAO rsd = new RoomStateDAO(); //数据层 /// <summary> /// 查询房间状态表(所有) /// </summary> /// <returns></returns> public string GetAllRoomState() { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = rsd.GetAllRoomState(); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("StateId", dr["StateId"].ToString()); jsonHelp.AddItem("StateName", dr["StateName"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
/// <summary> /// 查询所有 /// </summary> /// <returns></returns> public string GetIsAll() { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = itd.GetIsAll(); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("IsId", dr["IsId"].ToString()); jsonHelp.AddItem("IsName", dr["IsName"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
/// <summary> /// 查询所有员工(删除用到) /// </summary> /// <param name="LoginName"></param> /// <returns></returns> public string GetUser(string LoginName) { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = uid.GetUser(LoginName); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("UserId", dr["UserId"].ToString()); jsonHelp.AddItem("LoginName", dr["LoginName"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
/// <summary> /// 查询所有客房信息(查看客房信息用到,带搜索) /// </summary> /// <param name="message"></param> /// <returns></returns> public string GetAllRoom(string message) { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = rd.GetAllRoom(message); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("Number", dr["Number"].ToString()); jsonHelp.AddItem("BedNumber", dr["BedNumber"].ToString()); jsonHelp.AddItem("TypeName", dr["TypeName"].ToString()); jsonHelp.AddItem("StateName", dr["StateName"].ToString()); jsonHelp.AddItem("Remark", dr["Remark"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
private void GetAllDev(HttpContext context) { int numOfRecords = 0; string strWhere = string.Empty; GetList(strWhere); foreach (DataRow dr in dataTable.Rows) { json.AddItem("Name", dr["StatName"].ToString()); json.AddItem("Addr", dr["Address"].ToString()); json.AddItem("Depart", dr["Department"].ToString()); json.AddItem("Stage", dr["Stage"].ToString()); json.ItemOk(); numOfRecords++; } json.success = true; json.totalCount = numOfRecords; }
public string GetGameConfig()//得到GameConfig { JSONHelper json = new JSONHelper(); if (VerirySecurityIP(GetIP4Address())) { json.success = false; json.error = msgNoSafe + Context.Request.UserHostAddress + "<>" + GSSServerIP + ""; Log.Warn(json.error); return(json.ToString()); } try { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT F_Key, F_Describe, F_Value "); strSql.Append(" FROM T_GameConfig WITH(NOLOCK) WHERE F_Key in ('F_GameBaseVersion','F_PatcherVersion','F_UpDateRootPath','F_UpDateSimplePackRootPath') "); DbHelperSQLP sp = new DbHelperSQLP(); sp.connectionString = ConnStrGameCoreDB; DataSet ds = sp.Query(strSql.ToString()); json.success = true; foreach (DataRow dr in ds.Tables[0].Rows) { json.AddItem("F_Key", dr["F_Key"].ToString()); json.AddItem("F_Describe", dr["F_Describe"].ToString().Trim()); json.AddItem("F_Value", dr["F_Value"].ToString().Trim()); json.ItemOk(); } json.totlalCount = ds.Tables[0].Rows.Count; return(json.ToString()); } catch (System.Exception ex) { Log.Warn("GetGameConfig", ex); json.success = false; json.error = msgWSVError + ex.Message + ""; return(json.ToString()); } }
private void ReadALarmRange(HttpContext context) { if (context.Request.Params["id"] == null) { return; } int id = int.Parse(context.Request.Params["id"]); try { _model = _bll.GetModel(id); _json.AddItem("Name", _model.Name.Trim()); _json.AddItem("DustRange", _model.DustRange.ToString(CultureInfo.CurrentCulture)); _json.AddItem("DbRange", _model.DbRange.ToString(CultureInfo.CurrentCulture)); } catch (Exception e) { _json.error = e.Message; } _json.success = true; _json.ItemOk(); }
/// <summary> /// 查询所有的开房信息(首页的Grid,带搜索功能) /// </summary> /// <param name="message"></param> /// <returns></returns> public string GetOpenRoomInfoAll(string message) { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = orid.GetOpenRoomInfoAll(message); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("OpenRoomId", dr["OpenRoomId"].ToString()); jsonHelp.AddItem("Number", dr["Number"].ToString()); jsonHelp.AddItem("TypeName", dr["TypeName"].ToString()); jsonHelp.AddItem("TypePrice", dr["TypePrice"].ToString()); jsonHelp.AddItem("OpenTime", dr["OpenTime"].ToString()); jsonHelp.AddItem("GuestMoney", dr["GuestMoney"].ToString()); jsonHelp.AddItem("GuestNumber", dr["GuestNumber"].ToString()); jsonHelp.AddItem("GuestName", dr["GuestName"].ToString()); jsonHelp.AddItem("Remark", dr["Remark"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
public string GetGameSimpleVersionList()//得到GameSimpleVersionList { JSONHelper json = new JSONHelper(); if (VerirySecurityIP(GetIP4Address())) { json.success = false; json.error = msgNoSafe + Context.Request.UserHostAddress + "<>" + GSSServerIP + ""; Log.Warn(json.error); return(json.ToString()); } try { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT F_ID, F_CURVERSION, F_LOWVERSION, F_UPFILESIZE, F_DOWNFILESIZE, F_FILENAME, F_TIME "); strSql.Append(" FROM T_GameSimpleVersionList WITH(NOLOCK) "); DbHelperSQLP sp = new DbHelperSQLP(); sp.connectionString = ConnStrGameCoreDB; DataSet ds = sp.Query(strSql.ToString()); json.success = true; foreach (DataRow dr in ds.Tables[0].Rows) { json.AddItem("F_ID", dr["F_ID"].ToString()); json.AddItem("F_CURVERSION", dr["F_CURVERSION"].ToString().Trim()); json.AddItem("F_LOWVERSION", dr["F_LOWVERSION"].ToString().Trim()); json.AddItem("F_UPFILESIZE", dr["F_UPFILESIZE"].ToString().Trim()); json.AddItem("F_DOWNFILESIZE", dr["F_DOWNFILESIZE"].ToString().Trim()); json.AddItem("F_FILENAME", dr["F_FILENAME"].ToString().Trim()); json.AddItem("F_TIME", dr["F_TIME"].ToString().Trim()); json.ItemOk(); } json.totlalCount = ds.Tables[0].Rows.Count; return(json.ToString()); } catch (System.Exception ex) { Log.Warn("GetGameSimpleVersionList", ex); json.success = false; json.error = msgWSVError + ex.Message + ""; return(json.ToString()); } }
private void GetQuaterReport(HttpContext context) { int numOfRecords = 0; StringBuilder sb = new StringBuilder(); if (context.Request.Params["starttime"] == null) { } if (context.Request.Params["endtime"] == null) { } if (context.Request.Params["cityId"] == null) { } string startTime = context.Request.Params["starttime"].ToString(); string endTime = context.Request.Params["endtime"].ToString(); string cityId = context.Request.Params["cityId"].ToString(); sb.AppendFormat("UpdateTime >=\'{0}' and UpdateTime <=\'{1}' and Country=\'{2}\'", startTime, endTime, cityId); //dataTable = bll.GetDustOverDataCount(sb.ToString()).Tables[0]; foreach (DataRow dr in dataTable.Rows) { json.AddItem("Name", dr["StatName"].ToString()); json.AddItem("TPNum", dr["TPNum"].ToString()); json.AddItem("DBNum", dr["DBNum"].ToString()); json.AddItem("Total", dr["Total"].ToString()); json.ItemOk(); numOfRecords++; } json.success = true; json.totalCount = numOfRecords; }
/// <summary> /// 查账(全查,根据时间查询都可以) /// </summary> /// <param name="BeginTime"></param> /// <param name="EndTime"></param> /// <returns></returns> public string SerachMoney(string BeginTime, string EndTime) { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = mid.SerachMoney(BeginTime, EndTime); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("MoneyInfoId", dr["MoneyInfoId"].ToString()); jsonHelp.AddItem("OpenTime", dr["OpenTime"].ToString()); jsonHelp.AddItem("RoomNumber", dr["RoomNumber"].ToString()); jsonHelp.AddItem("GuestNumber", dr["GuestNumber"].ToString()); jsonHelp.AddItem("GuestName", dr["GuestName"].ToString()); jsonHelp.AddItem("MoneyDate", dr["MoneyDate"].ToString()); jsonHelp.AddItem("DetailsMoney", dr["DetailsMoney"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
/// <summary> /// 查询所有房间类型(查询房间类型用到,带搜索) /// </summary> /// <returns></returns> public string GetAllRoomType(string message) { JSONHelper jsonHelp = new JSONHelper(); jsonHelp.success = true; DataSet ds = rtd.GetAllRoomType(message); foreach (DataRow dr in ds.Tables[0].Rows) { jsonHelp.AddItem("TypeId", dr["TypeId"].ToString()); jsonHelp.AddItem("TypeName", dr["TypeName"].ToString()); jsonHelp.AddItem("TypePrice", dr["TypePrice"].ToString()); jsonHelp.AddItem("IsTv", dr["IsTv"].ToString()); jsonHelp.AddItem("IsKongTiao", dr["IsKongTiao"].ToString()); jsonHelp.AddItem("Remark", dr["Remark"].ToString()); jsonHelp.ItemOk(); } string str = jsonHelp.ToString(); return(str); }
private void GpsInfoTask(int devId) { DevCtrlCmd cmd = new DevCtrlCmd(); cmd.EncodeGpsInfoCmd(); ESMonitor.Model.Tasks model = new ESMonitor.Model.Tasks(); cmd.GetTaskModel(devId, ref model); long taksId = _bll.Add(model); if (taksId > 0) { _json.totalCount = 1; _json.success = true; _json.AddItem("task", taksId.ToString()); _json.ItemOk(); } else { _json.success = false; _json.error = "新增任务失败"; } }
private void GetCurMinData(HttpContext context) { int numOfRecords = 0; //string strWhere = string.Empty; if (context.Request.Params["sid"] == null) { json.error = "非法请求"; return; } int statId = int.Parse(context.Request.Params["sid"]); dataTable = bll.GetStatCurData(statId).Tables[0]; foreach (DataRow dr in dataTable.Rows) { json.AddItem("PM25", string.Format("{0:F}", ((double)dr["PM25"] / 1000.0))); json.AddItem("PM100", string.Format("{0:F}", ((double)dr["PM100"] / 1000.0))); json.AddItem("TP", string.Format("{0:F}", ((double)dr["TP"] / 1000.0))); json.AddItem("DB", string.Format("{0:F}", dr["DB"])); json.AddItem("WS", string.Format("{0:F}", dr["WindSpeed"])); json.AddItem("WD", dr["WindDirection"].ToString()); json.AddItem("TEMP", string.Format("{0:F}", dr["Temperature"])); json.AddItem("HUM", string.Format("{0:F}", dr["Humidity"])); json.AddItem("DevId", dr["DevId"].ToString()); json.AddItem("UpdateTime", dr["UpdateTime"].ToString()); json.ItemOk(); numOfRecords++; } json.success = true; json.totalCount = numOfRecords; }
/// <summary> /// 小时均值 /// </summary> /// <param name="context"></param> private void GetStatDustHourData(HttpContext context) { int numOfRecords = 0; StringBuilder sb = new StringBuilder(); if (context.Request.Params["dusttype"] == null) { return; } if (context.Request.Params["cityId"] == null) { return; } if (context.Request.Params["datetype"] == null) { return; } int datetype = int.Parse(context.Request.Params["datetype"]); string startTime, endTime; if (datetype == 1) { startTime = DateTime.Now.AddDays(-1).ToShortDateString() + " " + DateTime.Now.AddDays(-1).Hour + ":00"; endTime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); } else { startTime = DateTime.Now.ToShortDateString(); endTime = startTime + " " + DateTime.Now.ToShortTimeString(); } string dusttype = context.Request.Params["dusttype"]; string cityId = context.Request.Params["cityId"]; string sid = context.Request.Params["sid"]; sb.AppendFormat("UpdateTime >=\'{0}' and UpdateTime <=\'{1}' and StatId ={2}", startTime, endTime, sid); if (dusttype == "0") { _dataTable = _bll.GetAvgCMPStatList(cityId, sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("StatId", dr["StatId"].ToString()); _json.AddItem("Val", string.Format("{0:F}", ((double)dr["AvgTP"] / 1000.0))); _json.AddItem("Time", DateTime.Parse(dr["UpdateTime"].ToString()).Hour.ToString()); _json.ItemOk(); numOfRecords++; } } else if (dusttype == "1") { _dataTable = _bll.GetAvgNoiseStatList(cityId, sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("StatId", dr["StatId"].ToString()); _json.AddItem("Val", string.Format("{0:F}", dr["AvgDB"])); _json.AddItem("Time", DateTime.Parse(dr["UpdateTime"].ToString()).Hour.ToString()); _json.ItemOk(); numOfRecords++; } } else if (dusttype == "2") { _dataTable = _bll.GetAvgPM25StatList(cityId, sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("StatId", dr["StatId"].ToString()); _json.AddItem("Val", string.Format("{0:F}", dr["AvgPM25"])); _json.AddItem("Time", DateTime.Parse(dr["UpdateTime"].ToString()).Hour.ToString()); _json.ItemOk(); numOfRecords++; } } else if (dusttype == "3") { _dataTable = _bll.GetAvgPM100StatList(cityId, sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("StatId", dr["StatId"].ToString()); _json.AddItem("Val", string.Format("{0:F}", dr["AvgPM100"])); _json.AddItem("Time", DateTime.Parse(dr["UpdateTime"].ToString()).Hour.ToString()); _json.ItemOk(); numOfRecords++; } } _json.success = true; _json.totalCount = numOfRecords; }
/// <summary> /// 获得数据列表 /// </summary> //public DataSet GetList(int PageSize,int PageIndex,string strWhere) //{ //return dal.GetList(PageSize,PageIndex,strWhere); //} #endregion 成员方法 /// <summary> /// 查询某用户的投注列表 /// </summary> /// <param name="userid"></param> /// <returns></returns> public string GetBetRecordList(string userid) { JSONHelper json = new JSONHelper(); ds = dal.GetList(userid); json.success = true; foreach (DataRow dr in ds.Tables[0].Rows) { //投注记录表数据 json.AddItem("id", dr["id"].ToString()); json.AddItem("lineid", dr["lineid"].ToString()); json.AddItem("teamname", dr["teamname"].ToString()); json.AddItem("traditional", dr["traditional"].ToString()); json.AddItem("starttime", dr["starttime"].ToString()); json.AddItem("endtime", dr["endtime"].ToString()); json.AddItem("bettime", dr["bettime"].ToString()); json.AddItem("itemid", dr["itemid"].ToString()); json.AddItem("detailid", dr["detailid"].ToString()); json.AddItem("betmoney", dr["betmoney"].ToString()); json.AddItem("returnmoney", dr["returnmoney"].ToString()); json.AddItem("result", dr["result"].ToString()); json.AddItem("sourceid", dr["sourceid"].ToString()); //投注线程表数据 json.AddItem("linename", dr["linename"].ToString()); json.AddItem("linebetmoney", dr["linebetmoney"].ToString()); json.AddItem("profit", dr["profit"].ToString()); json.AddItem("state", dr["state"].ToString()); json.AddItem("iscomplete", dr["iscomplete"].ToString()); json.AddItem("isbetting", dr["isbetting"].ToString()); //投注项目表数据 json.AddItem("itemname", dr["itemname"].ToString()); //投注细节数据 json.AddItem("detailname", dr["detailname"].ToString()); json.ItemOk(); } json.totlalCount = ds.Tables[0].Rows.Count; string betRecordlist = json.ToString(); return(betRecordlist); }
public string GetAveKellyChartsData(string scheduleID, string[] companyids) { JSONHelper json = new JSONHelper(); json.success = true; List <Odds1x2History> firstOddsList = dal.GetFirstListByCompanys(int.Parse(scheduleID), string.Join(",", companyids)); List <float> firstHomekList = new List <float>(); List <float> firstDrawkList = new List <float>(); List <float> firstAwaykList = new List <float>(); int firstHomekCount = 0; int firstDrawkCount = 0; int firstAwaykCount = 0; foreach (Odds1x2History model in firstOddsList) { this.FillOdds1x2Kelly(model, ""); firstHomekList.Add(model.homek); firstDrawkList.Add(model.drawk); firstAwaykList.Add(model.awayk); if (model.homek < model.awayk && model.homek < model.drawk) { firstHomekCount++; } else if (model.homek >= 100) { firstHomekCount--; } if (model.drawk < model.awayk && model.drawk < model.homek) { firstDrawkCount++; } else if (model.drawk >= 100) { firstDrawkCount--; } if (model.awayk < model.homek && model.awayk < model.drawk) { firstAwaykCount++; } else if (model.awayk >= 100) { firstAwaykCount--; } } List <Odds1x2History> lastOddsList = dal.GetLastListByCompanys(int.Parse(scheduleID), string.Join(",", companyids)); List <float> lastHomekList = new List <float>(); List <float> lastDrawkList = new List <float>(); List <float> lastAwaykList = new List <float>(); int lastHomekCount = 0; int lastDrawkCount = 0; int lastAwaykCount = 0; foreach (Odds1x2History model in lastOddsList) { this.FillOdds1x2Kelly(model, ""); lastHomekList.Add(model.homek); lastDrawkList.Add(model.drawk); lastAwaykList.Add(model.awayk); if (model.homek < model.awayk && model.homek < model.drawk) { lastHomekCount++; } else if (model.homek >= 100) { lastHomekCount--; } if (model.drawk < model.awayk && model.drawk < model.homek) { lastDrawkCount++; } else if (model.drawk >= 100) { lastDrawkCount--; } if (model.awayk < model.homek && model.awayk < model.drawk) { lastAwaykCount++; } else if (model.awayk >= 100) { lastAwaykCount--; } } json.AddItem("name", "主胜"); json.AddItem("firstkelly", firstHomekList.Average().ToString()); json.AddItem("lastkelly", lastHomekList.Average().ToString()); json.AddItem("firstsupport", firstHomekCount.ToString()); json.AddItem("lastsupport", lastHomekCount.ToString()); json.ItemOk(); json.AddItem("name", "平局"); json.AddItem("firstkelly", firstDrawkList.Average().ToString()); json.AddItem("lastkelly", lastDrawkList.Average().ToString()); json.AddItem("firstsupport", firstDrawkCount.ToString()); json.AddItem("lastsupport", lastDrawkCount.ToString()); json.ItemOk(); json.AddItem("name", "客胜"); json.AddItem("firstkelly", firstAwaykList.Average().ToString()); json.AddItem("lastkelly", lastAwaykList.Average().ToString()); json.AddItem("firstsupport", firstAwaykCount.ToString()); json.AddItem("lastsupport", lastAwaykCount.ToString()); json.ItemOk(); return(json.ToString()); }
private void GetAllStats(HttpContext context) { int numOfRecords = 0; string strWhere = string.Empty; if (context.Request.Params["cityId"] != null) { strWhere = "Country=" + context.Request.Params["cityId"]; } _dataTable = _bll.GetList(strWhere).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("Id", dr["Id"].ToString()); _json.AddItem("Man", dr["ChargeMan"].ToString()); _json.AddItem("Mobile", dr["Telepone"].ToString()); _json.AddItem("Name", dr["StatName"].ToString()); _json.AddItem("Addr", dr["Address"].ToString()); _json.AddItem("Depart", dr["Department"].ToString()); _json.AddItem("Stage", Stage.GetStage(dr["Stage"].ToString())); _json.AddItem("Long", dr["Longitude"].ToString()); _json.AddItem("Lant", dr["Latitude"].ToString()); _json.ItemOk(); numOfRecords++; } _json.success = true; _json.totalCount = numOfRecords; }
private void GetRealTimeAlarm(HttpContext context) { int numOfRecords = 0; StringBuilder sb = new StringBuilder(); string startTime = DateTime.Now.ToShortDateString(); string endTime = startTime + " " + DateTime.Now.ToLongTimeString(); string cityId = context.Request.Params["cityId"]; sb.AppendFormat("UpdateTime >=\'{0}' and UpdateTime <=\'{1}' and Country=\'{2}\'", startTime, endTime, cityId); _dataTable = _bll.GetDustOverDataCount(sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("Name", dr["StatName"].ToString()); _json.AddItem("TPNum", dr["TPNum"].ToString()); _json.AddItem("DBNum", dr["DBNum"].ToString()); _json.AddItem("Total", dr["Total"].ToString()); _json.ItemOk(); numOfRecords++; } _json.success = true; _json.totalCount = numOfRecords; }
public string GetOddsPointChartsData(string scheduleID, string[] companyids) { JSONHelper json = new JSONHelper(); json.success = true; DataSet dsAllTime = dal.GetChangeTimesByCompanys(scheduleID, string.Join(",", companyids)); List <float> avehomeklist = new List <float>(); List <float> avedrawklist = new List <float>(); List <float> aveawayklist = new List <float>(); List <float> avehomevlist = new List <float>(); List <float> avedrawvlist = new List <float>(); List <float> aveawayvlist = new List <float>(); List <float> avereratelist = new List <float>(); Odds1x2History lastmodel = new Odds1x2History(); foreach (DataRow dr in dsAllTime.Tables[0].Rows) { ds = dal.GetAvgNumber(int.Parse(scheduleID), DateTime.Parse(dr[0].ToString())); List <Odds1x2History> oddsList = dal.GetLastListByCompanys(int.Parse(scheduleID), string.Join(",", companyids), DateTime.Parse(dr["time"].ToString())); List <float> homeklist = new List <float>(); List <float> drawklist = new List <float>(); List <float> awayklist = new List <float>(); List <float> reratelist = new List <float>(); foreach (Odds1x2History item in oddsList) { homeklist.Add(item.home * float.Parse(ds.Tables[0].Rows[0]["avghomep"].ToString())); drawklist.Add(item.draw * float.Parse(ds.Tables[0].Rows[0]["avgdrawp"].ToString())); awayklist.Add(item.away * float.Parse(ds.Tables[0].Rows[0]["avgawayp"].ToString())); reratelist.Add(item.returnrate * 100); } avehomeklist.Add(homeklist.Average()); avedrawklist.Add(drawklist.Average()); aveawayklist.Add(awayklist.Average()); avehomevlist.Add(this.CalculationVariance(homeklist)); avedrawvlist.Add(this.CalculationVariance(drawklist)); aveawayvlist.Add(this.CalculationVariance(awayklist)); avereratelist.Add(reratelist.Average()); } int h = 0, d = 0, a = 0; int hh = 0, dd = 0, aa = 0; for (int i = 1; i < avehomeklist.Count; i++) { if (avehomeklist[i] < avehomeklist[i - 1]) { h++; } else if (avehomeklist[i] > avehomeklist[i - 1]) { h--; } if (avedrawklist[i] < avedrawklist[i - 1]) { d++; } else if (avedrawklist[i] > avedrawklist[i - 1]) { d--; } if (aveawayklist[i] < aveawayklist[i - 1]) { a++; } else if (aveawayklist[i] > aveawayklist[i - 1]) { a--; } if (avehomevlist[i] <= avehomevlist[i - 1]) { if (avehomeklist[i] < avehomeklist[i - 1]) { hh++; } else if (avehomeklist[i] > avehomeklist[i - 1]) { hh--; } } if (avedrawvlist[i] <= avedrawvlist[i - 1]) { if (avedrawklist[i] < avedrawklist[i - 1]) { dd++; } else if (avedrawklist[i] > avedrawklist[i - 1]) { dd--; } } if (aveawayvlist[i] <= aveawayvlist[i - 1]) { if (aveawayklist[i] < aveawayklist[i - 1]) { aa++; } else if (aveawayklist[i] > aveawayklist[i - 1]) { aa--; } } } json.AddItem("name", "主胜"); json.AddItem("point", h.ToString()); json.AddItem("xpoint", hh.ToString()); json.ItemOk(); json.AddItem("name", "平局"); json.AddItem("point", d.ToString()); json.AddItem("xpoint", dd.ToString()); json.ItemOk(); json.AddItem("name", "客胜"); json.AddItem("point", a.ToString()); json.AddItem("xpoint", aa.ToString()); json.ItemOk(); json.totlalCount = 3; return(json.ToString()); }
public string GetBattleZones(int start, int limit, string sort, string dir)//得到战区配置列表 { JSONHelper json = new JSONHelper(); if (VerirySecurityIP(GetIP4Address())) { json.success = false; json.error = msgNoSafe + Context.Request.UserHostAddress + "<>" + GSSServerIP + ""; Log.Warn(json.error); return(json.ToString()); } try { StringBuilder strSql = new StringBuilder(); strSql.Append(@"SELECT F_ZoneID, F_ZoneName, F_ZoneState, F_ZoneLine, F_ZoneAttrib, F_ChargeType, F_BigZoneID,F_ServerType ,F_FaVersions_Cur,F_ReVersions_Cur,F_FaVersionsLow_And,F_ReVersionsLow_And ,F_FaVersionsLow_Ios ,F_ReVersionsLow_Ios "); strSql.Append(" FROM T_BattleZone WITH(NOLOCK) "); DbHelperSQLP sp = new DbHelperSQLP(); sp.connectionString = ConnStrGameCoreDB; DataSet ds = sp.Query(strSql.ToString()); json.success = true; foreach (DataRow dr in ds.Tables[0].Rows) { json.AddItem("F_ZoneID", dr["F_ZoneID"].ToString()); json.AddItem("F_ZoneName", dr["F_ZoneName"].ToString().Trim()); // json.AddItem("F_ZoneState", dr["F_ZoneState"].ToString()); int state = Convert.ToInt16(dr["F_ZoneState"]); json.AddItem("F_ZoneState0", GetSubStr(state, 4, 3, 1)); json.AddItem("F_ZoneState1", GetSubStr(state, 4, 2, 1)); json.AddItem("F_ZoneState2", GetSubStr(state, 4, 0, 2)); json.AddItem("F_ZoneState", state.ToString()); json.AddItem("F_ZoneLine", dr["F_ZoneLine"].ToString()); // json.AddItem("F_ZoneAttrib", dr["F_ZoneAttrib"].ToString()); int attrib = Convert.ToInt16(dr["F_ZoneAttrib"]); json.AddItem("F_ZoneAttrib0", GetSubStr(attrib, 5, 4, 1)); json.AddItem("F_ZoneAttrib1", GetSubStr(attrib, 5, 3, 1)); json.AddItem("F_ZoneAttrib2", GetSubStr(attrib, 5, 1, 2)); json.AddItem("F_ZoneAttrib4", GetSubStr(attrib, 5, 0, 1)); json.AddItem("F_ChargeType", dr["F_ChargeType"].ToString()); json.AddItem("F_BigZoneID", dr["F_BigZoneID"].ToString()); json.AddItem("F_ServerType", dr["F_ServerType"].ToString()); json.AddItem("F_FaVersions_Cur", dr["F_FaVersions_Cur"].ToString()); json.AddItem("F_ReVersions_Cur", dr["F_ReVersions_Cur"].ToString()); json.AddItem("F_FaVersionsLow_And", dr["F_FaVersionsLow_And"].ToString()); json.AddItem("F_ReVersionsLow_And", dr["F_ReVersionsLow_And"].ToString()); json.AddItem("F_FaVersionsLow_Ios", dr["F_FaVersionsLow_Ios"].ToString()); json.AddItem("F_ReVersionsLow_Ios", dr["F_ReVersionsLow_Ios"].ToString()); json.ItemOk(); } json.totlalCount = ds.Tables[0].Rows.Count; return(json.ToString()); } catch (System.Exception ex) { json.success = false; json.error = msgWSVError + ex.Message + ""; Log.Warn("GetBattleZones" + json.error, ex); return(json.ToString()); } }
/// <summary> /// 当时均值 /// </summary> /// <param name="context"></param> private void GetAvgChangeData(HttpContext context) { int numOfRecords = 0; StringBuilder sb = new StringBuilder(); if (context.Request.Params["starttime"] == null) { } if (context.Request.Params["endtime"] == null) { } if (context.Request.Params["dusttype"] == null) { } if (context.Request.Params["cityId"] == null) { } string startTime = context.Request.Params["starttime"]; string endTime = context.Request.Params["endtime"]; string dusttype = context.Request.Params["dusttype"]; string cityId = context.Request.Params["cityId"]; sb.AppendFormat("UpdateTime >=\'{0}' and UpdateTime <=\'{1}' and Country=\'{2}\'", startTime, endTime, cityId); if (dusttype == "0") { _dataTable = _bll.GetAvgCMPList(sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("Val", string.Format("{0:F}", ((double)(dr["AvgTP"]) / 1000.0))); _json.AddItem("Time", dr["UpdateTime"].ToString()); _json.AddItem("type", "颗粒物浓度"); _json.ItemOk(); numOfRecords++; } } else if (dusttype == "1") { _dataTable = _bll.GetAvgNoiseList(sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("Val", string.Format("{0:F}", dr["AvgDB"])); _json.AddItem("Time", dr["UpdateTime"].ToString()); _json.AddItem("type", "噪音值"); _json.ItemOk(); numOfRecords++; } } else if (dusttype == "2") { _dataTable = _bll.GetAvgPM25List(sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("Val", string.Format("{0:F}", dr["AvgPM25"])); _json.AddItem("Time", dr["UpdateTime"].ToString()); _json.AddItem("type", "PM2.5值"); _json.ItemOk(); numOfRecords++; } } else if (dusttype == "3") { _dataTable = _bll.GetAvgPM100List(sb.ToString()).Tables[0]; foreach (DataRow dr in _dataTable.Rows) { _json.AddItem("Val", string.Format("{0:F}", dr["AvgPM25"])); _json.AddItem("Time", dr["UpdateTime"].ToString()); _json.AddItem("type", "PM2.5值"); _json.ItemOk(); numOfRecords++; } } _json.success = true; _json.totalCount = numOfRecords; }
public string GetOddsCompanyChartsData(string scheduleID, string[] companyids, double time) { JSONHelper json = new JSONHelper(); json.success = true; DataSet dsStart = dal.GetCompanyStartPoint(scheduleID, companyids); DataSet dsEnd = dal.GetCompanyEndPoint(scheduleID, companyids); DateTime firsttime; DateTime lasttime = DateTime.Parse(dsEnd.Tables[0].Rows[0][0].ToString()); if (time == 0) { firsttime = DateTime.Parse(dsStart.Tables[0].Rows[0][0].ToString()); } else { firsttime = lasttime.AddSeconds(0 - time); } double timespace = (lasttime - firsttime).TotalSeconds / 60; while (firsttime <= lasttime) { Odds1x2History model = new Odds1x2History(); ds = dal.GetAvgNumber(int.Parse(scheduleID), firsttime); DataRow dr = ds.Tables[0].Rows[0]; List <Odds1x2History> oddsList = dal.GetLastListByCompanys(int.Parse(scheduleID), string.Join(",", companyids), firsttime); int home = 0; int draw = 0; int away = 0; int nhome = 0; int ndraw = 0; int naway = 0; int count = 0; foreach (Odds1x2History item in oddsList) { item.homek = item.home * float.Parse(dr["avghomep"].ToString()); item.drawk = item.draw * float.Parse(dr["avgdrawp"].ToString()); item.awayk = item.away * float.Parse(dr["avgawayp"].ToString()); if (item.homek < item.returnrate * 100 - 2) { home++; } else if (item.homek >= item.returnrate * 100 + 2) { nhome--; } if (item.drawk < item.returnrate * 100 - 2) { draw++; } else if (item.drawk >= item.returnrate * 100 + 2) { ndraw--; } if (item.awayk < item.returnrate * 100 - 2) { away++; } else if (item.awayk >= item.returnrate * 100 + 2) { naway--; } count++; } json.AddItem("home", home.ToString()); json.AddItem("draw", draw.ToString()); json.AddItem("away", away.ToString()); json.AddItem("nhome", nhome.ToString()); json.AddItem("ndraw", ndraw.ToString()); json.AddItem("naway", naway.ToString()); json.AddItem("count", count.ToString()); json.AddItem("time", firsttime.ToString()); json.ItemOk(); firsttime = firsttime.AddSeconds(timespace); } json.totlalCount = ds.Tables[0].Rows.Count; return(json.ToString()); }
/// <summary> /// 获得历史改变的赔率 /// </summary> /// <param name="scheduleid"></param> /// <param name="companyids"></param> /// <param name="companynames"></param> /// <returns></returns> public string GetOdds1x2ChangeList(string scheduleid, string[] companyids, string[] companynames, string tcompanyid) { JSONHelper json = new JSONHelper(); for (int i = 0; i < companyids.Length; i++) { List <Odds1x2History> list = dal.GetList(scheduleid, companyids[i]); json.success = true; foreach (Odds1x2History model in list) { this.FillOdds1x2Kelly(model, tcompanyid); //投注记录表数据 json.AddItem("id", model.id.ToString()); json.AddItem("scheduleid", model.scheduleid.ToString()); json.AddItem("companyid", model.companyid.ToString()); json.AddItem("companyname", companynames[i]); json.AddItem("home", model.home.ToString()); json.AddItem("draw", model.draw.ToString()); json.AddItem("away", model.away.ToString()); json.AddItem("homep", model.homep.ToString()); json.AddItem("drawp", model.drawp.ToString()); json.AddItem("awayp", model.awayp.ToString()); json.AddItem("homek", model.homek.ToString()); json.AddItem("drawk", model.drawk.ToString()); json.AddItem("awayk", model.awayk.ToString()); json.AddItem("returnrate", model.returnrate.ToString()); json.AddItem("time", model.time.ToString("yyyy-MM-dd HH:mm")); json.ItemOk(); } json.totlalCount += list.Count; } return(json.ToString()); }