public bool Insert(LotteryPredictData lotteryPredictData) { // todo: 计算正确率 string sqlStr = "INSERT INTO [dbo].[LotteryPredictDatas] " + "([Id],[NormId],[CurrentPredictPeriod],[StartPeriod],[EndPeriod],[MinorCycle],[PredictedNum],[PredictedResult],[CreatTime]) " + "VALUES(@Id, @NormId, @CurrentPredictPeriod, @StartPeriod, @EndPeriod , @MinorCycle, @PredictedNum, @PredictedResult, GETDATE())"; using (var cn = LotteryDbConnection) { return(cn.Execute(sqlStr, lotteryPredictData) > 0); } }
public bool Update(LotteryPredictData lotteryPredictData) { string sqlStr = "UPDATE [dbo].[LotteryPredictDatas] SET " + "[CurrentPredictPeriod] = @CurrentPredictPeriod,[StartPeriod] = @StartPeriod,[EndPeriod] = @EndPeriod,[MinorCycle] = @MinorCycle,[PredictedResult] = @PredictedResult ,[ModifyTime] = GETDATE() " + "WHERE Id=@Id"; using (var cn = LotteryDbConnection) { return(cn.Execute(sqlStr, lotteryPredictData) > 0); } }
public bool Insert(LotteryPredictData lotteryPredictData) { return(_lotteryPredictDataService.Insert(lotteryPredictData)); }
public bool Update(LotteryPredictData lotteryPredictData) { return(_lotteryPredictDataService.Update(lotteryPredictData)); }
private void Init() { switch (_lotteryPlan.PlanType) { case PlanType.DragonTigerPlan: _lotteryTrackNumber = new DragonTigerPlanTrackNumber(this); break; case PlanType.Kill: _lotteryTrackNumber = new KillPlanTrackNumber(this); break; case PlanType.NumPlan: _lotteryTrackNumber = new NumPlanTrackNumber(this); break; case PlanType.RankPlan: _lotteryTrackNumber = new RankPlanTrackNumber(this); break; case PlanType.SizePlan: _lotteryTrackNumber = new SizePlanTrackNumber(this); break; default: throw new LSException("不存在该类型的彩票计划类型"); } _lotteryPredictData = _lotteryPredictDataAppService.GetCurrentLotteryPredictData(_norm.Id, LotteryEngine.LastLotteryData.Period); if (_lotteryPredictData == null) { _lotteryPredictData = new LotteryPredictData() { NormId = LotteryNorm.Id, CurrentPredictPeriod = LotteryEngine.ForecastPeriod, StartPeriod = LotteryEngine.ForecastPeriod, EndPeriod = LotteryEngine.ForecastPeriod + LotteryNorm.PlanCycle - 1, MinorCycle = 1, PredictedResult = PredictionResult.NoLottery, }; _isNeedRecalculate = true; } else if (_lotteryTrackNumber.AssertPredictData() && !_isNeedRecalculate) { _lotteryPredictData.PredictedResult = PredictionResult.Right; _lotteryPredictData.EndPeriod = LotteryEngine.LastLotteryData.Period; // _lotteryPredictData.MinorCycle += 1; _lotteryPredictData.ModifyTime = DateTime.Now; _lotteryPredictDataAppService.Update(_lotteryPredictData); _lotteryPredictData = new LotteryPredictData() { NormId = LotteryNorm.Id, CurrentPredictPeriod = LotteryEngine.ForecastPeriod, StartPeriod = LotteryEngine.ForecastPeriod, EndPeriod = LotteryEngine.ForecastPeriod + LotteryNorm.PlanCycle - 1, MinorCycle = 1, PredictedResult = PredictionResult.NoLottery, }; _isNeedRecalculate = true; } else { if (_lotteryPredictData.EndPeriod >= LotteryEngine.ForecastPeriod) { _lotteryPredictData.CurrentPredictPeriod = LotteryEngine.ForecastPeriod; _lotteryPredictData.MinorCycle += 1; _lotteryPredictData.ModifyTime = DateTime.Now; _lotteryPredictDataAppService.Update(_lotteryPredictData); _isNeedRecalculate = false; } else { _lotteryPredictData.PredictedResult = PredictionResult.Error; _lotteryPredictData.ModifyTime = DateTime.Now; _lotteryPredictDataAppService.Update(_lotteryPredictData); _lotteryPredictData = new LotteryPredictData() { NormId = LotteryNorm.Id, CurrentPredictPeriod = LotteryEngine.ForecastPeriod, StartPeriod = LotteryEngine.ForecastPeriod, EndPeriod = LotteryEngine.ForecastPeriod + LotteryNorm.PlanCycle - 1, MinorCycle = 1, PredictedResult = PredictionResult.NoLottery, }; _isNeedRecalculate = true; } } }
public bool Insert(LotteryPredictData lotteryPredictData) { return(_lotteryPredictDataDapperRepostory.Insert(lotteryPredictData)); }
public bool Update(LotteryPredictData lotteryPredictData) { return(_lotteryPredictDataDapperRepostory.Update(lotteryPredictData)); }