diff --git a/App.config b/App.config index 9aa164b..768114a 100644 --- a/App.config +++ b/App.config @@ -32,7 +32,7 @@ 0 - 9 + 11 LottoDataManager diff --git a/Includes/Classes/Reports/DashboardReport.cs b/Includes/Classes/Reports/DashboardReport.cs index ec110e3..51fe9e8 100644 --- a/Includes/Classes/Reports/DashboardReport.cs +++ b/Includes/Classes/Reports/DashboardReport.cs @@ -328,22 +328,19 @@ private List GetLotteryBetsInQueue() LotteryDetails lotteryDetails = LotteryDataServices.LotteryDetails; foreach (Lottery lottery in LotteryDataServices.GetLotteries()) { - if(lotteryDetails.GameMode != lottery.GetGameMode()) + List lotteryBetList = LotteryDataServices.GetLotterybetsQueued(lottery.GetGameMode()); + if (lotteryBetList.Count <= 0) continue; + foreach(LotteryBet bet in lotteryBetList) { - List 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); - } + 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; diff --git a/Includes/Classes/Reports/Templates/IndividualGameHTMLReportView.cs b/Includes/Classes/Reports/Templates/IndividualGameHTMLReportView.cs index ac198f6..3647ac4 100644 --- a/Includes/Classes/Reports/Templates/IndividualGameHTMLReportView.cs +++ b/Includes/Classes/Reports/Templates/IndividualGameHTMLReportView.cs @@ -11,9 +11,7 @@ namespace LottoDataManager.Includes.Classes.Reports.Templates [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "16.0.0.0")] public partial class IndividualGameHTMLReportView : IndividualGameHTMLReportViewBase { - public virtual string TransformText() { return ""; } - public virtual void Initialize() { } } #region Base class diff --git a/Includes/Database/DAO/Impl/LotteryBetDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryBetDaoImpl.cs index bbdc49b..a8b4f19 100644 --- a/Includes/Database/DAO/Impl/LotteryBetDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryBetDaoImpl.cs @@ -79,12 +79,12 @@ public List GetDashboardLatestBets(GameMode gameMode, DateTime since " WHERE a.target_draw_date = b.draw_date " + " AND a.game_cd = b.game_cd) IS NULL " + " ORDER BY a.target_draw_date DESC, a.ID DESC "; - command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = gameMode; - command.Parameters.AddWithValue("@sinceWhen", OleDbType.DBDate).Value = sinceWhen.Date.ToString(); - command.Parameters.AddWithValue("@dateTo", OleDbType.DBDate).Value = dateTo.Date.ToString(); - command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = gameMode; - command.Parameters.AddWithValue("@sinceWhen", OleDbType.DBDate).Value = sinceWhen.Date.ToString(); - command.Parameters.AddWithValue("@dateTo", OleDbType.DBDate).Value = dateTo.Date.ToString(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@sinceWhen", OleDbType.DBDate).Value = sinceWhen.Date.ToString(); + command.Parameters.Add("@dateTo", OleDbType.DBDate).Value = dateTo.Date.ToString(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@sinceWhen", OleDbType.DBDate).Value = sinceWhen.Date.ToString(); + command.Parameters.Add("@dateTo", OleDbType.DBDate).Value = dateTo.Date.ToString(); command.Connection = conn; conn.Open(); @@ -110,8 +110,8 @@ public List GetLotteryBets(GameMode gameMode, DateTime betDrawDate) " AND target_draw_date = CDATE(@sinceWhen) " + " AND active = true " + " ORDER BY target_draw_date DESC, ID DESC "; - command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = gameMode; - command.Parameters.AddWithValue("@sinceWhen", OleDbType.DBDate).Value = betDrawDate.Date.ToString(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@sinceWhen", OleDbType.DBDate).Value = betDrawDate.Date.ToString(); command.Connection = conn; conn.Open(); @@ -139,9 +139,9 @@ public List GetLotteryBetsByMonthy(GameMode gameMode, int year, int " AND MONTH(target_draw_date) = @month " + " AND active = true " + " ORDER BY target_draw_date DESC, ID DESC "; - command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = gameMode; - command.Parameters.AddWithValue("@year", year); - command.Parameters.AddWithValue("@month", month); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@year", OleDbType.Integer).Value = year; + command.Parameters.Add("@month", OleDbType.Integer).Value = month; command.Connection = conn; conn.Open(); @@ -171,7 +171,7 @@ public List ExtractLotteryBetsCheckWinningNumber(GameMode gameMode) " AND b.active IS NULL " + " AND a.game_cd = @game_cd " + " ORDER BY a.target_draw_date DESC, a.ID DESC "; - command.Parameters.AddWithValue("@game_cd", gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; command.Connection = conn; conn.Open(); @@ -193,8 +193,8 @@ public void UpdateTargetDrawDate(long id, DateTime newTargetDrawDate) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_bet SET target_draw_date = CDATE(@new_target_draw_date) " + " WHERE ID = @id AND active = true"; - command.Parameters.AddWithValue("@new_target_draw_date", OleDbType.DBDate).Value = newTargetDrawDate.ToString(); - command.Parameters.AddWithValue("@id", OleDbType.BigInt).Value = (long)id; + command.Parameters.Add("@new_target_draw_date", OleDbType.DBDate).Value = newTargetDrawDate.ToString(); + command.Parameters.Add("@id", OleDbType.Integer).Value = (long)id; command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -228,16 +228,16 @@ public bool IsBetExisting(LotteryBet lotteryBet) " AND @num4 IN(num1, num2, num3, num4, num5, num6) " + " AND @num5 IN(num1, num2, num3, num4, num5, num6) " + " AND @num6 IN(num1, num2, num3, num4, num5, num6)) "; - command.Parameters.AddWithValue("@game_cd", lotteryBet.GetGameCode()); - command.Parameters.AddWithValue("@draw_date", lotteryBet.GetTargetDrawDate().Date.ToString()); - command.Parameters.AddWithValue("@outletCd", lotteryBet.GetOutletCode()); - command.Parameters.AddWithValue("@seqgencd", lotteryBet.GetLotterySequenceGenerator().GetSeqGenCode()); - command.Parameters.AddWithValue("@num1", lotteryBet.GetNum1()); - command.Parameters.AddWithValue("@num2", lotteryBet.GetNum2()); - command.Parameters.AddWithValue("@num3", lotteryBet.GetNum3()); - command.Parameters.AddWithValue("@num4", lotteryBet.GetNum4()); - command.Parameters.AddWithValue("@num5", lotteryBet.GetNum5()); - command.Parameters.AddWithValue("@num6", lotteryBet.GetNum6()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = lotteryBet.GetGameCode(); + command.Parameters.Add("@draw_date", OleDbType.Variant).Value = lotteryBet.GetTargetDrawDate().Date.ToString(); + command.Parameters.Add("@outletCd", OleDbType.Integer).Value = lotteryBet.GetOutletCode(); + command.Parameters.Add("@seqgencd", OleDbType.Integer).Value = lotteryBet.GetLotterySequenceGenerator().GetSeqGenCode(); + command.Parameters.Add("@num1", OleDbType.Integer).Value = lotteryBet.GetNum1(); + command.Parameters.Add("@num2", OleDbType.Integer).Value = lotteryBet.GetNum2(); + command.Parameters.Add("@num3", OleDbType.Integer).Value = lotteryBet.GetNum3(); + command.Parameters.Add("@num4", OleDbType.Integer).Value = lotteryBet.GetNum4(); + command.Parameters.Add("@num5", OleDbType.Integer).Value = lotteryBet.GetNum5(); + command.Parameters.Add("@num6", OleDbType.Integer).Value = lotteryBet.GetNum6(); command.Connection = conn; conn.Open(); @@ -272,17 +272,17 @@ public void InsertLotteryBet(List lotteryBetArr) { if (IsBetExisting(item)) continue; command.Parameters.Clear(); - command.Parameters.AddWithValue("@game_cda", item.GetGameCode()); - command.Parameters.AddWithValue("@target_draw_datea", item.GetTargetDrawDate().Date.ToString()); - command.Parameters.AddWithValue("@bet_amta", item.GetBetAmount()); - command.Parameters.AddWithValue("@outlet_cda", item.GetOutletCode()); - command.Parameters.AddWithValue("@seqgencda", item.GetLotterySequenceGenerator().GetSeqGenCode()); - command.Parameters.AddWithValue("@num1a", item.GetNum1()); - command.Parameters.AddWithValue("@num2a", item.GetNum2()); - command.Parameters.AddWithValue("@num3a", item.GetNum3()); - command.Parameters.AddWithValue("@num4a", item.GetNum4()); - command.Parameters.AddWithValue("@num5a", item.GetNum5()); - command.Parameters.AddWithValue("@num6a", item.GetNum6()); + command.Parameters.Add("@game_cda", OleDbType.Integer).Value = item.GetGameCode(); + command.Parameters.Add("@target_draw_datea", OleDbType.DBDate).Value = item.GetTargetDrawDate().Date.ToString(); + command.Parameters.Add("@bet_amta", OleDbType.Double).Value = item.GetBetAmount(); + command.Parameters.Add("@outlet_cda", OleDbType.Integer).Value = item.GetOutletCode(); + command.Parameters.Add("@seqgencda", OleDbType.Integer).Value = item.GetLotterySequenceGenerator().GetSeqGenCode(); + command.Parameters.Add("@num1a", OleDbType.Integer).Value = item.GetNum1(); + command.Parameters.Add("@num2a", OleDbType.Integer).Value = item.GetNum2(); + command.Parameters.Add("@num3a", OleDbType.Integer).Value = item.GetNum3(); + command.Parameters.Add("@num4a", OleDbType.Integer).Value = item.GetNum4(); + command.Parameters.Add("@num5a", OleDbType.Integer).Value = item.GetNum5(); + command.Parameters.Add("@num6a", OleDbType.Integer).Value = item.GetNum6(); command.Transaction = transaction; int result = command.ExecuteNonQuery(); @@ -315,17 +315,18 @@ public int InsertLotteryBet(LotteryBet lotteryBet) " @bet_amta, 1, @outlet_cda, @seqgencda, " + " @num1a, @num2a, @num3a, @num4a, @num5a, @num6a) "; command.Connection = conn; - command.Parameters.AddWithValue("@game_cda", lotteryBet.GetGameCode()); - command.Parameters.AddWithValue("@target_draw_datea", lotteryBet.GetTargetDrawDate().Date.ToString()); - command.Parameters.AddWithValue("@bet_amta", lotteryBet.GetBetAmount()); - command.Parameters.AddWithValue("@outlet_cda", lotteryBet.GetOutletCode()); - command.Parameters.AddWithValue("@seqgencda", lotteryBet.GetLotterySequenceGenerator().GetSeqGenCode()); - command.Parameters.AddWithValue("@num1a", lotteryBet.GetNum1()); - command.Parameters.AddWithValue("@num2a", lotteryBet.GetNum2()); - command.Parameters.AddWithValue("@num3a", lotteryBet.GetNum3()); - command.Parameters.AddWithValue("@num4a", lotteryBet.GetNum4()); - command.Parameters.AddWithValue("@num5a", lotteryBet.GetNum5()); - command.Parameters.AddWithValue("@num6a", lotteryBet.GetNum6()); + command.Parameters.Add("@game_cda", OleDbType.Integer).Value = lotteryBet.GetGameCode(); + command.Parameters.Add("@target_draw_datea", OleDbType.DBDate).Value = lotteryBet.GetTargetDrawDate().Date.ToString(); + command.Parameters.Add("@bet_amta", OleDbType.Double).Value = lotteryBet.GetBetAmount(); + command.Parameters.Add("@outlet_cda", OleDbType.Integer).Value = lotteryBet.GetOutletCode(); + command.Parameters.Add("@seqgencda", OleDbType.Integer).Value = lotteryBet.GetLotterySequenceGenerator().GetSeqGenCode(); + command.Parameters.Add("@num1a", OleDbType.Integer).Value = lotteryBet.GetNum1(); + command.Parameters.Add("@num2a", OleDbType.Integer).Value = lotteryBet.GetNum2(); + command.Parameters.Add("@num3a", OleDbType.Integer).Value = lotteryBet.GetNum3(); + command.Parameters.Add("@num4a", OleDbType.Integer).Value = lotteryBet.GetNum4(); + command.Parameters.Add("@num5a", OleDbType.Integer).Value = lotteryBet.GetNum5(); + command.Parameters.Add("@num6a", OleDbType.Integer).Value = lotteryBet.GetNum6(); + conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); command.Transaction = transaction; @@ -410,7 +411,7 @@ public void RemoveLotteryBet(long id) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_bet SET active = 0 " + " WHERE ID = @id"; - command.Parameters.AddWithValue("@id", OleDbType.BigInt).Value = (long)id; + command.Parameters.Add("@id", OleDbType.Integer).Value = id; command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -436,9 +437,9 @@ public double GetTotalAmountBetted(GameMode gameMode, DateTime dateFrom, DateTim " WHERE active = true " + " AND game_cd = @game_cd " + " AND target_draw_date BETWEEN CDATE(@from) AND CDATE(@to) "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@from", dateFrom.Date.ToString()); - command.Parameters.AddWithValue("@to", dateTo.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@from", OleDbType.DBDate).Value = dateFrom.Date.ToString(); + command.Parameters.Add("@to", OleDbType.DBDate).Value = dateTo.Date.ToString(); command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -467,7 +468,7 @@ public int GetTotalBetMade(GameMode gameMode) " FROM lottery_bet " + " WHERE game_cd = @game_cd " + " AND active = true"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -502,7 +503,7 @@ public int[] GetTotalNumberOfClaims(GameMode gameMode) " AND a.active = true " + " AND b.active = true " + " AND b.winning_amt > 0 "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -543,8 +544,8 @@ public List GetAllRedeemedClaims(GameMode gameMode, bool isGetClaime " AND b.winning_amt > 0 " + " AND b.claim_status = @claim_status " + " ORDER BY a.target_draw_date DESC, a.ID DESC "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@claim_status", isGetClaimedStatus); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@claim_status", OleDbType.Boolean).Value = isGetClaimedStatus; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -576,8 +577,8 @@ public double[] GetTotalLuckyPickWinAndLoose(GameMode gameMode) " AND a.active = true " + " AND b.active = true " + " AND a.seqgencd IN (@luckypick) "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@luckypick", (int)GeneratorType.LUCKY_PICK); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@luckypick", OleDbType.Integer).Value = (int)GeneratorType.LUCKY_PICK; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -609,7 +610,7 @@ public int GetTotalYearsOfBetting(GameMode gameMode) " FROM lottery_bet " + " WHERE active = true " + " AND game_cd = @game_cd) a "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -641,7 +642,7 @@ public DateTime[] GetMinMaxYearsOfBetting(GameMode gameMode) " FROM lottery_bet " + " WHERE active = true " + " AND game_cd = @game_cd) a "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -677,7 +678,7 @@ public DateTime GetLastTimeWon(GameMode gameMode) " AND b.winning_amt > 0 " + " ORDER BY a.target_draw_date DESC "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -716,9 +717,10 @@ public List GetLotteryBetsCurrentSeason(GameMode gameMode) " AND d.game_cd = @game_cd3 " + " ORDER BY d.draw_date DESC) " + " ORDER BY a.draw_date ASC)"; - command.Parameters.AddWithValue("@game_cd1", gameMode); - command.Parameters.AddWithValue("@game_cd2", gameMode); - command.Parameters.AddWithValue("@game_cd3", gameMode); + + command.Parameters.Add("@game_cd1", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@game_cd2", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@game_cd3", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); @@ -748,7 +750,7 @@ public List GetLotterybetsQueued(GameMode gameMode) " AND b.`draw_date` = a.target_draw_date) IS NULL " + " ORDER BY a.target_draw_date ASC "; - command.Parameters.AddWithValue("@game_cd", (int) gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); @@ -786,8 +788,8 @@ public double[] GetMonthlySpending(GameMode gameMode, int year) " WHERE game_cd = @game_cd " + " AND YEAR(target_draw_date) = @year " + " AND active = true"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@year", year); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@year", OleDbType.Integer).Value = year; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -922,8 +924,8 @@ public List GetLottoCountMatchMLDataset(GameMode gameMode, DateTime " AND a.target_draw_date > CDATE(@startingDate) " + " AND a.active = true " + " ORDER BY a.game_cd ASC "; - command.Parameters.AddWithValue("@game_cd", gameMode); - command.Parameters.AddWithValue("@startingDate", startingDate.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@startingDate", OleDbType.DBDate).Value = startingDate.Date.ToString(); command.Connection = conn; conn.Open(); diff --git a/Includes/Database/DAO/Impl/LotteryDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryDaoImpl.cs index 4d32226..cfd9bbb 100644 --- a/Includes/Database/DAO/Impl/LotteryDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryDaoImpl.cs @@ -33,7 +33,7 @@ public Lottery GetLottery(GameMode gameCode) { command.CommandType = CommandType.Text; command.CommandText = "SELECT * FROM lottery WHERE game_cd = @game_cd AND active = true;"; - command.Parameters.AddWithValue("@game_cd", gameCode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameCode; command.Connection = conn; conn.Open(); diff --git a/Includes/Database/DAO/Impl/LotteryDrawResultDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryDrawResultDaoImpl.cs index 36260c7..9d55260 100644 --- a/Includes/Database/DAO/Impl/LotteryDrawResultDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryDrawResultDaoImpl.cs @@ -23,20 +23,7 @@ public static LotteryDrawResultDao GetInstance() } return lotteryDrawResultDaoImpl; } - private DataTable GetStandardDrawResultTable() - { - DataTable dt = new DataTable(); - dt.Columns.Add("Draw Date", typeof(DateTime)); - dt.Columns.Add("Num 1", typeof(int)); - dt.Columns.Add("Num 2", typeof(int)); - dt.Columns.Add("Num 3", typeof(int)); - dt.Columns.Add("Num 4", typeof(int)); - dt.Columns.Add("Num 5", typeof(int)); - dt.Columns.Add("Num 6", typeof(int)); - dt.Columns.Add("Jackpot Amount", typeof(double)); - dt.Columns.Add("Winners", typeof(int)); - return dt; - } + public DataTable GetLotteryDrawResult(GameMode gameMode, DateTime drawDate) { DataTable dt = new DataTable(); @@ -60,8 +47,8 @@ public LotteryDrawResult GetLotteryDrawResultByDrawDate(GameMode gameMode, DateT { command.CommandType = CommandType.Text; command.CommandText = GetStandardSelectQuery() + " AND draw_date = CDATE(@drawDate)"; - command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = (int)gameMode; - command.Parameters.AddWithValue("@drawDate", OleDbType.DBDate).Value = drawDate.ToString(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@drawDate", OleDbType.DBDate).Value = drawDate.ToString(); command.Connection = conn; conn.Open(); @@ -84,7 +71,7 @@ public List GetAllDrawResults(GameMode gameMode) { command.CommandType = CommandType.Text; command.CommandText = "SELECT * FROM (" + GetStandardSelectQuery() + " ORDER BY draw_date DESC)"; - command.Parameters.AddWithValue("@game_cd", gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -107,7 +94,7 @@ public LotteryDrawResult GetLatestDrawResult(int gameCd) " FROM `draw_results` " + " WHERE `game_cd`= @game_cd " + " ORDER BY `draw_date` DESC"; - command.Parameters.AddWithValue("@game_cd", gameCd.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Variant).Value = gameCd.ToString(); command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -130,7 +117,7 @@ public List GetLatestLotteryResult(GameMode gameMode, int how command.CommandType = CommandType.Text; command.CommandText = "SELECT TOP " + howManyDraws.ToString() + " * FROM (" + GetStandardSelectQuery() + " ORDER BY draw_date DESC)"; //command.Parameters.AddWithValue("@draws", howManyDraws); - command.Parameters.AddWithValue("@game_cd", gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -153,9 +140,9 @@ public List GetDrawResultsFromStartingDate(GameMode gameMode, command.CommandText = GetStandardSelectQuery() + " AND draw_date BETWEEN CDATE(@startingDrawDate) AND CDATE(@endingDate) " + " ORDER BY draw_date DESC"; - command.Parameters.AddWithValue("@game_cd", (int) gameMode); - command.Parameters.AddWithValue("@startingDrawDate", startingDrawDate.ToString()); - command.Parameters.AddWithValue("@endingDate", endingDate.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@startingDrawDate", OleDbType.DBDate).Value = startingDrawDate.ToString(); + command.Parameters.Add("@endingDate", OleDbType.DBDate).Value = endingDate.ToString(); command.Connection = conn; conn.Open(); @@ -179,8 +166,8 @@ public DateTime GetNextDrawDate(GameMode gameMode, DateTime betDate) " WHERE game_cd = @game_cd " + " AND draw_date > CDATE(@betDate) " + " ORDER BY draw_date ASC "; - command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = (int)gameMode; - command.Parameters.AddWithValue("@betDate", OleDbType.DBDate).Value = betDate.ToString(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@betDate", OleDbType.DBDate).Value = betDate.ToString(); command.Connection = conn; conn.Open(); @@ -205,16 +192,16 @@ public void InsertDrawDate(LotteryDrawResult lotteryDrawResult) command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO draw_results (draw_date,jackpot_amt,winners,game_cd,num1,num2,num3,num4,num5,num6) " + " VALUES (@draw_date,@jackpot_amt,@winners,@game_cd,@num1,@num2,@num3,@num4,@num5,@num6)"; - command.Parameters.AddWithValue("@draw_date", lotteryDrawResult.GetDrawDate()); - command.Parameters.AddWithValue("@jackpot_amt", lotteryDrawResult.GetJackpotAmt()); - command.Parameters.AddWithValue("@winners", lotteryDrawResult.GetWinnersCount()); - command.Parameters.AddWithValue("@game_cd", lotteryDrawResult.GetGameCode()); - command.Parameters.AddWithValue("@num1", lotteryDrawResult.GetNum1()); - command.Parameters.AddWithValue("@num2", lotteryDrawResult.GetNum2()); - command.Parameters.AddWithValue("@num3", lotteryDrawResult.GetNum3()); - command.Parameters.AddWithValue("@num4", lotteryDrawResult.GetNum4()); - command.Parameters.AddWithValue("@num5", lotteryDrawResult.GetNum5()); - command.Parameters.AddWithValue("@num6", lotteryDrawResult.GetNum6()); + command.Parameters.Add("@draw_date", OleDbType.DBDate).Value = lotteryDrawResult.GetDrawDate(); + command.Parameters.Add("@jackpot_amt", OleDbType.Double).Value = lotteryDrawResult.GetJackpotAmt(); + command.Parameters.Add("@winners", OleDbType.Integer).Value = lotteryDrawResult.GetWinnersCount(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = lotteryDrawResult.GetGameCode(); + command.Parameters.Add("@num1", OleDbType.Integer).Value = lotteryDrawResult.GetNum1(); + command.Parameters.Add("@num2", OleDbType.Integer).Value = lotteryDrawResult.GetNum2(); + command.Parameters.Add("@num3", OleDbType.Integer).Value = lotteryDrawResult.GetNum3(); + command.Parameters.Add("@num4", OleDbType.Integer).Value = lotteryDrawResult.GetNum4(); + command.Parameters.Add("@num5", OleDbType.Integer).Value = lotteryDrawResult.GetNum5(); + command.Parameters.Add("@num6", OleDbType.Integer).Value = lotteryDrawResult.GetNum6(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -239,7 +226,7 @@ public DateTime GetLatestDrawDate(GameMode gameMode) " FROM draw_results " + " WHERE game_cd = @game_cd" + " ORDER BY draw_date DESC "; - command.Parameters.AddWithValue("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); @@ -271,8 +258,8 @@ public List GetTopDrawnDigitResults(GameMode gameMode) " WHERE d.winners > 0 " + " AND d.game_cd = @game_cd2 " + " ORDER BY d.draw_date DESC)"; - command.Parameters.AddWithValue("@game_cd1", (int)gameMode); - command.Parameters.AddWithValue("@game_cd2", (int)gameMode); + command.Parameters.Add("@game_cd1", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@game_cd2", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); @@ -314,10 +301,10 @@ public List GetTopDrawnPreviousSeasonDigitResults(GameMode gameMode) " AND CDATE(@toDate) " + " AND a.draw_date<> CDATE(@fromDate) " + " ORDER BY a.draw_date DESC"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@fromDate", fromDate.Date.ToString()); - command.Parameters.AddWithValue("@toDate", toDate.Date.ToString()); - command.Parameters.AddWithValue("@fromDate", fromDate.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@fromDate", OleDbType.DBDate).Value = fromDate.Date.ToString(); + command.Parameters.Add("@toDate", OleDbType.DBDate).Value = toDate.Date.ToString(); + command.Parameters.Add("@fromDate", OleDbType.DBDate).Value = fromDate.Date.ToString(); command.Connection = conn; conn.Open(); @@ -350,7 +337,7 @@ public List GetTopDrawnDigitFromJackpotsResults(GameMode gameMode) " FROM draw_results " + " WHERE game_cd = @game_cd " + " AND winners > 0"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); @@ -383,9 +370,9 @@ public List GetTopDrawnDigitFromDateRange(GameMode gameMode, DateTime dateF " FROM draw_results " + " WHERE game_cd = @game_cd " + " AND draw_date BETWEEN CDATE(@dateFrom) AND CDATE(@dateTo)"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@dateFrom", dateFrom.Date.ToString()); - command.Parameters.AddWithValue("@dateTo", dateTo.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@dateFrom", OleDbType.DBDate).Value = dateFrom.Date.ToString(); + command.Parameters.Add("@dateTo", OleDbType.DBDate).Value = dateTo.Date.ToString(); command.Connection = conn; conn.Open(); @@ -418,9 +405,9 @@ public List GetTopDrawnDigitToSequenceFromDateRange(GameMode gameMode, Da " FROM draw_results " + " WHERE game_cd = @game_cd " + " AND draw_date BETWEEN CDATE(@dateFrom) AND CDATE(@dateTo)"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@dateFrom", dateFrom.Date.ToString()); - command.Parameters.AddWithValue("@dateTo", dateTo.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; + command.Parameters.Add("@dateFrom", OleDbType.DBDate).Value = dateFrom.Date.ToString(); + command.Parameters.Add("@dateTo", OleDbType.DBDate).Value = dateTo.Date.ToString(); command.Connection = conn; conn.Open(); @@ -455,7 +442,7 @@ public List GetJackpotDrawResults(GameMode gameMode) " WHERE game_cd = @game_cd " + " AND winners> 0 " + " ORDER BY draw_date DESC"; - command.Parameters.AddWithValue("@game_cd", gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -493,9 +480,9 @@ private OleDbCommand GetDrawResultCommandByRange(GameMode gameMode, DateTime fro " AND (draw_date " + " BETWEEN CDate(@date_from) " + " AND CDate(@date_to))"); - command.Parameters.AddWithValue("@game_cd", gameMode); - command.Parameters.AddWithValue("@date_from", fromDate); - command.Parameters.AddWithValue("@date_to", (toDate == null) ? fromDate : toDate); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@date_from", OleDbType.DBDate).Value = fromDate; + command.Parameters.Add("@date_to", OleDbType.DBDate).Value = (toDate == null) ? fromDate : toDate; return command; } private String GetStandardSelectQuery() @@ -518,8 +505,8 @@ public List GetFastTreeMLDataSet(GameMode gameMode, DateTime " WHERE game_cd = @game_cd " + " AND `draw_date` > CDATE(@startingDate) " + " ORDER BY `draw_date` ASC "; - command.Parameters.AddWithValue("@game_cd", gameMode); - command.Parameters.AddWithValue("@startingDate", startingDate.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@startingDate", OleDbType.DBDate).Value = startingDate.Date.ToString(); command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -544,8 +531,8 @@ public List GetSDCAMLDataSet(GameMode gameMode, DateTime star " WHERE game_cd = @game_cd " + " AND `draw_date` > CDATE(@startingDate) " + " ORDER BY `draw_date` ASC "; - command.Parameters.AddWithValue("@game_cd", gameMode); - command.Parameters.AddWithValue("@startingDate", startingDate.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@startingDate", OleDbType.DBDate).Value = startingDate.Date.ToString(); command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -572,8 +559,8 @@ public List GetDrawResultWinCountMLDataset(GameMode gameMode, " WHERE game_cd = @game_cd " + " AND `draw_date` > CDATE(@startingDate) " + " ORDER BY `game_cd` ASC, `draw_date` ASC"; - command.Parameters.AddWithValue("@game_cd", gameMode); - command.Parameters.AddWithValue("@startingDate", startingDate.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = gameMode; + command.Parameters.Add("@startingDate", OleDbType.DBDate).Value = startingDate.Date.ToString(); command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) diff --git a/Includes/Database/DAO/Impl/LotteryOutletDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryOutletDaoImpl.cs index a56f7b7..3e6b5ce 100644 --- a/Includes/Database/DAO/Impl/LotteryOutletDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryOutletDaoImpl.cs @@ -56,7 +56,7 @@ public LotteryOutlet GetDefaultLotteryOutlet() { command.CommandType = CommandType.Text; command.CommandText = "SELECT * FROM lottery_outlet WHERE outlet_cd = @outlet_cd AND active = true ORDER BY description ASC"; - command.Parameters.AddWithValue("@outlet_cd", ResourcesUtils.LotteryOutletDefaultCode); + command.Parameters.Add("@outlet_cd", OleDbType.Integer).Value = ResourcesUtils.LotteryOutletDefaultCode; command.Connection = conn; conn.Open(); @@ -79,9 +79,9 @@ public void UpdateDescription(LotteryOutlet updatedModel) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_outlet SET description = @description " + " WHERE ID = @id AND outlet_cd = @outlet_cd AND active = true"; - command.Parameters.AddWithValue("@description", StringUtils.Truncate(updatedModel.GetDescription(), MAX_LEN_DESCRIPTION)); - command.Parameters.AddWithValue("@id", updatedModel.GetId()); - command.Parameters.AddWithValue("@outlet_cd", updatedModel.GetOutletCode()); + command.Parameters.Add("@description", OleDbType.Variant).Value = StringUtils.Truncate(updatedModel.GetDescription(), MAX_LEN_DESCRIPTION); + command.Parameters.Add("@id", OleDbType.Integer).Value = updatedModel.GetId(); + command.Parameters.Add("@outlet_cd", OleDbType.Integer).Value = updatedModel.GetOutletCode(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -105,7 +105,7 @@ public bool IsLotteryOutletUsed(int outletCd) command.CommandText = "SELECT count(ID) AS [total] FROM lottery_bet " + " WHERE outlet_cd = @outlet_cd " + " AND active = true "; - command.Parameters.AddWithValue("@outlet_cd", outletCd); + command.Parameters.Add("@outlet_cd", OleDbType.Integer).Value = outletCd; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -135,9 +135,9 @@ public void RemoveOutlet(LotteryOutlet modelToRemove) command.CommandText = " UPDATE lottery_outlet SET active = false " + " WHERE ID = @id AND outlet_cd = @outlet_cd " + " AND description = @outlet_desc AND active = true "; - command.Parameters.AddWithValue("@id", modelToRemove.GetId()); - command.Parameters.AddWithValue("@outlet_cd", modelToRemove.GetOutletCode()); - command.Parameters.AddWithValue("@outlet_desc", modelToRemove.GetDescription()); + command.Parameters.Add("@id", OleDbType.Integer).Value = modelToRemove.GetId(); + command.Parameters.Add("@outlet_cd", OleDbType.Integer).Value = modelToRemove.GetOutletCode(); + command.Parameters.Add("@outlet_desc", OleDbType.Variant).Value = modelToRemove.GetDescription(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -161,7 +161,7 @@ public bool IsDescriptionExisting(String outletDescription) command.CommandText = "SELECT count(ID) AS [total] FROM lottery_outlet " + " WHERE description = @outletDescription " + " AND active = true "; - command.Parameters.AddWithValue("@outletDescription", outletDescription); + command.Parameters.Add("@outletDescription", OleDbType.Variant).Value = outletDescription; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -195,8 +195,8 @@ public int InsertLotteryOutlet(String outletDescription) command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO `lottery_outlet` (`outlet_cd`, `description`, `active`) " + " VALUES(@nextOutletCode, @outletDescription, true)"; - command.Parameters.AddWithValue("@nextOutletCode", nextOutletCode); - command.Parameters.AddWithValue("@outletDescription", StringUtils.Truncate(outletDescription, MAX_LEN_DESCRIPTION)); + command.Parameters.Add("@nextOutletCode", OleDbType.Integer).Value = nextOutletCode; + command.Parameters.Add("@outletDescription", OleDbType.Variant).Value = StringUtils.Truncate(outletDescription, MAX_LEN_DESCRIPTION); command.Connection = conn; conn.Open(); diff --git a/Includes/Database/DAO/Impl/LotteryScheduleDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryScheduleDaoImpl.cs index b582c2c..857e6d2 100644 --- a/Includes/Database/DAO/Impl/LotteryScheduleDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryScheduleDaoImpl.cs @@ -28,7 +28,7 @@ public LotterySchedule GetLotterySchedule(GameMode gameMode) { using(OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using(OleDbCommand command = new OleDbCommand("SELECT * FROM lottery_schedule WHERE game_cd = ? AND active = true", conn)) { - command.Parameters.AddWithValue("game_cd", gameMode); + command.Parameters.Add("game_cd", OleDbType.Integer).Value = gameMode; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) { @@ -48,8 +48,8 @@ public void RemoveLotterySchedule(LotterySchedule lsched) 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.Parameters.Add("@id", OleDbType.Integer).Value = lsched.GetID(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)lsched.GetGameMode(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -74,14 +74,14 @@ public int InsertLotterySchedule(LotterySchedule lsched) " (`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.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)lsched.GetGameMode(); + command.Parameters.Add("@isMon", OleDbType.Boolean).Value = lsched.IsMonday(); + command.Parameters.Add("@isTue", OleDbType.Boolean).Value = lsched.IsTuesday(); + command.Parameters.Add("@isWed", OleDbType.Boolean).Value = lsched.IsWednesday(); + command.Parameters.Add("@isThu", OleDbType.Boolean).Value = lsched.IsThursday(); + command.Parameters.Add("@isFri", OleDbType.Boolean).Value = lsched.IsFriday(); + command.Parameters.Add("@isSat", OleDbType.Boolean).Value = lsched.IsSaturday(); + command.Parameters.Add("@isSun", OleDbType.Boolean).Value = lsched.IsSunday(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); diff --git a/Includes/Database/DAO/Impl/LotterySequenceGenDaoImpl.cs b/Includes/Database/DAO/Impl/LotterySequenceGenDaoImpl.cs index a25dc11..7941107 100644 --- a/Includes/Database/DAO/Impl/LotterySequenceGenDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotterySequenceGenDaoImpl.cs @@ -48,7 +48,7 @@ public LotterySequenceGenerator GetSeqGenerator(int seqGenId) using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand("SELECT * FROM lottery_seq_gen WHERE seqGenId = @seqGenId AND active = true", conn)) { - command.Parameters.AddWithValue("@seqGenId", seqGenId); + command.Parameters.Add("@seqGenId", OleDbType.Integer).Value = seqGenId; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) { @@ -66,7 +66,7 @@ public LotterySequenceGenerator GetSeqGeneratorByCode(int seqGenCode) using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand("SELECT * FROM lottery_seq_gen WHERE seqgencd = @seqGenCode AND active = true", conn)) { - command.Parameters.AddWithValue("@seqGenCode", seqGenCode); + command.Parameters.Add("@seqGenCode", OleDbType.Integer).Value = seqGenCode; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) { @@ -86,9 +86,9 @@ public void UpdateDescription(LotterySequenceGenerator updatedModel) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_seq_gen SET description= @description " + " WHERE ID = @id AND seqgencd = @seqgencd AND active = true"; - command.Parameters.AddWithValue("@description", StringUtils.Truncate(updatedModel.GetDescription(), MAX_LEN_DESCRIPTION)); - command.Parameters.AddWithValue("@id", updatedModel.GetID()); - command.Parameters.AddWithValue("@seqgencd", updatedModel.GetSeqGenCode()); + command.Parameters.Add("@description", OleDbType.Variant).Value = StringUtils.Truncate(updatedModel.GetDescription(), MAX_LEN_DESCRIPTION); + command.Parameters.Add("@id", OleDbType.Integer).Value = updatedModel.GetID(); + command.Parameters.Add("@seqgencd", OleDbType.Integer).Value = updatedModel.GetSeqGenCode(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -112,7 +112,7 @@ public bool IsDescriptionExisting(String seqGenDescription) command.CommandText = "SELECT count(ID) AS [total] FROM lottery_seq_gen " + " WHERE description = @description " + " AND active = true "; - command.Parameters.AddWithValue("@description", seqGenDescription); + command.Parameters.Add("@description", OleDbType.Variant).Value = seqGenDescription; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -139,8 +139,8 @@ public int InsertSequenceGenerator(LotterySequenceGenerator seqGen) command.CommandText = " INSERT INTO `lottery_seq_gen` (`seqgencd`, `description`, `active`) VALUES(@seqgencd, @desc, true); "; command.Connection = conn; - command.Parameters.AddWithValue("@seqgencd", seqGen.GetSeqGenCode()); - command.Parameters.AddWithValue("@desc", seqGen.GetDescription()); + command.Parameters.Add("@seqgencd", OleDbType.Integer).Value = seqGen.GetSeqGenCode(); + command.Parameters.Add("@desc", OleDbType.Variant).Value = seqGen.GetDescription(); conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); diff --git a/Includes/Database/DAO/Impl/LotteryTicketPanelDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryTicketPanelDaoImpl.cs index 771b3a3..fd5e9ad 100644 --- a/Includes/Database/DAO/Impl/LotteryTicketPanelDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryTicketPanelDaoImpl.cs @@ -31,7 +31,7 @@ public LotteryTicketPanel GetLotteryTicketPanel(GameMode gameMode) using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand("SELECT * FROM lottery_ticket_panel WHERE game_cd = ? AND active = true;", conn)) { - command.Parameters.AddWithValue("game_cd", gameMode); + command.Parameters.Add("game_cd", OleDbType.Integer).Value = gameMode; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) { diff --git a/Includes/Database/DAO/Impl/LotteryWinningBetDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryWinningBetDaoImpl.cs index 15f230f..c530b7c 100644 --- a/Includes/Database/DAO/Impl/LotteryWinningBetDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryWinningBetDaoImpl.cs @@ -33,7 +33,7 @@ public LotteryWinningBet GetLotteryWinningBet(long lotteryBetID) { command.CommandType = CommandType.Text; command.CommandText = "SELECT * FROM lottery_winning_bet WHERE bet_id = @lotteryBetID AND active = true"; - command.Parameters.AddWithValue("@lotteryBetID", lotteryBetID); + command.Parameters.Add("@lotteryBetID", OleDbType.Integer).Value = lotteryBetID; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -68,18 +68,18 @@ public void InsertWinningBet(LotteryWinningBet lotteryWinningBet) { command.CommandType = CommandType.Text; - command.CommandText = " INSERT INTO lottery_winning_bet " + - " (bet_id, winning_amt, active, claim_status, num1, num2, num3, num4, num5, num6)" + - " VALUES (@lotteryBetID, @winningAmt, true, @claimStatus, @num1, @num2, @num3, @num4, @num5, @num6)"; - command.Parameters.AddWithValue("@lotteryBetID", lotteryWinningBet.GetLotteryBetId()); - command.Parameters.AddWithValue("@winningAmt", lotteryWinningBet.GetWinningAmount()); - command.Parameters.AddWithValue("@claimStatus", lotteryWinningBet.IsClaimed()); - command.Parameters.AddWithValue("@num1", lotteryWinningBet.GetNum1()); - command.Parameters.AddWithValue("@num2", lotteryWinningBet.GetNum2()); - command.Parameters.AddWithValue("@num3", lotteryWinningBet.GetNum3()); - command.Parameters.AddWithValue("@num4", lotteryWinningBet.GetNum4()); - command.Parameters.AddWithValue("@num5", lotteryWinningBet.GetNum5()); - command.Parameters.AddWithValue("@num6", lotteryWinningBet.GetNum6()); + command.CommandText = "INSERT INTO lottery_winning_bet (bet_id, winning_amt, active, claim_status, num1, num2, num3, num4, num5, num6) " + + "VALUES (?,?,?,?,?,?,?,?,?,?)"; + command.Parameters.Add("bet_id", OleDbType.Integer).Value = (int) lotteryWinningBet.GetLotteryBetId(); // cast if schema is Int32 + command.Parameters.Add("winning_amt", OleDbType.Double).Value = lotteryWinningBet.GetWinningAmount(); + command.Parameters.Add("active", OleDbType.Boolean).Value = true; + command.Parameters.Add("claim_status", OleDbType.Boolean).Value= lotteryWinningBet.IsClaimed(); + command.Parameters.Add("num1", OleDbType.Integer).Value = lotteryWinningBet.GetNum1(); + command.Parameters.Add("num2", OleDbType.Integer).Value = lotteryWinningBet.GetNum2(); + command.Parameters.Add("num3", OleDbType.Integer).Value = lotteryWinningBet.GetNum3(); + command.Parameters.Add("num4", OleDbType.Integer).Value = lotteryWinningBet.GetNum4(); + command.Parameters.Add("num5", OleDbType.Integer).Value = lotteryWinningBet.GetNum5(); + command.Parameters.Add("num6", OleDbType.Integer).Value = lotteryWinningBet.GetNum6(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -107,7 +107,7 @@ public double GetTotalWinningsAmount(GameMode gameMode) " WHERE a.active = true " + " AND b.game_cd = @game_cd " + " AND a.claim_status = true"; - command.Parameters.AddWithValue("@game_cd", (int) gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -141,7 +141,7 @@ public double GetTotalWinningsAmountThisMonth(GameMode gameMode) " AND MONTH(target_draw_date) = MONTH(NOW()) " + " AND YEAR(target_draw_date) = YEAR(NOW()) " + " AND a.claim_status = true"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -168,7 +168,7 @@ public void RemoveLotteryWinningBet(long Id) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_winning_bet SET active = 0 " + " WHERE ID = @id"; - command.Parameters.AddWithValue("@id", OleDbType.BigInt).Value = (long)Id; + command.Parameters.Add("@id", OleDbType.Integer).Value = (long)Id; command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -191,7 +191,7 @@ public void RemoveLotteryWinningBetByBetId(long betId) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_winning_bet SET active = 0 " + " WHERE bet_id = @id"; - command.Parameters.AddWithValue("@bet_id", OleDbType.BigInt).Value = (long)betId; + command.Parameters.Add("@bet_id", OleDbType.Integer).Value = betId; command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -239,8 +239,8 @@ public List GetLotteryWinningBet(GameMode gameMode, DateTime " AND b.active = true " + //" AND c.active = true " + " AND b.winning_amt > 0"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); - command.Parameters.AddWithValue("@sinceWhen", sinceWhen.Date.ToString()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode ; + command.Parameters.Add("@sinceWhen", OleDbType.Variant).Value = sinceWhen.Date.ToString(); command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -281,8 +281,8 @@ public void UpdateClaimStatus(LotteryWinningBet winBet) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_winning_bet SET claim_status = @claim_status " + " WHERE ID = @id AND active = true"; - command.Parameters.AddWithValue("@claim_status", winBet.IsClaimed()); - command.Parameters.AddWithValue("@id", winBet.GetID()); + command.Parameters.Add("@claim_status", OleDbType.Boolean).Value = winBet.IsClaimed(); + command.Parameters.Add("@id", OleDbType.Integer).Value = winBet.GetID(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -316,7 +316,7 @@ public int[] GetWinningBetNumbersTally(GameMode gameMode) " WHERE a.game_cd = @game_cd " + " AND a.active = true " + " AND b.active = true "; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -356,7 +356,7 @@ public int[] GetMinMaxWinningBetAmount(GameMode gameMode) " AND a.active = true " + " AND b.active = true " + " AND b.winning_amt > 0"; - command.Parameters.AddWithValue("@game_cd", (int)gameMode); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)gameMode; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) diff --git a/Includes/Database/DAO/Impl/LotteryWinningCombinationDaoImpl.cs b/Includes/Database/DAO/Impl/LotteryWinningCombinationDaoImpl.cs index 4c2ba9e..a26187c 100644 --- a/Includes/Database/DAO/Impl/LotteryWinningCombinationDaoImpl.cs +++ b/Includes/Database/DAO/Impl/LotteryWinningCombinationDaoImpl.cs @@ -30,7 +30,7 @@ public LotteryWinningCombination GetLotteryWinningCombination(GameMode gameMode) using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource()) using (OleDbCommand command = new OleDbCommand("SELECT * FROM lottery_winning_combination WHERE game_cd = ? AND active = true;", conn)) { - command.Parameters.AddWithValue("game_cd", gameMode); + command.Parameters.Add("game_cd", OleDbType.Integer).Value = gameMode; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) { @@ -50,8 +50,8 @@ public void RemoveWinningCombination(LotteryWinningCombination lwc) command.CommandType = CommandType.Text; command.CommandText = " UPDATE lottery_winning_combination SET active = false " + " WHERE ID = @id AND game_cd = @game_cd AND active = true"; - command.Parameters.AddWithValue("@id", lwc.GetID()); - command.Parameters.AddWithValue("@game_cd", lwc.GetGameMode()); + command.Parameters.Add("@id", OleDbType.Integer).Value = lwc.GetID(); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = lwc.GetGameMode(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -76,14 +76,14 @@ public int InsertWinningCombination(LotteryWinningCombination lwc) command.CommandText = " INSERT INTO `lottery_winning_combination` " + " (`game_cd`, `active`, `match_0`, `match_1`, `match_2`, `match_3`, `match_4`, `match_5`, `match_6`) " + " VALUES (@game_cd, true, @m0, @m1, @m2, @m3, @m4, @m5, @m6) "; - command.Parameters.AddWithValue("@game_cd", (int)lwc.GetGameMode()); - command.Parameters.AddWithValue("@m0", lwc.GetMatch0()); - command.Parameters.AddWithValue("@m1", lwc.GetMatch1()); - command.Parameters.AddWithValue("@m2", lwc.GetMatch2()); - command.Parameters.AddWithValue("@m3", lwc.GetMatch3()); - command.Parameters.AddWithValue("@m4", lwc.GetMatch4()); - command.Parameters.AddWithValue("@m5", lwc.GetMatch5()); - command.Parameters.AddWithValue("@m6", lwc.GetMatch6()); + command.Parameters.Add("@game_cd", OleDbType.Integer).Value = (int)lwc.GetGameMode(); + command.Parameters.Add("@m0", OleDbType.Double).Value = lwc.GetMatch0(); + command.Parameters.Add("@m1", OleDbType.Double).Value = lwc.GetMatch1(); + command.Parameters.Add("@m2", OleDbType.Double).Value = lwc.GetMatch2(); + command.Parameters.Add("@m3", OleDbType.Double).Value = lwc.GetMatch3(); + command.Parameters.Add("@m4", OleDbType.Double).Value = lwc.GetMatch4(); + command.Parameters.Add("@m5", OleDbType.Double).Value = lwc.GetMatch5(); + command.Parameters.Add("@m6", OleDbType.Double).Value = lwc.GetMatch6(); command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); diff --git a/Includes/Database/DAO/Impl/UserSettingDaoImpl.cs b/Includes/Database/DAO/Impl/UserSettingDaoImpl.cs index 8552997..b06ad39 100644 --- a/Includes/Database/DAO/Impl/UserSettingDaoImpl.cs +++ b/Includes/Database/DAO/Impl/UserSettingDaoImpl.cs @@ -30,7 +30,7 @@ public int GetLastOpenedLottery() { command.CommandType = CommandType.Text; command.CommandText = "SELECT ID, config_name, value FROM user_setting WHERE config_name = @last_opened_lottery"; - command.Parameters.AddWithValue("@last_opened_lottery", UserSettingsConfig.CFG_LAST_OPENED_DIRECTORY); + command.Parameters.Add("@last_opened_lottery", OleDbType.Variant).Value = UserSettingsConfig.CFG_LAST_OPENED_DIRECTORY; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -53,8 +53,8 @@ public void UpdateSetting(String configName, String value) { command.CommandType = CommandType.Text; command.CommandText = "UPDATE user_setting SET [value] = @value WHERE config_name = @configName"; - command.Parameters.AddWithValue("@value", value); - command.Parameters.AddWithValue("@configName", configName); + command.Parameters.Add("@value", OleDbType.Variant).Value = value; + command.Parameters.Add("@configName", OleDbType.Variant).Value = configName; command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); @@ -75,7 +75,7 @@ public String GetSetting(String configName) { command.CommandType = CommandType.Text; command.CommandText = "SELECT ID, config_name, value FROM user_setting WHERE config_name = @configName"; - command.Parameters.AddWithValue("@configName", configName); + command.Parameters.Add("@configName", OleDbType.Variant).Value = configName; command.Connection = conn; conn.Open(); using (OleDbDataReader reader = command.ExecuteReader()) @@ -99,8 +99,8 @@ public int InsertSetting(String configName, String value) { command.CommandType = CommandType.Text; command.CommandText = " INSERT INTO user_setting (config_name, `value`) VALUES (@configName, @value) "; - command.Parameters.AddWithValue("@configName", configName); - command.Parameters.AddWithValue("@value", value); + command.Parameters.Add("@configName", OleDbType.Variant).Value = configName; + command.Parameters.Add("@value", OleDbType.Variant).Value = value; command.Connection = conn; conn.Open(); OleDbTransaction transaction = conn.BeginTransaction(); diff --git a/Includes/Utilities/ResourcesUtils.cs b/Includes/Utilities/ResourcesUtils.cs index ad97754..7899889 100644 --- a/Includes/Utilities/ResourcesUtils.cs +++ b/Includes/Utilities/ResourcesUtils.cs @@ -21,7 +21,7 @@ public class ResourcesUtils : IDisposable private static readonly String RESOURCE_ID_ML_MODEL_FILE_TYPE_EXTENSION_DESC = "ML_MODEL_FILE_TYPE_EXTENSION_DESC"; private static readonly String RESOURCE_ID_APP_DATA_FOLDER = "APP_DATA_FOLDER"; private static readonly String RESOURCE_ID_APP_DATA_FOLDER_CONFIG_FILE_NAME = "APP_DATA_FOLDER_CONFIG_FILE_NAME"; - private static readonly String RESOURCE_ID_APP_DATA_FOLDER_CONFIG_FILE_NAME_DEBUG = "APP_DATA_FOLDER_CONFIG_FILE_NAME_DEBUG"; + //private static readonly String RESOURCE_ID_APP_DATA_FOLDER_CONFIG_FILE_NAME_DEBUG = "APP_DATA_FOLDER_CONFIG_FILE_NAME_DEBUG"; private static readonly String RESOURCE_ID_PROCESS_LOGS_MAX_LINE_CONTENT = "PROCESS_LOGS_MAX_LINE_CONTENT"; private static readonly String RESOURCE_ID_LOTTERY_OUTLET_DEFAULT_CODE = "LOTTERY_OUTLET_DEFAULT_CODE"; private static readonly String RESOURCE_ID_DASHBOARD_REPORT_GROUPED_CONTENT_INDENTION = "DASHBOARD_REPORT_GROUPED_CONTENT_INDENTION"; diff --git a/LottoDataManager.csproj b/LottoDataManager.csproj index b1e5d0d..4e121ea 100644 --- a/LottoDataManager.csproj +++ b/LottoDataManager.csproj @@ -14,6 +14,21 @@ true + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + true x64 @@ -50,12 +65,6 @@ True True - - packages\System.Text.Encodings.Web.4.7.0\lib\netstandard2.0\System.Text.Encodings.Web.dll - - - packages\System.Text.Json.2.0.0.11\lib\net40\System.Text.Json.dll - packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll @@ -582,16 +591,16 @@ - 1.1.0 + 1.4.0 - 8.0.101 + 10.0.100 - 1.11.57 + 1.12.4 - 3.0.1 + 5.0.0 2.9.1 @@ -600,11 +609,23 @@ 4.3.0 - 8.0.0 + 10.0.0 - 2.1.5 + 2.1.6 + + + False + Microsoft .NET Framework 4.7.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs index 08b13bc..3d238a4 100644 --- a/Properties/Settings.Designer.cs +++ b/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace LottoDataManager.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -109,7 +109,7 @@ public string version_patch { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("9")] + [global::System.Configuration.DefaultSettingValueAttribute("11")] public string version_release { get { return ((string)(this["version_release"])); diff --git a/Properties/Settings.settings b/Properties/Settings.settings index e794376..e82376d 100644 --- a/Properties/Settings.settings +++ b/Properties/Settings.settings @@ -24,7 +24,7 @@ 0 - 9 + 11 LottoDataManager