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 DateTime GetLatestDrawDate(GameMode gameMode) { using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " SELECT TOP 1 draw_date " + " FROM draw_results " + " WHERE game_cd = @game_cd" + " ORDER BY draw_date DESC "; command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { while (reader.Read()) { return(DateTime.Parse(reader["draw_date"].ToString())); } } } } return(DateTimeConverterUtils.GetYear2011()); }
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 bool IsValidated() { DateTime newDateTime = dtDrawDate.Value.Date; if (!lotterySchedule.IsDrawDateMatchLotterySchedule(newDateTime)) { log(String.Format(ResourcesUtils.GetMessage("mdd_form_validation_msg2"), newDateTime.Date.ToString("dddd"), lotterySchedule.DrawDateEvery())); return(false); } else if (newDateTime.CompareTo(DateTimeConverterUtils.GetYear2011()) < 0) //if earlier { log(ResourcesUtils.GetMessage("mdd_form_validation_msg5")); return(false); } else if (newDateTime.CompareTo(DateTime.Now.Date) == 0) //if the same { if (lotteryDataServices.IsPastTicketSellingCutoffTime()) { DialogResult drPassCutOfftime = MessageBox.Show(ResourcesUtils.GetMessage("mdd_form_validation_msg8"), ResourcesUtils.GetMessage("mdd_form_others_mgs7"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (drPassCutOfftime != DialogResult.OK) { log(ResourcesUtils.GetMessage("mdd_form_validation_msg6")); return(false); } } } return(true); }
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); }
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 void ModifyBetDateFrm_Load(object sender, EventArgs e) { dateTimePickerBets.Value = DateTimeConverterUtils.GetDefaultFilterDateFrom(); dateTimePickerBetsTo.Value = DateTimeConverterUtils.GetDefaultFilterDateTo(); FillUpBetList(); ResizeColumnsBetList(); LoadTheAutoSelect(); }
public void AddStatusLogs(String moduleName, String logs) { this.statusLogsDelayed.Add(new String[] { DateTimeConverterUtils.GetDateTimeNowStandardFormat(), moduleName, logs }); }
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 void SetBetsAndResultDefaultList() { //Prepare the Dates dateTimePickerDrawResult.Value = DateTimeConverterUtils.GetDefaultFilterDateFrom(); dateTimePickerBets.Value = DateTimeConverterUtils.GetDefaultFilterDateFrom(); dateTimePickerBetsTo.Value = DateTimeConverterUtils.GetDefaultFilterDateTo(); dateTimePickerDrawResultTo.Value = DateTimeConverterUtils.GetDefaultFilterDateTo(); RefreshWinningNumbersGridContent(); RefreshBets(); }
private DateTimePicker GetDateTime(SequenceGeneratorParams seqParam, int addDays) { DateTimePicker dtPicker = new DateTimePicker(); dtPicker.MinDate = DateTimeConverterUtils.GetYear2011(); dtPicker.Tag = seqParam; dtPicker.ValueChanged += DtPicker_ValueChanged; dtPicker.Value = DateTime.Now.AddDays(addDays); return(dtPicker); }
private void HitComparisonFrm_Load(object sender, EventArgs e) { SetupFormLabels(); dateTimePickerFrom.Value = DateTimeConverterUtils.GetDefaultFilterDateFrom(); dateTimePickerTo.Value = DateTimeConverterUtils.GetDefaultFilterDateTo(); toolStripProgBarRefresh.Value = 0; toolStripProgBarRefresh.Visible = false; toolStripStatusLbl.Visible = false; InitializesObjectListViewDataBinding(); StartInitialization(); }
protected void CommonTrainerModelDrawResults() { log(ResourcesUtils.GetMessage("mac_lrn_log_1")); String fileName = FileUtils.GetCSVTempFilePathName(); TrainerDataIntakeModel intakeModel = new TrainerDataIntakeModel(); log(ResourcesUtils.GetMessage("mac_lrn_log_2") + fileName + "\r\n"); using (FileStream fs = File.Create(fileName)) { byte[] info = new UTF8Encoding(true).GetBytes(DataTableHeader); fs.Write(info, 0, info.Length); foreach (Lottery lottery in this.lotteryDataServices.GetLotteries()) { log(ResourcesUtils.GetMessage("mac_lrn_log_3") + lottery.GetDescription()); DateTime startingDateTime = DateTimeConverterUtils.GetYear2011(); while (true) { intakeModel.GameMode = lottery.GetGameMode(); intakeModel.StartingDateTime = startingDateTime; List <Object> lotteryObjResults = GetTrainerDataSets(intakeModel); if (lotteryObjResults.Count > 0) { log(ResourcesUtils.GetMessage("mac_lrn_log_4") + lotteryObjResults.Count); } foreach (Object result in lotteryObjResults) { String content = GetDataSetEntry(result) + "\r\n"; fs.Write(Encoding.UTF8.GetBytes(content), 0, content.Length); if (startingDateTime.CompareTo(GetDrawDateEquivalent(result)) < 0) { startingDateTime = GetDrawDateEquivalent(result); } } if (lotteryObjResults.Count <= 0) { break; } } log(ResourcesUtils.GetMessage("mac_lrn_log_5")); log(ResourcesUtils.GetMessage("mac_lrn_log_6")); fs.Flush(); } } CreateTrainerModel(fileName); }
private void InitializesForms() { SetupForms(); dateTimePickerBets.Value = DateTimeConverterUtils.GetDefaultFilterDateFrom(); dateTimePickerBetsTo.Value = DateTimeConverterUtils.GetDefaultFilterDateTo(); InitializesListViewColumns(); FillUpBetList(); ResizeColumnsBetList(); objectListViewBets.CellEditActivation = BrightIdeasSoftware.ObjectListView.CellEditActivateMode.SingleClickAlways; objectListViewBets.CellEditStarting += ObjectListViewBets_CellEditStarting; objectListViewBets.CellEditFinishing += ObjectListViewBets_CellEditFinishing; objectListViewBets.CellEditFinished += ObjectListViewBets_CellEditFinished; objectListViewBets.UseHotControls = false; objectListViewBets.UseCellFormatEvents = false; toolStripProgBar.Visible = false; toolStripStatusLbl.Text = ""; }
private List <DashboardReportItemSetup> GetLotteryBetsCurrentMonth() { DateTime today = DateTime.Now; List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); LotteryDetails lotteryDetails = LotteryDataServices.LotteryDetails; List <LotteryBet> lotteryBetList = LotteryDataServices.GetLotteryBetsByMonthy(lotteryDetails.GameMode, today.Year, today.Month); List <DateTime[]> weeklyRangeList = DateTimeConverterUtils.GetWeeklyDateRange(today.Year, today.Month); int weekNumber = 1; foreach (DateTime[] weekRange in weeklyRangeList) { DateTime startDate = weekRange[0].AddDays(-1);//initially -1 to solve iteration problem below DateTime endDate = weekRange[1]; double sumAmount = 0; do { startDate = startDate.AddDays(1); foreach (LotteryBet bet in lotteryBetList) { if (bet.GetTargetDrawDate().Day == startDate.Day) { sumAmount += bet.GetBetAmount(); } } } while (startDate.Day != endDate.Day); String key = ResourcesUtils.GetMessage("drpt_lot_bet_current_month_desc", weekNumber++.ToString(), weekRange[0].ToString("MMM"), weekRange[0].ToString("dd"), weekRange[1].ToString("dd")); String value = sumAmount.ToString("C"); DashboardReportItemSetup dshSetup = GenModel(key, value); dshSetup.GroupKeyName = ResourcesUtils.GetMessage("drpt_lot_bet_current_month_group_lbl", today.Year.ToString(), today.ToString("MMM")); if (sumAmount <= 0.00) { dshSetup.ReportItemDecoration.FontColor = ReportItemDecoration.COLOR_NO_FOCUS; } itemsList.Add(dshSetup); } return(itemsList); }
private List <DashboardReportItemSetup> GetMonthlyAndAnnualSpending() { List <DashboardReportItemSetup> itemsList = new List <DashboardReportItemSetup>(); int thisyear = DateTime.Now.Year; int lastyear = thisyear - 1; double[] resultLastYear = this.reportDataServices.GetMonthlySpending(lastyear); double[] resultThisYear = this.reportDataServices.GetMonthlySpending(thisyear); DateTime sampleDate = DateTimeConverterUtils.GetYear2011(); int dataOrder = 97; //monthly for (int ctr = 0; ctr < resultLastYear.Length - 1; ctr++) { String msg = ResourcesUtils.GetMessage(String.Format("drpt_monthly_spending_{0}", ctr + 1)); msg = String.Format(msg, Char.ConvertFromUtf32(dataOrder++), sampleDate.AddMonths(ctr).ToString("MMMM")); String key = String.Format(msg, thisyear, lastyear); String value = String.Format("{0} / {1}", resultThisYear[ctr].ToString("C"), resultLastYear[ctr].ToString("C")); DashboardReportItemSetup mntly = GenModel(key, value); mntly.GroupKeyName = ResourcesUtils.GetMessage("drpt_spending_details", thisyear.ToString(), lastyear.ToString()); if (resultThisYear[ctr] == 0 && resultLastYear[ctr] == 0) { mntly.ReportItemDecoration.FontColor = ReportItemDecoration.COLOR_NO_FOCUS; } itemsList.Add(mntly); } //annual String msg2 = ResourcesUtils.GetMessage("drpt_annual_spending"); msg2 = String.Format(msg2, Char.ConvertFromUtf32(dataOrder++)); String key2 = String.Format(msg2, thisyear, lastyear); String value2 = String.Format("{0} / {1}", resultThisYear[12].ToString("C"), resultLastYear[12].ToString("C")); DashboardReportItemSetup mntly1 = GenModel(key2, value2); mntly1.GroupKeyName = ResourcesUtils.GetMessage("drpt_spending_details", thisyear.ToString(), lastyear.ToString()); itemsList.Add(mntly1); return(itemsList); }
public ProfitAndLossReport(List <int> gameCodes) : base(null) { this.gameCodeList = gameCodes; this.claimDetailsList = new Dictionary <string, object>(); this.earliestBetTimeYouMade = DateTime.Now; this.latestBetTimeYouMade = DateTime.Now; this.whenWasLastTimeYouWon = DateTimeConverterUtils.GetYear2011(); this.timesWonPerBetCombinationDict = new Dictionary <string, object>(); this.allBetsInTabularMode = new List <double[]>(); this.allBetsInTabularModeDaysOfWeek = new List <String[]>(); this.allBetsInTabularModePickGen = new List <String[]>(); this.allBetsInTabularModeOutlet = new List <String[]>(); this.allBetsInTabularModeWinningBet = new List <String[]>(); foreach (int gameCode in this.gameCodeList) { InitializesAllValues(new LotteryDataServices(GameFactory.GetInstance(gameCode))); } GetTallyAllBetsInTabularMode(this.gameCodeList); GetDaysOfWeekTallyAllBetsInTabularMode(this.gameCodeList); GetDaysOfWeekTallyPickGen(this.gameCodeList); GetOutletTally(this.gameCodeList); GetWinningBetDigitTally(this.gameCodeList); }
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); }
public double GetTotalMoneyBetted() { return(lotteryBetDao.GetTotalAmountBetted(GameMode, DateTimeConverterUtils.GetYear2011(), DateTime.Now)); }
public static DateTime ConvertCutoffTimeToDateTime(String cutOffTimeString) { return(DateTimeConverterUtils.GetDateTimeInstance(cutOffTimeString, DateTimeConverterUtils.STANDARD_DATE_TIME_FORMAT)); }