예제 #1
0
        void LoadElectronics(BingoSessionEvent session, BingoPacks pack_list)
        {
            MySQLDataTable table = new MySQLDataTable(StaticDsnConnection.dsn
                                                      , "select access_db_sale.transnum,pack_type,start_card,pack_type_name,unit_num,access_db_sale.bingoday from access_db_sale"
                                                      + " join access_db_packs on access_db_sale.electronic_id=access_db_packs.electronic_id"
                                                      + " where void=0 and access_db_sale.bingoday=cast( " + DsnSQLUtil.MakeDate(StaticDsnConnection.dsn, session.bingoday) + " as date) and access_db_packs.session=" + session.session_number
                                                      + " order by mod(start_card,50),start_card/50"
                                                      );

            foreach (DataRow row in table.Rows)
            {
                int start_card = Convert.ToInt32(row["start_card"]);
                if (start_card == 0)
                {
                    // these are special case macro label place holders... no real cards.
                    continue;
                }
                int transnum = Convert.ToInt32(row["transnum"]);

                PlayerTransaction transaction = null;
                BingoPlayer       player      = GetPlayer(Convert.ToDateTime(row["bingoday"]), transnum, ref transaction);
                if (player != null)
                {
                    int packnum = Convert.ToInt32(row["pack_type"]);

                    if (packnum < 100)
                    {
                        PlayerPack pack = new PlayerPack();
                        pack.electronic  = true;
                        pack.start_card  = start_card;
                        pack.transaction = transaction;
                        try
                        {
                            pack.pack_info = pack_list.GetPack(row["pack_type_name"].ToString());
                            pack.dealer    = pack.pack_info.GetRangeDealer(start_card);
                        }
                        catch (Exception e) {
                            //System.Windows.Forms.MessageBox.Show( e.Message );
                            throw new Exception("Fail loading packs.");
                            continue;
                        }
                        if (pack.pack_info == null)
                        {
                            continue;                              // fail loading this.
                        }
                        pack.paper = false;
                        //pack.game_list = _games;

                        pack.player      = player;
                        pack.unit_number = Convert.ToInt32(row["unit_num"]);
#if each_pack_has_counts
                        foreach (BingoGame game in _games)
                        {
                            int x;
                            // pack doesn't play in this game.
                            if (pack.pack_info.ID >= game.pack_card_counts.Count)
                            {
                                pack.game_card_count[game.game_ID] = 0;
                                continue;
                            }
                            x = pack.game_card_count[game.game_ID] = game.pack_card_counts[pack.pack_info.ID - 1];
                            if (x > pack.most_game_card_count)
                            {
                                if (pack.least_game_card_count == 0)
                                {
                                    pack.least_game_card_count = x;
                                }
                                pack.most_game_card_count = x;
                            }
                            if (x > 0 && x < pack.least_game_card_count)
                            {
                                pack.least_game_card_count = x;
                            }
                        }
#endif
                        if (bDoLogCards)
                        {
                            Log.log("electronic pack starting card " + pack.start_card);
                        }
                        //pack.pack_info.ID = player.played_packs.Count;
                        transaction.Add(pack);
                        player.played_packs.Add(pack);
                    }
                    else
                    {
                        // ignore macros
                    }
                }
            }
            table.Dispose();
        }
