public void InsertDrawDate(LotteryDrawResult lotteryDrawResult)
        {
            using (OleDbConnection conn = DatabaseConnectionFactory.GetDataSource())
                using (OleDbCommand command = new OleDbCommand())
                {
                    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.Connection = conn;
                    conn.Open();
                    OleDbTransaction transaction = conn.BeginTransaction();
                    command.Transaction = transaction;
                    int result = command.ExecuteNonQuery();

                    if (result < 0)
                    {
                        transaction.Rollback();
                        throw new Exception(ResourcesUtils.GetMessage("lot_dao_impl_msg9"));
                    }
                    transaction.Commit();
                }
        }
Exemplo n.º 2
0
        private void objListVwWinningNum_FormatRow(object sender, FormatRowEventArgs e)
        {
            if (e.Model == null)
            {
                return;
            }
            LotteryDrawResult result = (LotteryDrawResult)e.Model;

            if (result.GetWinnersCount() > 0)
            {
                e.Item.BackColor = Color.GreenYellow;
                e.Item.ForeColor = Color.Black;
            }
        }
        private void InitializesObjectListViewDataBinding()
        {
            this.olvColBetMatch.ImageGetter = delegate(object rowObject) {
                if (rowObject == null)
                {
                    return(0);
                }
                LotteryBet p = (LotteryBet)rowObject;
                if (p.GetMatchNumCount() <= 0)
                {
                    return(0);
                }
                return(ImageUtils.GetStarWonImage(p.GetMatchNumCount()));
            };
            this.olvColBetMatch.AspectGetter = delegate(object rowObject) {
                if (rowObject == null)
                {
                    return(0);
                }
                LotteryBet p = (LotteryBet)rowObject;
                return(p.GetMatchNumCount());
            };
            this.olvColBetMatch.AspectToStringConverter = delegate(object rowObject) {
                return(String.Empty);
            };

            this.olvColBetOutlet.AspectGetter = delegate(object rowObject)
            {
                LotteryBet    lotteryBet = (LotteryBet)rowObject;
                LotteryOutlet outlet     = lotteryBet.GetLotteryOutlet();
                return(outlet);
            };

            this.olvColBetOutlet.AspectToStringConverter = delegate(object rowObject)
            {
                if (rowObject == null)
                {
                    return(String.Empty);
                }
                LotteryOutlet outlet = (LotteryOutlet)rowObject;
                return(outlet.GetDescription());
            };

            this.olvColBetSeqGen.AspectGetter = delegate(object rowObject)
            {
                LotteryBet lotteryBet           = (LotteryBet)rowObject;
                LotterySequenceGenerator outlet = lotteryBet.GetLotterySequenceGenerator();
                return(outlet);
            };

            this.olvColBetSeqGen.AspectToStringConverter = delegate(object rowObject)
            {
                if (rowObject == null)
                {
                    return(String.Empty);
                }
                LotterySequenceGenerator seqgen = (LotterySequenceGenerator)rowObject;
                return(seqgen.GetDescription());
            };

            this.olvColDrawWinner.ImageGetter = delegate(object rowObject) {
                if (rowObject == null)
                {
                    return(0);
                }
                LotteryDrawResult p = (LotteryDrawResult)rowObject;
                if (p.GetWinnersCount() <= 0)
                {
                    return(0);
                }
                return(ImageUtils.GetStarJackpotImage(5));
            };
            this.olvColDrawWinner.AspectGetter = delegate(object rowObject) {
                if (rowObject == null)
                {
                    return(0);
                }
                LotteryDrawResult p = (LotteryDrawResult)rowObject;
                return(p.GetWinnersCount());
            };
            this.olvColDrawWinner.AspectToStringConverter = delegate(object rowObject) {
                return(String.Empty);
            };

            this.olvColDrawMatch.ImageGetter = delegate(object rowObject) {
                if (rowObject == null)
                {
                    return(0);
                }
                int matchCnt = CountMatchingBetToDrawnResult(rowObject);
                if (matchCnt <= 0)
                {
                    return(0);
                }
                return(ImageUtils.GetStarWonImage(matchCnt));
            };
            this.olvColDrawMatch.AspectGetter = delegate(object rowObject) {
                if (rowObject == null)
                {
                    return(0);
                }
                return(CountMatchingBetToDrawnResult(rowObject));
            };
            this.olvColDrawMatch.AspectToStringConverter = delegate(object rowObject) {
                return(String.Empty);
            };
        }
Exemplo n.º 4
0
        private void InitializesFormContent()
        {
            try
            {
                Application.ApplicationExit += new EventHandler(this.OnApplicationExit);
                this.lotteryDataWorker.LotteryDataWorkerProcessingStatus += LotteryDataWorker_LotteryDataWorkerProcessingStatus;

                this.olvColBetResult.ImageGetter = delegate(object rowObject) {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    LotteryBet p = (LotteryBet)rowObject;
                    if (p.GetMatchNumCount() <= 0)
                    {
                        return(0);
                    }
                    return(ImageUtils.GetStarWonImage(p.GetMatchNumCount()));
                };
                this.olvColBetResult.AspectGetter = delegate(object rowObject) {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    LotteryBet p = (LotteryBet)rowObject;
                    return(p.GetMatchNumCount());
                };
                this.olvColBetResult.AspectToStringConverter = delegate(object rowObject) {
                    return(String.Empty);
                };
                this.olvColWinners.AspectGetter = delegate(object rowObject)
                {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    LotteryDrawResult p = (LotteryDrawResult)rowObject;
                    if (p.GetWinnersCount() <= 0)
                    {
                        return("0");
                    }
                    return(p.GetWinnersCount());
                };
                this.olvColWinStamp.ImageGetter = delegate(object rowObject) {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    LotteryDrawResult p = (LotteryDrawResult)rowObject;
                    if (p.GetWinnersCount() <= 0)
                    {
                        return(0);
                    }
                    return(ImageUtils.GetStarJackpotImage(5));
                };
                this.olvColWinStamp.AspectGetter = delegate(object rowObject) {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    LotteryDrawResult p = (LotteryDrawResult)rowObject;
                    return(p.GetWinnersCount());
                };
                this.olvColWinStamp.AspectToStringConverter = delegate(object rowObject) {
                    return(String.Empty);
                };

                //DASHBOARD TAB GROUP
                this.olvdbDesc.AspectGetter = delegate(object rowObject) {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    DashboardReportItem g = (DashboardReportItem)rowObject;
                    return(g.GetDescription());
                };
                this.olvdbValue.AspectGetter = delegate(object rowObject) {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    DashboardReportItem g = (DashboardReportItem)rowObject;
                    return(g.GetValue());
                };
                this.olvdbDesc.GroupKeyGetter = delegate(object rowObject) {
                    if (rowObject == null)
                    {
                        return(0);
                    }
                    DashboardReportItem g = (DashboardReportItem)rowObject;
                    return(g.GetGroupKeyName());
                };
                this.olvdbDesc.GroupFormatter = (/*OLVGroup*/ group, /*GroupingParameters*/ parms) =>
                {
                    if (group.Items.Count > 0)
                    {
                        DashboardReportItem item = (DashboardReportItem)group.Items[0].RowObject;
                        group.Task = item.GetGroupTaskLabel();
                    }
                };


                this.Enabled = false;
                ClearAllForms();
                Application.DoEvents();
                RefreshFieldDetails();
                SetBetsAndResultDefaultList();
                RefreshWinningNumbersGridContent();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show(ResourcesUtils.GetMessage("mainf_error1"));
            }
            finally
            {
                this.Enabled = true;
            }
            Application.DoEvents();
        }