Exemplo n.º 1
0
        /// <summary>
        /// Search for a pack already created by said name, if it doesn't exist, create a BingoPack as defined by PackTable Row.
        /// </summary>
        /// <param name="dataRow">a DataRow from PackTable</param>
        /// <returns></returns>
        public BingoPack MakePack(BingoGameGroup game_group, DataRow dataRow)
        {
            foreach (BingoPack pack in pack_skel)
            {
                if (String.Compare(pack.name, dataRow[PackTable.NameColumn].ToString(), true) == 0 &&
                    pack.game_groups.Contains(game_group))
                {
                    return(pack);
                }
            }

            foreach (BingoPack pack in pack_skel)
            {
                // found the pack, but it's not in this game group, so it's not really a pack.
                if (String.Compare(pack.name, dataRow[PackTable.NameColumn].ToString(), true) == 0)
                {
                    return(pack);
                }
            }

            BingoPack newpack = new BingoPack(game_group, dataRow);

            if (dataRow != null)
            {
                DataRow[] ranges = dataRow.GetChildRows("pack_has_cardset_range");
                if (ranges.Length == 0)
                {
                    MessageBox.Show("Pack " + dataRow[PackTable.NameColumn] + " does not have any cardset ranges...");
                    OpenSkieScheduler3.Controls.Forms.PackEditor pe = new OpenSkieScheduler3.Controls.Forms.PackEditor(dataRow);
                    pe.ShowDialog();
                    pe.Dispose();
                    ranges = dataRow.GetChildRows("pack_has_cardset_range");
                }
                if (ranges != null && ranges.Length > 0)
                {
                    foreach (DataRow cardset_range in ranges)
                    {
                        DataRow range = cardset_range.GetParentRow("cardset_range_in_pack");
                        newpack.dealers.Add(BingoDealers.GetDealer(range));
                    }
                }

                this.pack_skel.Add(newpack);
                newpack.pack_type = this.pack_skel.IndexOf(newpack);

                game_group.packs.Add(newpack);
            }
            return(newpack);
        }
Exemplo n.º 2
0
 public BingoPack GetPackDelete(int start_card, int packtype)
 {
     foreach (BingoPack pack in pack_skel)
     {
         if (pack.pack_type == packtype)
         {
             //BingoData.pi.S
             BingoPack newpack = new BingoPack(pack);
             newpack.dealers.Add(BingoDealers.GetDealer(start_card, packtype));
             //newpack.start_card = start_card;
             this.Add(newpack);
             return(newpack);
         }
     }
     Log.log("Pack was not scheduled for today... could not find info to attach dealer.");
     //newpack.name =
     return(null);
 }
Exemplo n.º 3
0
        internal BingoPack GetRangePack(int start_card)
        {
            foreach (BingoPack pack in dealer_packs)
            {
                foreach (BingoDealer dealer in pack.dealers)
                {
                    if (dealer.real_min_range <= start_card &&
                        dealer.real_max_range >= start_card)
                    {
                        return(pack);
                    }
                }
            }
            BingoPack dealt = new BingoPack(this);

            dealt.dealers.Add(BingoDealers.GetDealer(start_card, this.pack_type));
            dealer_packs.Add(dealt);
            return(dealt);
        }
Exemplo n.º 4
0
        internal BingoPack GetRangePack(String range_name)
        {
            if (range_name == null)
            {
                return(null);
            }

            foreach (BingoPack pack in dealer_packs)
            {
                foreach (BingoDealer dealer in pack.dealers)
                {
                    if (dealer.RangeName == range_name)
                    {
                        return(pack);
                    }
                }
            }

            BingoPack dealt = new BingoPack(this);

            dealt.dealers.Add(BingoDealers.GetDealer(range_name));
            dealer_packs.Add(dealt);
            return(dealt);
        }
Exemplo n.º 5
0
        bool BuildRunInfo(bool one_session)
        {
            if (ori == null)
            {
                ori = new OddsRunInfo( );
            }

#if this_loaded_player_tracking_for_phsycial_players
            BingoPlayers players = new BingoPlayers();
            DbDataReader reader  = StaticDsnConnection.KindExecuteReader("select card,sum(value) from player_track where bingoday="
                                                                         + MySQLDataTable.MakeDateOnly(result.bingoday.AddYears(2006).AddDays(7).AddMonths(5))
                                                                         + " and session=" + (_sessions + 1)
                                                                         + " and card<>'000000000000000000'"
                                                                         + " group by card");
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    BingoPlayer player;
                    players.Add(player = new BingoPlayer(reader.GetString(0)));
                    int spend = reader.GetInt32(1);
                    for (int p = 0; p < (spend / 2000); p++)
                    {
                        BingoPack  pack = GameList.pack_list.GetPack(true, Cards, "Fictional Pack");
                        PlayerPack played;
                        pack.pack_set = p;
                        player.played_packs.Add(played = new PlayerPack());
                        played.pack_info = pack;
                        played.player    = player;
                        played.game_list = GameList;
                    }
                }
            }