예제 #2
0
        void LoadElectronics(BingoSessionEvent session, BingoPacks pack_list, List <String> rated_packs)
        {
            MySQLDataTable table = new MySQLDataTable(StaticDsnConnection.dsn
                                                      , "select access_db_sale.transnum,pack_type,start_card,pack_type_name,unit_num,pos_num from access_db_sale"
                                                      + " join access_db_packs on access_db_sale.electronic_id=access_db_packs.electronic_id"
                                                      + " where void=0 and access_db_sale.bingoday=cast( " + DsnSQLUtil.MakeDate(StaticDsnConnection.dsn, session.bingoday) + " as date) and access_db_packs.session=" + session
                                                      + " and matched=0"
                                                      + " order transnum" /*by mod(start_card,50),start_card/50"*/
                                                      );

            foreach (DataRow row in table.Rows)
            {
                if (rated_packs != null)
                {
                    bool   found    = false;
                    string packname = row["pack_type_name"].ToString();
                    foreach (String rated_packname in rated_packs)
                    {
                        if (String.Compare(packname, rated_packname, true) == 0)
                        {
                            found = true;
                            break;
                        }
                    }
                    // ignore loading this pack.  it's not allowed.
                    if (!found)
                    {
                        continue;
                    }
                }
                int transnum = Convert.ToInt32(row["transnum"]);
                PlayerTransaction transaction = null;
                BingoPlayer       player      = GetPlayer(Convert.ToDateTime(row["bingoday"]), transnum, ref transaction);
                int packnum = Convert.ToInt32(row["pack_type"]);

                if (packnum < 100)
                {
                    PlayerPack pack = new PlayerPack();
                    pack.electronic = true;
                    pack.start_card = Convert.ToInt32(row["start_card"]);
                    pack.pack_info  = pack_list.GetPack(row["pack_type_name"].ToString(), "Pos " + row["pos_num"].ToString());
                    if (pack.pack_info == null)
                    {
                        continue;                          // fail loading this.
                    }
                    pack.paper = false;
                    //pack.game_list = _games;

                    pack.player      = player;
                    pack.unit_number = Convert.ToInt32(row["unit_num"]);
#if each_pack_has_counts
                    foreach (BingoGame game in _games)
                    {
                        int x;
                        // pack doesn't play in this game.
                        if (pack.pack_info.ID >= game.pack_card_counts.Count)
                        {
                            pack.game_card_count[game.game_ID] = 0;
                            continue;
                        }
                        x = pack.game_card_count[game.game_ID] = game.pack_card_counts[pack.pack_info.ID - 1];
                        if (x > pack.most_game_card_count)
                        {
                            if (pack.least_game_card_count == 0)
                            {
                                pack.least_game_card_count = x;
                            }
                            pack.most_game_card_count = x;
                        }
                        if (x > 0 && x < pack.least_game_card_count)
                        {
                            pack.least_game_card_count = x;
                        }
                    }
#endif
                    //pack.pack_info.ID = player.played_packs.Count;
                    player.played_packs.Add(pack);
                }
            }
        }
예제 #3
0
        void LoadPaper(BingoSessionEvent session, BingoPacks pack_list, List <String> rated_packs)
        {
            MySQLDataTable paper_table = new MySQLDataTable(StaticDsnConnection.dsn
                                                            , "select * from pos_paper_barcode_master"
                                                            + " join pos_paper_barcode_item on pos_paper_barcode_master.pos_paper_barcode_master_id=pos_paper_barcode_item.pos_paper_barcode_master_id"
                                                            + " join item_descriptions on item_descriptions.item_description_id=pos_paper_barcode_item.item_description_id"
                                                            + " join floor_paper_names on floor_paper_names.floor_paper_name_id=pos_paper_barcode_item.floor_paper_name_id"
                                                            + " where pos_paper_barcode_master.bingoday=cast( " + DsnSQLUtil.MakeDate(StaticDsnConnection.dsn, session.bingoday) + " as date) and pos_paper_barcode_master.session=" + session.session.session
                                                            + " order by transnum" //start_card"
                                                            );

            foreach (DataRow row in paper_table.Rows)
            {
                string packname = row["name"].ToString();
                if (rated_packs != null)
                {
                    bool found = false;
                    foreach (String rated_packname in rated_packs)
                    {
                        if (String.Compare(packname, rated_packname, true) == 0)
                        {
                            found = true;
                            break;
                        }
                    }
                    // ignore loading this pack.  it's not allowed.
                    if (!found)
                    {
                        continue;
                    }
                }
                int transnum = Convert.ToInt32(row["transnum"]);
                if (transnum == 0)
                {
                    // these are special case packs (paper usage tracking only)
                    continue;
                }
                PlayerTransaction transaction = null;
                BingoPlayer       player      = GetPlayer(Convert.ToDateTime(row["bingoday"]), transnum, ref transaction);
                if (player != null)
                {
                    PlayerPack pack = new PlayerPack();
                    pack.electronic  = false;
                    pack.transaction = transaction;
                    pack.start_card  = Convert.ToInt32(row["start_card"]);
                    pack.pack_info   = pack_list.GetPack(packname);
                    if (pack.pack_info != null)
                    {
                        //pack.pack_info.game_list = _games;
                        pack.player       = player;
                        pack.unit_number  = Convert.ToInt32(row["packnum"]);
                        pack.dealer       = pack_list.GetDealer(pack.pack_info, pack.start_card);
                        pack.paper        = true;
                        pack.pack_info.ID = player.played_packs.Count;
                        {
                            // fix the starting card....
                            // need to figure this out ( sam's town )
                            if (bDoLogCards)
                            {
                                Log.log("paper pack starting card " + pack.start_card);
                            }

                            pack.unit_number = Convert.ToInt32(row["packnum"]);
                            player.played_packs.Add(pack);
                        }
                        transaction.Add(pack);
                    }
                }
            }
            paper_table.Dispose();
        }
