public ModifyBetDateFrm(LotteryDataServices lotteryDataServices) { InitializeComponent(); this.lotteryDataServices = lotteryDataServices; this.lotteryTicketPanel = this.lotteryDataServices.GetLotteryTicketPanel(); this.lotteryOutletArr = this.lotteryDataServices.GetLotteryOutlets(); this.lotterySchedule = this.lotteryDataServices.GetLotterySchedule(); this.autoSelectBetList = new List <long>(); this.autoSelectBetLowestDate = DateTime.Now; InitializesFormLabels(); InitializesListViewColumns(); }
public AddBetFrm(LotteryDataServices lotteryDataServices) { InitializeComponent(); this.lotteryDataServices = lotteryDataServices; this.lotteryTicketPanel = this.lotteryDataServices.GetLotteryTicketPanel(); this.lotteryOutletArr = this.lotteryDataServices.GetLotteryOutlets(); this.lotterySchedule = this.lotteryDataServices.GetLotterySchedule(); this.lotterySeqGenArr = this.lotteryDataServices.GetAllSequenceGenerators(); SetupForm(); //need to place it here so that other form calling this form may preset the combo box before showing the form cmbOutlet.Items.AddRange(lotteryOutletArr.ToArray()); cmbSeqGenType.Items.AddRange(lotterySeqGenArr.ToArray()); GenerateTicketPanelNumbers(); }
private void cmbLotSchedLotteries_SelectedIndexChanged(object sender, EventArgs e) { Lottery lottery = (Lottery)cmbLotSchedLotteries.SelectedItem; lblLotSchedSelectedGame.Text = lottery.GetDescription(); LotterySchedule lotSched = this.lotteryDataServices.GetLotterySchedule(lottery.GetGameMode()); chkbLotSchedMon.Checked = lotSched.IsMonday(); chkbLotSchedTue.Checked = lotSched.IsTuesday(); chkbLotSchedWed.Checked = lotSched.IsWednesday(); chkbLotSchedThurs.Checked = lotSched.IsThursday(); chkbLotSchedFri.Checked = lotSched.IsFriday(); chkbLotSchedSat.Checked = lotSched.IsSaturday(); chkbLotSchedSun.Checked = lotSched.IsSunday(); }
public DateTime GetNextDrawDate(DateTime basisDate) { LotterySchedule lotterySchedule = this.lotteryScheduleDao.GetLotterySchedule(gameMode); int breaker = 0; while (true) { if (basisDate.DayOfWeek == DayOfWeek.Monday && lotterySchedule.IsMonday()) { break; } else if (basisDate.DayOfWeek == DayOfWeek.Tuesday && lotterySchedule.IsTuesday()) { break; } else if (basisDate.DayOfWeek == DayOfWeek.Wednesday && lotterySchedule.IsWednesday()) { break; } else if (basisDate.DayOfWeek == DayOfWeek.Thursday && lotterySchedule.IsThursday()) { break; } else if (basisDate.DayOfWeek == DayOfWeek.Friday && lotterySchedule.IsFriday()) { break; } else if (basisDate.DayOfWeek == DayOfWeek.Saturday && lotterySchedule.IsSaturday()) { break; } else if (basisDate.DayOfWeek == DayOfWeek.Sunday && lotterySchedule.IsSunday()) { break; } if (breaker > 1000) { break; } breaker++; basisDate = basisDate.AddDays(1); } return(basisDate); }
public int InsertLotterySchedule(LotterySchedule lsched) { int modified = 0; using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO `lottery_schedule` " + " (`game_cd`, `active`, `mon`, `tues`, `wed`, `thurs`, `fri`, `sat`, `sun`) " + " VALUES " + " (@game_cd, true, @isMon, @isTue, @isWed, @isThu, @isFri, @isSat, @isSun) "; command.Parameters.AddWithValue("@game_cd", (int)lsched.GetGameMode()); command.Parameters.AddWithValue("@isMon", lsched.IsMonday()); command.Parameters.AddWithValue("@isTue", lsched.IsTuesday()); command.Parameters.AddWithValue("@isWed", lsched.IsWednesday()); command.Parameters.AddWithValue("@isThu", lsched.IsThursday()); command.Parameters.AddWithValue("@isFri", lsched.IsFriday()); command.Parameters.AddWithValue("@isSat", lsched.IsSaturday()); command.Parameters.AddWithValue("@isSun", lsched.IsSunday()); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(String.Format(ResourcesUtils.GetMessage("lot_sched_com_impl_msg1"), lsched.GetID())); } else { transaction.Commit(); modified = base.GetLastInsertedID(command); } } return(modified); }
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 void RemoveLotterySchedule(LotterySchedule lsched) { using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand()) { command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_schedule SET active = false " + " WHERE ID = @id AND game_cd = @game_cd AND active = true"; command.Parameters.AddWithValue("@id", lsched.GetID()); command.Parameters.AddWithValue("@game_cd", (int)lsched.GetGameMode()); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); if (result < 0) { transaction.Rollback(); throw new Exception(String.Format(ResourcesUtils.GetMessage("lot_sched_com_impl_msg1"), lsched.GetID())); } transaction.Commit(); } }
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); }