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); }
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 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); }
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 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); }
public double GetTotalMoneyBetted() { return(lotteryBetDao.GetTotalAmountBetted(GameMode, DateTimeConverterUtils.GetYear2011(), DateTime.Now)); }