예제 #4
0
        /// <summary>
        /// this Loads the prize-validation balls for the given session/game_number
        /// </summary>
        /// <param name="dsn"></param>
        /// <param name="session"></param>
        /// <param name="game_number"></param>
        public BingoGameEvent(DsnConnection dsn, BingoSessionEvent session, int game_index)
        {
            List <byte> ball_list = new List <byte>();
            int         game_id   = 0;
            int         game_num  = session.session.GameList[game_index].game_number;

            bool did_next;
            int  start = 0;

#if !use_prize_validations_for_balls
            do
            {
                MySQLDataTable win_table = new MySQLDataTable(dsn
                                                              , "select bingo_game_id,ball from bingo_game_balls"
                                                              + " join bingo_game using(bingo_game_id)"
                                                              + " where bingoday=" + DsnSQLUtil.MakeDateOnly(dsn, session.bingoday)
                                                              + " and session=" + session.session_number
                                                              + " and game=" + game_num
                                                              + " and uncalled=0"
                                                              + " order by game desc,bingo_game_id desc,called_at desc,bingo_game_ball_id desc"
                                                              );

                if (win_table != null && win_table.Rows.Count > 0)
                {
                    int max_row;
                    for (max_row = 0; max_row < win_table.Rows.Count; max_row++)
                    {
                        int this_row_game_id = Convert.ToInt32(win_table.Rows[max_row]["bingo_game_id"]);
                        if (game_id == 0)
                        {
                            game_id = this_row_game_id;
                        }
                        if (this_row_game_id == game_id)
                        {
                            ball_list.Add(Convert.ToByte(win_table.Rows[max_row]["ball"]));
                        }
                        else
                        {
                            break;
                        }
                    }

                    if (game_num == 2)
                    {
                        start = 1;
                    }
                }
                game_id  = 0;
                did_next = false;
                if (session.session.GameList[game_index].into)
                {
                    BingoGame game      = session.session.GameList[game_index];
                    BingoGame next_game = game.prior_group_game;
                    if (next_game == null)
                    {
                        next_game = game.prior_game;
                        if (next_game.game_number == game.game_number)
                        {
                            next_game = game.prior_group_game;
                        }
                    }
                    if (next_game != null)
                    {
                        game_index = session.session.GameList.IndexOf(next_game);
                        game_num   = session.session.GameList[game_index].game_number;
                        did_next   = true;
                    }
                }
            }while(did_next);

            playing_balls = new int[ball_list.Count];
            for (int row = start; row < ball_list.Count; row++)
            {
                playing_balls[row - start] = ball_list[(ball_list.Count - row) - 1];
            }
#else
            // this data should be represented as a ball data...
            MySQLDataTable win_table = new MySQLDataTable(dsn
                                                          , "select ball_list,balls from prize_validations where bingoday="
                                                          + DsnSQLUtil.MakeDateOnly(dsn, session.bingoday)
                                                          + " and session_id=" + session.session_number
                                                          + " and game_id=" + session.session.GameList[game_index].game_number
                                                          + " group by ball_list,balls"
                                                          + " order by ID desc"
                                                          );

            if (win_table != null && win_table.Rows.Count > 0)
            {
                int nRow;
                for (nRow = 0; nRow < win_table.Rows.Count; nRow++)
                {
                    if (Convert.ToInt32(win_table.Rows[nRow]["balls"]) >= 75)
                    {
                        continue;
                    }
                    DataRow  win            = win_table.Rows[nRow];
                    String   string_numbers = win["ball_list"].ToString();
                    int      count          = Convert.ToInt32(win["balls"]);
                    String[] numbers        = string_numbers.Split();

                    playing_balls = new int[numbers.Length];
                    for (int n = 0; n < count; n++)
                    {
                        if (numbers[n].Length > 0)
                        {
                            playing_balls[n] = Convert.ToByte(numbers[n]);
                        }
                    }
                    break;
                }
            }
#endif
        }
