Ejemplo n.º 1
0
        public virtual bool UpdatePredictionLog(LotteryPredictionLog predictionLog)
        {
            string sql = @" update LotteryPredictionLog set PredictionStatus=@PredictionStatus,
            EndTime=@EndTime,IsSuccess=@IsSuccess,ErrMsg=@ErrMsg where LotteryCode=@LotteryCode ";

            return(Execute(sql, predictionLog));
        }
Ejemplo n.º 2
0
        public virtual bool InsertPredictionLog(LotteryPredictionLog predictionLog)
        {
            string sql = @" Insert into LotteryPredictionLog(LotteryCode,PredictionStatus,StartTime)
                    values(@LotteryCode,@PredictionStatus,@StartTime)
                   ";

            return(Execute(sql, predictionLog));
        }
Ejemplo n.º 3
0
        public void Prediction(string webRootPath, string lotteryCode)
        {
            if (string.IsNullOrEmpty(lotteryCode))
            {
                lotteryCode = GetLotteryCode();
            }
            LotteryPredictionLog oplog = resultRepo.GetLotteryPredictionLog(lotteryCode);

            if (oplog != null)
            {
                if (oplog.IsSuccess)
                {
                    _logger.LogInformation(oplog.LotteryCode + " 已经预测完成");
                    return;
                }
            }
            LotteryPredictionLog plog = new LotteryPredictionLog()
            {
                LotteryCode      = lotteryCode,
                StartTime        = DateTime.Now,
                PredictionStatus = 0
            };

            try
            {
                _logger.LogInformation("Save PredictionLog");
                resultRepo.InsertPredictionLog(plog);
                _logger.LogInformation("Get PredictionData");
                Dictionary <string, TrainingData> dicPredictionData = GetPredictionData(lotteryCode);
                _logger.LogInformation("Start Prediction :" + lotteryCode);
                int i = 0, j = 0;
                for (i = 0; i < noSite.Count; i++)
                {
                    for (j = 0; j < noType.Count; j++)
                    {
                        PredictionOne(webRootPath, noSite[i], noType[j], dicPredictionData[noSite[i]], lotteryCode);
                    }
                }
                plog.End(true, "");
                resultRepo.UpdatePredictionLog(plog);
            }
            catch (Exception ex)
            {
                plog.End(false, ex.ToString());
                resultRepo.UpdatePredictionLog(plog);
                _logger.LogError("预测出错 :" + ex.ToString());
            }
        }