/// <summary> /// 读取北京失败期列表 /// </summary> /// <returns></returns> public List<CollectResultEntity> GetBeijingFailPeriodList() { List<CollectResultEntity> result = null; string sql = @"SELECT [PeriodNum],[RetTime] FROM [Analysis28DB].[dbo].[SourceData_28_Beijing] WHERE [Status] = -1"; DBHelper db = new DBHelper(); try { DataTable dt = db.ExeSqlDataAdapter(CommandType.Text, sql); if (dt != null && dt.Rows.Count > 0) { result = new List<CollectResultEntity>(); foreach (DataRow row in dt.Rows) { CollectResultEntity item = new CollectResultEntity(); item.PeriodNum = long.Parse(row["PeriodNum"].ToString()); item.RetTime = DateTime.Parse(row["RetTime"].ToString()); result.Add(item); } } } catch (Exception ex) { WriteLog.Write(string.Format("GetBeijingFailPeriodList读取SQL Server数据库失败期列表失败,sql:{0},错误信息:{1}", sql, ex.ToString())); } finally { db.Dispose(); } return result; }
/// <summary> /// 读取北京下期期号 /// </summary> /// <returns></returns> public CollectResultEntity GetBeijingNextPeriodNum() { CollectResultEntity result = new CollectResultEntity(); string sql = @"SELECT TOP 1 [PeriodNum],[RetTime] FROM [Analysis28DB].[dbo].[SourceData_28_Beijing] ORDER BY [PeriodNum] DESC"; DBHelper db = new DBHelper(); try { DataTable dt = db.ExeSqlDataAdapter(CommandType.Text, sql); if (dt != null && dt.Rows.Count > 0) { result.PeriodNum = long.Parse(dt.Rows[0]["PeriodNum"].ToString()) + 1; result.RetTime = DateTime.Parse(dt.Rows[0]["RetTime"].ToString()); //到23:55当天开奖就结束了,下一期在第二天9:05 if (result.RetTime.Hour == 23 && result.RetTime.Minute == 55) result.RetTime = DateTime.Parse(string.Format("{0} 9:05", result.RetTime.ToShortDateString())).AddDays(1); else result.RetTime = result.RetTime.AddMinutes(5); } else { result.PeriodNum = 0; } } catch (Exception ex) { WriteLog.Write(string.Format("GetBeijingNextPeriodNum读取SQL Server数据库期号失败,sql:{0},错误信息:{1}", sql, ex.ToString())); } finally { db.Dispose(); } return result; }
/// <summary> /// 读取加拿大下期期号 /// </summary> /// <returns></returns> public CollectResultEntity GetCanadanNextPeriodNum() { CollectResultEntity result = new CollectResultEntity(); string sql = @"SELECT TOP 1 [PeriodNum],[RetTime] FROM [Analysis28DB].[dbo].[SourceData_28_Canada] ORDER BY [PeriodNum] DESC"; DBHelper db = new DBHelper(); try { DataTable dt = db.ExeSqlDataAdapter(CommandType.Text, sql); if (dt != null && dt.Rows.Count > 0) { result.PeriodNum = long.Parse(dt.Rows[0]["PeriodNum"].ToString()) + 1; result.RetTime = DateTime.Parse(dt.Rows[0]["RetTime"].ToString()); result.RetTime = result.RetTime.AddMinutes(4); } else { result.PeriodNum = 0; } } catch (Exception ex) { WriteLog.Write(string.Format("GetCanadanNextPeriodNum读取SQL Server数据库期号失败,sql:{0},错误信息:{1}", sql, ex.ToString())); } finally { db.Dispose(); } return result; }