예제 #5
0
        /// <summary>
        /// this Loads the prize-validation balls for the given session/game_number
        /// </summary>
        /// <param name="dsn"></param>
        /// <param name="session"></param>
        /// <param name="game_number"></param>
        public BingoGameEvent(DsnConnection dsn, BingoSessionEvent session, DataRow game_event_data_table_row)
        {
            // this is probably not a good thing to keep...
            this.game_event_row = game_event_data_table_row;

            List <int> ball_list = new List <int>();

            // this data should be represented as a ball data...
            MySQLDataTable win_table = new MySQLDataTable(dsn
                                                          , "select ball_list,balls from prize_validations where bingoday="
                                                          + DsnSQLUtil.MakeDateOnly(dsn, session.bingoday)
                                                          + " and session_id=" + session.session_number
                                                          + " and game_id=" + game_event_data_table_row["game_id"]
                                                          + " group by ball_list,balls"
                                                          + " order by ID desc"
                                                          );

            if (win_table != null && win_table.Rows.Count > 0)
            {
                int nRow;
                for (nRow = 0; nRow < win_table.Rows.Count; nRow++)
                {
                    if (Convert.ToInt32(win_table.Rows[nRow]["balls"]) >= 75)
                    {
                        continue;
                    }
                    DataRow  win            = win_table.Rows[nRow];
                    String   string_numbers = win["ball_list"].ToString();
                    int      count          = Convert.ToInt32(win["balls"]);
                    String[] numbers        = string_numbers.Split();

                    playing_balls = new int[numbers.Length];
                    for (int n = 0; n < count; n++)
                    {
                        if (numbers[n].Length > 0)
                        {
                            playing_balls[n] = Convert.ToByte(numbers[n]);
                        }
                    }
                    break;
                }
            }

            if (playing_balls == null && (Convert.ToInt32(game_event_data_table_row["game_id"]) < 12))
            {
                my_gameevent = new GameEventDataSet(dsn);
                my_gameevent.FillBallSet(Convert.ToDateTime(game_event_data_table_row["bingoday"])
                                         , Convert.ToInt32(game_event_data_table_row["session_id"])
                                         , (game_event_data_table_row["ballset"] != DBNull.Value) ?
                                         Convert.ToInt32(game_event_data_table_row["ballset"]) : 0);

                foreach (DataRow game_row in my_gameevent.games.Rows)
                {
                    if (Convert.ToInt32(game_row["game"]) <= Convert.ToInt32(game_event_data_table_row["game"]))
                    {
                        DataRow[] rows = game_row.GetChildRows("game_has_ball");
                        foreach (DataRow row in rows)
                        {
                            ball_list.Add(Convert.ToByte(row["ball"]));
                        }
                    }
                }
                playing_balls = ball_list.ToArray();
            }
            //ball_list.Dispose();
        }
예제 #6
0
파일: BingoHall.cs 프로젝트: d3x0r/xperdex
 void event_interface_SessionChanged(object sender, BingoEvents.BingoSimpleIntEventArgs e)
 {
     session_number = e.arg;
     session        = next_session;
     session_event  = next_session_event;
 }
예제 #7
0
 public SelectPacks(BingoSessionEvent session_event)
 {
     selectable_packs   = new List <BingoPack>();
     this.session_event = session_event;
     InitializeComponent();
 }