#endif
            if (ori.trigger_stats.enabled = checkBoxTriggerBalls.Checked)
            {
                ori.trigger_stats.max_triggered = Convert.ToInt32(textBoxMaxTriggered.Text);
                ori.trigger_stats.triggered     = new int[ori.trigger_stats.max_triggered + 1];
                ori.trigger_stats.trigger_wins  = new int[ori.trigger_stats.max_triggered + 1];
            }
            if (one_session)
            {
                ori.Years    = 1;
                ori.Days     = 1;
                ori.Sessions = 1;
                ori.Halls    = 1;
                ori.Players  = Convert.ToInt32(textBoxPlayers.Text);
                ori.Cards    = Convert.ToInt32(textBoxCards.Text);
                // this will be overridden later, if external game grid is used.
                ori.Games = Convert.ToInt32(textBoxGames.Text);
            }
            else
            {
                ori.Years = Convert.ToInt32(textBoxYears.Text);
                ori.Days  = Convert.ToInt32(textBoxDays.Text);

                //move all days into the day counter
                // the DateTime thing will take just adding days.
                ori.Days  = ori.Years * ori.Days;
                ori.Years = 1;

                ori.Sessions = Convert.ToInt32(textBoxSessions.Text);
                ori.Halls    = Convert.ToInt32(textBoxHalls.Text);
                ori.Players  = Convert.ToInt32(textBoxPlayers.Text);
                ori.Cards    = Convert.ToInt32(textBoxCards.Text);
                // this will be overridden later, if external game grid is used.
                ori.Games = Convert.ToInt32(textBoxGames.Text);
            }

            ori.colored_balls = textBoxColorBallCount.Text.Length > 0 ? Convert.ToInt32(textBoxColorBallCount.Text) : 0;

            ori.flags.use_blower   = radioBallBlower.Checked;
            ori.flags.database_run = checkBoxDatabase.Checked;

            ori.flags.save_winning_cards = checkBoxSaveWinningCards.Checked;
            ori.flags.Count_BINGO_Calls  = checkBoxCountBINGOCalls.Checked;
            ori.flags.countColorBINGO    = checkBoxCountColorBINGO.Checked;
            ori.flags.quickshot          = checkBoxQuickshot.Checked;

            ori.flags.starburst     = checkBoxStarburst.Checked;
            ori.flags.simulate      = checkBoxSimulate.Checked;
            ori.flags.only_simulate = true;

            // this will be overridden later, if external game grid is used.
            ori.flags.hotball = checkBoxHotball.Checked;

            // this will be overridden later, if external game grid is used.
            ori.flags._5cashball = checkBox5Hotball.Checked;

            ori.PackSize = Convert.ToInt32(textBoxPackSize.Text);
            if ((ori.Cards / ori.PackSize) * ori.PackSize != ori.Cards)
            {
                ori = null;
                MessageBox.Show("Cards does not divide by Pack Size evenly...");
                return(false);
            }

            if (comboBox1.SelectedItem != null)
            {
                String name = (comboBox1.SelectedItem as DataRowView).Row["name"].ToString();
                if (name != null && name.Length > 0)
                {
                    try
                    {
                        DataRow row      = (comboBox1.SelectedItem as DataRowView).Row;
                        DataRow original = row["original_row"] as DataRow;
                        if (original != null)
                        {
                            ori.dealer = BingoDealers.GetDealer(original);
                        }
                        //ori.cardreader = new CardReader( row["original_row"] as DataRow );
                        //if( ori.cardreader.Length != 0 )
                        //	ori.flags.cardfile = true;
                    }
                    catch { }
                }
                else
                {
                    ori.dealer = BingoDealers.nodealer;
                }
            }
            else
            {
                ori.dealer = BingoDealers.nodealer;
            }

            if (!LoadGameInfoFromGrid())
            {
                return(false);
            }

            return(true);
        }