private List <DashboardReportItemSetup> GetLotteriesNextBetDrawDate() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); List <LotteryDrawResult> latestDrawResults = LotteryDataServices.GetLatestDrawResults(); List <Lottery> lotteriesGameList = LotteryDataServices.GetLotteries(); foreach (Lottery lottery in lotteriesGameList) { if (lottery == null) { continue; } LotteryDataServices lotteryDataServicesTMP = new LotteryDataServices(new LotteryDetails(lottery.GetGameMode())); String valueLabel = "drpt_lot_next_drawdate_per_lottery_value"; DateTime nextDrawDate = lotteryDataServicesTMP.GetNextDrawDate(); if (nextDrawDate.Date.CompareTo(DateTime.Now.Date) == 0) { valueLabel += "_today"; } String key = lottery.GetDescription(); String value = ResourcesUtils.GetMessage(valueLabel, DateTimeConverterUtils.ConvertToFormat(nextDrawDate, DateTimeConverterUtils.STANDARD_DATE_FORMAT_WITH_DAYOFWEEK)); DashboardReportItemSetup itm = GenModel(key, value); itm.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_next_drawdate_per_lottery_lbl"); itm.ReportItemDecoration.IsHyperLink = true; itm.DashboardReportItemAction = DashboardReportItemActions.OPEN_LOTTERY_GAME; itm.Tag = lottery.GetGameMode(); itemsList.Add(itm); } return(itemsList); }
public List <int[]> GenerateSequence() { int maximumPickCount = GetFieldParamValueForCount(0); List <LotteryDrawResult> lotteryDrawResults = this.lotteryDataServices.GetLatestLotteryResult(maximumPickCount); String drawDate = DateTimeConverterUtils.ConvertToFormat(this.lotteryDataServices.GetNextDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT) + " 00:00:00.0"; List <int[]> results = new List <int[]>(); foreach (LotteryDrawResult lotDraw in lotteryDrawResults) { SDCARegressionInputModel sampleData = lotDraw.GetSDCARegressionInputModel(true); var predictionResult = SDCARegressionPredictor.Predict(sampleData); //Console.WriteLine(String.Format("Data: {0}, {1},{2},{3},{4},{5},{6},{7},{8} ", sampleData.Draw_date, // sampleData.Num1, sampleData.Num2, sampleData.Num3, sampleData.Num4, sampleData.Num5, sampleData.Num6, // sampleData.Game_cd.ToString(), predictionResult.Score.ToString())); int totalSum = int.Parse(Math.Ceiling(decimal.Parse(predictionResult.Score.ToString())).ToString()); int[] x = ConvertAndFillSequenceThatMakesUpToTotalSum(totalSum); if (IsUniqueSequence(results, x)) { results.Add(x); } } return(results); }
private List <DashboardReportItemSetup> GetLatestDrawResultsPerLotteryGame() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); List <LotteryDrawResult> latestDrawResults = LotteryDataServices.GetLatestDrawResults(); List <Lottery> lotteriesGameList = LotteryDataServices.GetLotteries(); foreach (LotteryDrawResult draw in latestDrawResults) { if (draw == null) { continue; } Lottery lottery = lotteriesGameList.Find((lotteryObj) => (int)lotteryObj.GetGameMode() == draw.GetGameCode()); DateTime today = DateTime.Now; TimeSpan diffWithToday = today - draw.GetDrawDate(); String key = lottery.GetDescription(); String value = ResourcesUtils.GetMessage("drpt_lot_draw_value", DateTimeConverterUtils.ConvertToFormat(draw.GetDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT_WITH_DAYOFWEEK), ((int)diffWithToday.TotalDays).ToString()); DashboardReportItemSetup itm = GenModel(key, value); itm.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_draw_group_lbl"); itm.ReportItemDecoration.IsHyperLink = true; itm.DashboardReportItemAction = DashboardReportItemActions.OPEN_LOTTERY_GAME; itm.Tag = lottery.GetGameMode(); itemsList.Add(itm); } return(itemsList); }
private List <DashboardReportItemSetup> GetLotteryBetsInQueue() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); LotteryDetails lotteryDetails = LotteryDataServices.LotteryDetails; foreach (Lottery lottery in LotteryDataServices.GetLotteries()) { if (lotteryDetails.GameMode != lottery.GetGameMode()) { List <LotteryBet> lotteryBetList = LotteryDataServices.GetLotterybetsQueued(lottery.GetGameMode()); if (lotteryBetList.Count <= 0) { continue; } foreach (LotteryBet bet in lotteryBetList) { String key = DateTimeConverterUtils.ConvertToFormat(bet.GetTargetDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT_WITH_DAYOFWEEK); String value = bet.GetGNUFormat(); DashboardReportItemSetup dshSetup = GenModel(key, value); dshSetup.DashboardReportItemAction = DashboardReportItemActions.OPEN_LOTTERY_GAME; dshSetup.Tag = lottery.GetGameMode(); dshSetup.GroupTaskLabel = ResourcesUtils.GetMessage("drpt_lot_bet_group_lbl_task"); dshSetup.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_bet_group_lbl", lottery.GetDescription(), lotteryBetList.Count.ToString()); dshSetup.ReportItemDecoration.IsHyperLink = true; itemsList.Add(dshSetup); } } } return(itemsList); }
private DashboardReportItemSetup GetLastTimeYouWon() { String key = ResourcesUtils.GetMessage("drpt_last_time_won"); String value = DateTimeConverterUtils.ConvertToFormat(this.reportDataServices.GetLastTimeYouWon(), DateTimeConverterUtils.DATE_FORMAT_LONG); DashboardReportItemSetup itm = GenModel(key, value); itm.GroupKeyName = ResourcesUtils.GetMessage("drpt_money_won"); return(itm); }
private List <DashboardReportItemSetup> GetNextDrawDates() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); int ctrDays = 14; LotterySchedule lotterySchedule = LotteryDataServices.GetLotterySchedule(); DateTime dateStartingTommorow = DateTime.Now.AddDays(1); int idxLabel = 1; for (int ctr = 1; ctr <= ctrDays; ctr++) { if (lotterySchedule.IsDrawDateMatchLotterySchedule(dateStartingTommorow)) { String key = String.Format("{0} ({1})", ResourcesUtils.GetMessage("drpt_next_lottery_sched"), idxLabel++); String value = DateTimeConverterUtils.ConvertToFormat(dateStartingTommorow, DateTimeConverterUtils.DATE_FORMAT_LONG); DashboardReportItemSetup itm2 = GenModel(key, value); itm2.GroupKeyName = ResourcesUtils.GetMessage("drpt_lottery_schedules"); itemsList.Add(itm2); } dateStartingTommorow = dateStartingTommorow.AddDays(1); } return(itemsList); }
public List <int[]> GenerateSequence() { int maximumPickCount = GetFieldParamValueForCount(0); int selectedCoefficient = GetFieldParamValueForCount(1); List <LotteryDrawResult> lotteryDrawResults = this.lotteryDataServices.GetLatestLotteryResult(maximumPickCount); String drawDate = DateTimeConverterUtils.ConvertToFormat(this.lotteryDataServices.GetNextDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT) + " 00:00:00.0"; List <int[]> results = new List <int[]>(); foreach (LotteryDrawResult lotDraw in lotteryDrawResults) { FastTreeInputModel sampleData = lotDraw.GetFastTreeInputModel(); var predictionResult = FastTreePredictor.Predict(sampleData); //Console.WriteLine(String.Format("Data: {0}, {1},{2},{3},{4},{5},{6},{7},{8} ", sampleData.Draw_date, // sampleData.Num1, sampleData.Num2, sampleData.Num3, sampleData.Num4, sampleData.Num5, sampleData.Num6, // sampleData.Game_cd.ToString(), predictionResult.Score.ToString("G20"))); float tmpScore = predictionResult.Score; if (tmpScore <= 0) { tmpScore = (tmpScore * -1) + 1; } if (int.Parse((tmpScore * 1000).ToString("G20").Substring(0, 1)) >= selectedCoefficient) { int[] x = ConvertAndFillSequence(predictionResult.Score); if (IsUniqueSequence(results, x)) { results.Add(x); } } } return(results); }
private List <DashboardReportItemSetup> GetPreviousDrawDates() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); int ctrDays = 14; LotterySchedule lotterySchedule = LotteryDataServices.GetLotterySchedule(); DateTime dateLastXDays = DateTime.Now.AddDays(-ctrDays); int idxLabel = 1; //for one week schedule only for (int ctr = 1; ctr <= ctrDays; ctr++) { if (lotterySchedule.IsDrawDateMatchLotterySchedule(dateLastXDays)) { String key = String.Format("{0} ({1})", ResourcesUtils.GetMessage("drpt_prev_lottery_sched"), idxLabel++); String value = DateTimeConverterUtils.ConvertToFormat(dateLastXDays, DateTimeConverterUtils.DATE_FORMAT_LONG); DashboardReportItemSetup dshSetup = GenModel(key, value); dshSetup.ReportItemDecoration.FontColor = ReportItemDecoration.COLOR_NO_FOCUS; dshSetup.GroupKeyName = ResourcesUtils.GetMessage("drpt_lottery_schedules"); itemsList.Add(dshSetup); } dateLastXDays = dateLastXDays.AddDays(1); } return(itemsList); }
public List <int[]> GenerateSequence() { StartPickGeneration(); String drawDate = DateTimeConverterUtils.ConvertToFormat(this.lotteryDataServices.GetNextDrawDate(), DateTimeConverterUtils.STANDARD_DATE_FORMAT) + " 00:00:00.0"; List <int[]> results = new List <int[]>(); int selectedCoefficient = GetFieldParamValueForCount(1); int maximumPickCount = GetFieldParamValueForCount(0); Random rnd = new Random(); int loopBreaker = 0; int maxLoopBreaker = int.MaxValue - 100; while (true) { int[] lp = LuckyPickGenerator(rnd); // Create single instance of sample data from first line of dataset for model input FastTreeInputModel sampleData = new FastTreeInputModel() { Draw_date = drawDate, Num1 = lp[0], Num2 = lp[1], Num3 = lp[2], Num4 = lp[3], Num5 = lp[4], Num6 = lp[5], Game_cd = this.lotteryDataServices.LotteryDetails.GameCode }; // Make a single prediction on the sample data and print results var predictionResult = FastTreePredictor.Predict(sampleData); float tmpScore = predictionResult.Score; if (tmpScore <= 0) { tmpScore = (tmpScore * -1) + 1; } PickGenerationProgressEvent.IncrementGenerationAttemptCount(); if (int.Parse(tmpScore.ToString().Substring(0, 1)) >= selectedCoefficient) { if (IsUniqueSequence(results, lp)) { results.Add(lp); } PickGenerationProgressEvent.IncrementGeneratedPickCount(); } if (!IsContinuePickGenerationProgress()) { break; } if (loopBreaker++ >= maxLoopBreaker) { break; } if (results.Count >= maximumPickCount) { break; } } RaisePickGenerationProgress(); StopPickGeneration(); return(results); }