private void button2_Click(object sender, EventArgs e) { MySQLDataTable table1 = new MySQLDataTable(StaticDsnConnection.dsn , "select name from floor_paper_names"); MySQLDataTable table2 = new MySQLDataTable(StaticDsnConnection.dsn , "select item_name from item_descriptions" ); MySQLDataTable table3 = new MySQLDataTable(StaticDsnConnection.dsn , "select paper_item_name,floor_name from floor_item_map" ); foreach (DataRow row in table2.Rows) { DataRow[] rows = table1.Select("name='" + row["item_name"] + "'"); if (rows.Length == 0) { rows = table3.Select("paper_item_name='" + row["item_name"] + "'"); if (rows.Length == 0) { listBox1.Items.Add("Item " + row["item_name"] + " does not map to a floor_paper_name and cannot be sold"); } else { foreach (DataRow row2 in rows) { DataRow[] floor_rows = table1.Select("name='" + row2["floor_name"] + "'"); if (floor_rows.Length == 0) { listBox1.Items.Add("Item " + row["item_name"] + " Is mapped to floor_name " + row2["floor_name"] + " But that floor name does not exist."); } } } } } }
void SetupRelatedTableEditor(DataSet dataset, String Table1, String Table2) { table_name1 = Table1; table_name2 = Table2; rel1 = MySQLDataTable.GetRelationName(table_name1, table_name2); table1 = dataset.Tables[table_name1]; table2 = dataset.Tables[table_name2]; // this might be 'current_' + ... instead of just '...' table3 = dataset.Tables[rel1]; current_table3 = dataset.Tables["current_" + rel1]; InitializeComponent(); dataGridViewMaster1.DataSource = table1; //dataGridViewMaster1.DisplayMember = xperdex.classes.XDataTable.Name( table1 ); //dataGridViewMaster1.ValueMember = table1.Columns[0].ColumnName; dataGridViewMaster2.DataSource = table2; //listBoxSessions.DisplayMember = xperdex.classes.XDataTable.Name( table2 ); //listBoxSessions.ValueMember = table2.Columns[0].ColumnName; dataGridViewRelation1.DataSource = table3; //listBoxSessionMacroSessions.DisplayMember = Names.Name( table3 ); //listBoxSessionMacroSessions.ValueMember = table3.Columns[0].ColumnName; }
public PackFacePrizeLevel(DataSet dataset) : base(dataset) //base( null, dataset, Names.schedule_prefix //, PackFacePrizeLevel.TableName //, dataset.Tables[PackTable.TableName] //, dataset.Tables[PrizeLevelNames.TableName], false ) { Columns.Add(ColorInfoTable.PrimaryKey, XDataTable.DefaultAutoKeyType); //Columns.Add("face", typeof(int)); String relation_name; dataset.Relations.Add(relation_name = MySQLDataTable.StripPlural(TableName) + "_is_" + MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(ColorInfoTable.TableName)) , dataset.Tables[ColorInfoTable.TableName].Columns[ColorInfoTable.PrimaryKey] , this.Columns[ColorInfoTable.PrimaryKey] ); ForeignKeyConstraint fkc = this.Constraints[relation_name] as ForeignKeyConstraint; if (fkc != null) { fkc.DeleteRule = Rule.SetNull; } }
public void Load(DsnConnection dsn, ScheduleDataSet schedule, DateTime bingoday, int session, List <int> use_groups) { MySQLDataTable win_table = new MySQLDataTable(dsn , "select * from prize_validations where bingoday=" + DsnSQLUtil.MakeDateOnly(dsn, bingoday) + " and session_id=" + session ); if (win_table.Rows.Count == 0) { Log.log("No prizes for this session today."); // return; } { foreach (DataRow row in win_table.Rows) { Log.log("win record " + " Game:" + row["game_id"] + " card:" + row["card"].ToString() + " ball:" + row["ball_list"] + " unit:" + row["unit"]); } } this.use_groups = use_groups; this.schedule = schedule; if (this.schedule == null) { this.schedule = new ScheduleDataSet(dsn); } MessageBox.Show("Failed to update this method."); //ReloadSessionGames( schedule.GetSession( bingoday, 1 ) ); }
public SessionGameGroupGameOrder(DsnConnection odbc, DataSet dataset) : base(odbc, dataset , dataset.Tables[SessionTable.TableName] as XDataTable , new MySQLRelationMap(new object[] { dataset.Tables[SessionTable.TableName] as XDataTable , MySQLRelationMap.MapOp.SaveRelationPoint , MySQLRelationMap.MapOp.FollowTo , PackGroupTable.TableName , MySQLRelationMap.MapOp.InvokNameChangeEvent , MySQLRelationMap.MapOp.FollowTo , GameTable.TableName , MySQLRelationMap.MapOp.InvokNameChangeEvent }).ToString() //, ".session_has_game_group.\\game_group_in_session$/game_group_has_game.\\game_in_game_group$" , false , false , new DataColumn[] { new DataColumn("game_number", typeof(int)) , new DataColumn("ball_timer", typeof(int)) , new DataColumn("overlap_prior", typeof(bool)) , new DataColumn("progressive", typeof(bool)) , new DataColumn("bonanza", typeof(bool)) , new DataColumn("wild", typeof(bool)) , new DataColumn("double_wild", typeof(bool)) , new DataColumn("blind", typeof(bool)) , new DataColumn("single_hotball", typeof(bool)) , new DataColumn(ColorInfoTable.PrimaryKey, XDataTable.DefaultAutoKeyType) } ) { foreach (string name in DataColumns) { this.Columns[name].AllowDBNull = false; this.Columns[name].DefaultValue = 0; } if (dataset != null) { DataTable child; dataset.Relations.Add(SessionGameGroupGameOrder.color_name = MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(SessionGameGroupGameOrder.TableName)) + "_is_" + MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(ColorInfoTable.TableName)) , dataset.Tables[ColorInfoTable.TableName].Columns[ColorInfoTable.PrimaryKey] , (child = dataset.Tables[SessionGameGroupGameOrder.TableName]).Columns[ColorInfoTable.PrimaryKey] ); ForeignKeyConstraint fkc = child.Constraints[color_name] as ForeignKeyConstraint; if (fkc != null) { fkc.DeleteRule = Rule.SetNull; } } number_column = NumberColumn; AddingRow += new OnNewRow(initrow); FixupRow += new OnFixupRow(SessionGameGroupGameOrder_FixupRow); //Create(); //base.Fill(null, NumberColumn+",overlap_prior"); ColumnChanged += new DataColumnChangeEventHandler(SessionGameGroupGameOrder_ColumnChanged); }
/// <summary> /// Whatever game events are loaded in the dataset, load the balls for them. /// </summary> public void LoadEventBalls() { if (Rows.Count == 0) { MySQLDataTable parent = this.DataSet.Tables[GameEventDataTable.TableName] as MySQLDataTable; foreach (DataRow row in parent.Rows) { Fill(GameEventDataTable.PrimaryKey + "=" + row[parent.PrimaryKeyName] + " and ((uncalled is null) or (uncalled=0))", "bingo_game_ball_id"); } } }
public void Whatever() { imageList.LargeImageList = Local.imageList1; imageList.Items.AddRange(Local.image_items.ToArray()); for (int n = 0; n < imageList.Items.Count; n++) { imageList.Items[n].Name = imageList.Items[n].Text; } SessionList.DataSource = Local.session_info; SessionList.DisplayMember = MySQLDataTable.Name(Local.session_info); }
public PackTable(DataSet dataSet) : base(Names.schedule_prefix, TableName) { DataColumn dc; dc = Columns.Add("max_sell", typeof(int)); dc = Columns.Add(ColorInfoTable.PrimaryKey, XDataTable.DefaultAutoKeyType); dc = Columns.Add("onsize", typeof(int)); dc = Columns.Add("jumping_jackpot", typeof(bool)); // this is actually prize_level_id //dc = Columns.Add( PrizeLevelNames.PrimaryKey, XDataTable.DefaultAutoKeyType ); dc = Columns.Add("width", typeof(int)); dc = Columns.Add("height", typeof(int)); dc = Columns.Add("face_width", typeof(int)); dc.AllowDBNull = false; dc.DefaultValue = 5; dc = Columns.Add("face_height", typeof(int)); dc.AllowDBNull = false; dc.DefaultValue = 5; dc = Columns.Add("pages", typeof(int)); dc = Columns.Add("multiplier", typeof(int)); dc.DefaultValue = 1; dc.AllowDBNull = false; dc = Columns.Add("_3_number", typeof(bool)); dc.AllowDBNull = false; dc.DefaultValue = false; dc = Columns.Add("double_action", typeof(bool)); dc.AllowDBNull = false; dc.DefaultValue = false; dc = Columns.Add("upickem", typeof(bool)); dc.AllowDBNull = false; dc.DefaultValue = false; dc = Columns.Add("face_size", typeof(int)); dc.AllowDBNull = false; dc.DefaultValue = 25; dc = Columns.Add("even_count_bonus", typeof(bool)); dc.AllowDBNull = false; dc.DefaultValue = false; dc = Columns.Add("odd_count_bonus", typeof(bool)); dc.AllowDBNull = false; dc.DefaultValue = false; dataSet.Tables.Add(this); // relate color_info as pack_is_color { DataTable child; String relation_name; dataSet.Relations.Add(relation_name = MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(PackTable.TableName)) + "_is_" + MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(ColorInfoTable.TableName)) , dataSet.Tables[ColorInfoTable.TableName].Columns[ColorInfoTable.PrimaryKey] , (child = dataSet.Tables[PackTable.TableName]).Columns[ColorInfoTable.PrimaryKey] ); ForeignKeyConstraint fkc = child.Constraints[relation_name] as ForeignKeyConstraint; if (fkc != null) { fkc.DeleteRule = Rule.SetNull; } } }
private void SessionPackEditor_Load(object sender, EventArgs e) { comboBox1.DataSource = Local.schedule.sessions; comboBox1.DisplayMember = xperdex.classes.MySQLDataTable.Name(Local.schedule.sessions); //comboBox1.ValueMember listBox2.DataSource = Local.schedule.current_session_packs; listBox2.DisplayMember = MySQLDataTable.Name(Local.schedule.current_session_packs); listBox1.DataSource = Local.schedule.packs; listBox1.DisplayMember = MySQLDataTable.Name(Local.schedule.packs); }
static Local() { points = new MySQLDataTable(new DsnConnection(Local.output_dsn)); points.TableName = "rate_rank_points2"; DataColumn dc = points.Columns.Add("rate_rank_point_id", typeof(int)); dc.AutoIncrement = true; points.Columns.Add("away_count", typeof(int)); points.Columns.Add("points", typeof(int)); points.Create(); points.Fill(); }
internal static void UpdateTables(DateTime bingoday, int session) { MySQLDataTable prize_validations; prize_validations = new MySQLDataTable(dsn_public , "select * from prize_validations where cast( bingoday as date)=cast(" + MySQLDataTable.MakeDate(bingoday) + " as date) and session=" + session + " group by string_numbers"); DataRow[] rows = prize_validations.Select(null, "game"); foreach (DataRow row in rows) { //DataRow[] check; } }
void ApplyChanges() { //if( pack[PrizeLevelNames.PrimaryKey].GetType() == typeof( Int32 ) ) // if( Convert.ToInt32( pack[PrizeLevelNames.PrimaryKey] ) == 0 ) // pack[PrizeLevelNames.PrimaryKey] = DBNull.Value; BindingSourcePack.EndEdit(); // TO SAVE PACK FACE PRIZE LEVEL if (FaceButtons != null) { for (int i = 0; i < FaceButtons.Length; i++) { if (FaceButtons[i].PrizeLevelId != DBNull.Value) { DataRow[] Facedr = schedule.pack_face_prize_level.Select("pack_id = '" + this.pack["pack_id"] + "' AND face = " + FaceButtons[i].Face); if (Facedr.Length == 0) { DataRow NewFace = schedule.pack_face_prize_level.NewRow(); NewFace["pack_id"] = this.pack["pack_id"]; NewFace["face"] = FaceButtons[i].Face; NewFace["prize_level_id"] = FaceButtons[i].PrizeLevelId; NewFace["color_id"] = FaceButtons[i].FaceColorId; schedule.pack_face_prize_level.Rows.Add(NewFace); } else { Facedr[0]["prize_level_id"] = FaceButtons[i].PrizeLevelId; Facedr[0][ColorInfoTable.PrimaryKey] = FaceButtons[i].FaceColorId; } } } // TO DELETE EXTRA PACK FACE PRIZE LEVEL DataRow[] ExcedFacedr = schedule.pack_face_prize_level.Select("pack_id = '" + this.pack["pack_id"] + "' AND face >= " + FaceButtons.Length); foreach (DataRow dr in ExcedFacedr) { dr.Delete(); } } MySQLDataTable tmp = this.pack.Table as MySQLDataTable; if (tmp != null) { // call mysql sync... //tmp.CommitChanges(); } else { this.pack.Table.AcceptChanges(); } }
static Local() { input_db = StaticDsnConnection.dsn; #if this_was_moved___ points = new MySQLDataTable(new DsnConnection(Local.output_dsn)); points.TableName = "rate_rank_points2"; DataColumn dc = points.Columns.Add("rate_rank_point_id", typeof(int)); points.PrimaryKey = new DataColumn[] { dc }; dc.AutoIncrement = true; dc.AutoIncrementSeed = 1; points.Columns.Add("away_count", typeof(int)); points.Columns.Add("points", typeof(int)); points.Create(); points.Fill(); #endif }
public GameEventDataSet(DsnConnection database) { games = new GameEventDataTable(this, database); game_balls = new GameEventBallsDataTable(this, database); if (!use_alt_game_processed) { games_processed = new GameEventBallsProcessedDataTable(this, database); alt_games_processed = null; GamesProcessed = games_processed; } else { games_processed = null; alt_games_processed = new GameEventBallsProcessedAltDataTable(this, database); GamesProcessed = alt_games_processed; } }
public MyTextBox(String table_member_name, String Column) { String current_member_name = "current_" + MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(table_member_name)); fieldname = table_member_name; Type t = typeof(OpenSkieScheduler3.ScheduleDataSet); Type d = typeof(ScheduleCurrents); fieldCurrentRow = t.GetProperty(current_member_name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); if (fieldCurrentRow == null) { field_in_schedule = false; fieldCurrentRow = d.GetProperty(current_member_name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); } else { field_in_schedule = true; } fieldTable = t.GetField(table_member_name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); if (fieldTable == null) { field_table_in_schedule = false; fieldTable = d.GetField(table_member_name, BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); } else { field_table_in_schedule = true; } column = Column; UpdateBindings(); if (fieldTable != null) { DataTable Table = (field_table_in_schedule ? fieldTable.GetValue(ControlList.schedule) : fieldTable.GetValue(ControlList.data)) as DataTable; if (Table != null) { Table.ColumnChanging += new DataColumnChangeEventHandler(Table_ColumnChanged); } } this.TextChanged += new EventHandler(MyTextBox_TextChanged); this.LostFocus += new EventHandler(MyTextBox_LostFocus); ControlList.controls.Add(this); ControlList.names.Add(this); }
public void FillUnprocessed(int max_games) { // shouldn't have any null parent ID if (this.DataSet != null) { MySQLDataTable parent = this.DataSet.Tables[GameEventDataTable.TableName] as MySQLDataTable; foreach (DataRow row in parent.Rows) { row.Delete(); } this.DataSet.AcceptChanges(); parent.Fill("Select " + GameEventDataTable.PrimaryKey + ",bingoday,session,game,ballset,processed,closed_at from " + parent.FullTableName + " left join " + this.FullTableName + " using (" + parent.PrimaryKeyName + ")" + " where (processed=0 or processed is null) and (closed_at is not null and closed_at<>0) and bingoday>=20091130" + " order by bingoday,session,game" + ((max_games > 0)?(" limit " + max_games):"") , 0); bool added = false; foreach (DataRow row in parent.Rows) { if (row["processed"] == DBNull.Value) { DataRow newrow = this.NewRow(); newrow[parent.PrimaryKeyName] = row[parent.PrimaryKeyName]; newrow["processed"] = 0; this.Rows.Add(newrow); added = true; } else { Fill(GameEventDataTable.PrimaryKey + "=" + row[parent.PrimaryKeyName]); } } if (added) { CommitChanges(); } } else { // oh I had the full select which could one-pass auto-expand this table to be the unprocessed list // but now we can get the balls } }
void LoadMisc(BingoSessionEvent session, String misc_dept, String misc_item) { MySQLDataTable specials = new MySQLDataTable(StaticDsnConnection.dsn , "select transnum,sum(quantity) as count,bingoday from misc_trans join misc_item using(item_id) join misc_dept using(dept_id)" + " where misc_item.name='" + misc_item + "' and misc_dept.name='" + misc_dept + "'" + " and misc_trans.bingoday=cast( " + DsnSQLUtil.MakeDate(StaticDsnConnection.dsn, session.bingoday) + " as date)" + " and misc_trans.session=" + session.session.session + " and misc_trans.void=0" + " group by transnum" ); PlayerTransaction transaction = null; foreach (DataRow row in specials.Rows) { GetPlayer(Convert.ToDateTime(row["bingoday"]), Convert.ToInt32(row["transnum"]), ref transaction); } specials.Dispose(); }
DataTable LoadPrices(DateTime day, int session) { bool weekend; DayOfWeek day_type = day.DayOfWeek; int day_num = ((int)day_type) + 1; if (day_type == DayOfWeek.Saturday || day_type == DayOfWeek.Sunday) { weekend = true; } else { weekend = false; } DataTable _prize_data = new MySQLDataTable(dsn, "select a.amount,b.amount,d.new_amount,e.new_amount,f.new_amount,g.new_amount,g.new_amount,i.new_amount,if(isnull(i.new_amount),if(isnull(g.new_amount),if(isnull(h.new_amount),if(isnull(b.amount),if(isnull(f.new_amount),if(isnull(d.new_amount),if(isnull(e.new_amount) ,a.amount,e.new_amount) ,d.new_amount) ,f.new_amount) ,b.amount) ,h.new_amount) ,g.new_amount) ,i.new_amount) as amount,game_number,a.prize_level_id,a.session_macro_id,a.session_number,a.session_game_group_game_id,a.price_schedule_id" + " from " + Names.schedule_prefix + "price_schedule as a " + " left join " + Names.schedule_prefix + "price_schedule_override as d on a.price_schedule_id=d.price_schedule_id and d.day_of_week=10 and d.specific_date=" + MySQLDataTable.MakeDateOnly(day) + (weekend?" left join " + Names.schedule_prefix + "price_schedule_override as e on a.price_schedule_id=e.price_schedule_id and e.day_of_week=9" :" left join " + Names.schedule_prefix + "price_schedule_override as e on a.price_schedule_id=e.price_schedule_id and e.day_of_week=8") + " left join " + Names.schedule_prefix + "price_schedule_override as f on a.price_schedule_id=f.price_schedule_id and f.day_of_week=" + day_num // now join the session-specific overrides... + " left join " + Names.schedule_prefix + "price_schedule as b on a.session_macro_id=b.session_macro_id and a.session_game_group_game_id=b.session_game_group_game_id and b.session_number=" + session + " and a.prize_level_id=b.prize_level_id" + " left join " + Names.schedule_prefix + "price_schedule_override as g on b.price_schedule_id=g.price_schedule_id and g.day_of_week=10 and g.specific_date=" + MySQLDataTable.MakeDateOnly(day) + (weekend ? " left join " + Names.schedule_prefix + "price_schedule_override as h on b.price_schedule_id=e.price_schedule_id and h.day_of_week=9" : " left join " + Names.schedule_prefix + "price_schedule_override as h on b.price_schedule_id=e.price_schedule_id and h.day_of_week=8") + " left join " + Names.schedule_prefix + "price_schedule_override as i on a.price_schedule_id=i.price_schedule_id and i.day_of_week=" + day_num // finall, grab the session game group info. + " join " + Names.schedule_prefix + "session_game_group_game on (" + Names.schedule_prefix + "session_game_group_game.session_game_group_game_id=a.session_game_group_game_id)" + " where " + Names.schedule_prefix + "session_game_group_game.session_id=a.session_id and a.session_macro_id=" + session_macro[SessionMacroTable.PrimaryKey] + " and a.session_number=0" + " order by " + Names.schedule_prefix + "session_game_group_game.game_number" ); return(_prize_data); }
public SessionGame(DataSet dataset) : base(dataset) { DataColumn dc; Columns.Add(new DataColumn(NameColumn, typeof(String))); Columns.Add(dc = new DataColumn("game_part_number", typeof(String))); dc.MaxLength = 8; Columns.Add(new DataColumn("ball_timer", typeof(int))); Columns.Add(new DataColumn("progressive", typeof(bool))); Columns.Add(new DataColumn("bonanza", typeof(bool))); Columns.Add(new DataColumn("wild", typeof(bool))); Columns.Add(new DataColumn("double_wild", typeof(bool))); Columns.Add(new DataColumn("blind", typeof(bool))); Columns.Add(new DataColumn("poker", typeof(bool))); Columns.Add(new DataColumn("special", typeof(bool))); Columns.Add(new DataColumn("single_hotball", typeof(bool))); Columns.Add(new DataColumn("callers_choice", typeof(bool))); Columns.Add(new DataColumn(ColorInfoTable.PrimaryKey, XDataTable.DefaultAutoKeyType)); if (dataset != null) { DataTable child; dataset.Relations.Add(SessionGame.color_name = MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(SessionGame.TableName)) + "_is_" + MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(ColorInfoTable.TableName)) , dataset.Tables[ColorInfoTable.TableName].Columns[ColorInfoTable.PrimaryKey] , (child = dataset.Tables[SessionGame.TableName]).Columns[ColorInfoTable.PrimaryKey] ); ForeignKeyConstraint fkc = child.Constraints[color_name] as ForeignKeyConstraint; if (fkc != null) { fkc.DeleteRule = Rule.SetNull; } } number_column = NumberColumn; // these are event catches to make sure numbers track correctly. CloneRow += new MySQLRelationTable.OnCloneRow(SessionGame_CloneRow); AddingRow += new MySQLRelationTable.OnNewRow(initrow); ColumnChanged += new DataColumnChangeEventHandler(SessionGame_ColumnChanged); }
public CardsetRange(DataSet dataSet) : base(Names.schedule_prefix, TableName, false, false) { AddColumns(); dataSet.Tables.Add(this); dataSet.Relations.Add(CardsetRange.CardsetInfoRelationName = MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(CardsetInfo.TableName)) + "_has_" + MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(CardsetRange.TableName)) , dataSet.Tables[CardsetInfo.TableName].Columns[CardsetInfo.PrimaryKey] , dataSet.Tables[CardsetRange.TableName].Columns[CardsetInfo.PrimaryKey] ); try { dataSet.Relations.Add(CardsetRange.DealerRelationName = MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(CardsetRange.TableName)) + "_has_" + MySQLDataTable.StripPlural(MySQLDataTable.StripInfo(Dealer.TableName)) , dataSet.Tables[Dealer.TableName].Columns[Dealer.PrimaryKey] , dataSet.Tables[CardsetRange.TableName].Columns[Dealer.PrimaryKey] ); } catch { // probably a constraint exception... ranges used to be able to be created without a link to dealer.. NULL if you will // this translates between saves badly. Log.log("Deleting rows which reference dealer 0."); restart: foreach (DataRow row in Rows) { if (row.RowState == DataRowState.Deleted) { continue; } if (Convert.ToInt32(GetSQLValue(row[Dealer.PrimaryKey].GetType(), row[Dealer.PrimaryKey])) == 0) { row.Delete(); goto restart; } } CommitChanges(); dataSet.EnforceConstraints = true; } }
static CreateTables() { dsn_me = new DsnConnection("odds.db"); dsn_public = new DsnConnection("mysql-vertest"); play_db = new MySQLDataTable(); play_db.TableName = "Odds_GamePlay"; play_db.AddDefaultColumns(true); play_db.Columns.Add("Odds_GamePlay_id", typeof(int)); play_db.Columns.Add("player_id", typeof(int)); play_db.Columns.Add("start_card", typeof(int)); play_db.Columns.Add("card_count", typeof(int)); play_db.Columns.Add("card_base", typeof(int)); //play_db.Create(); //Schedule.GetMacroSchedule game_db = new MySQLDataTable("Odds_Games"); game_db.AddDefaultColumns(true); game_db.Columns.Add("Balls", typeof(String)); game_db.Columns.Add("session", typeof(int)); game_db.Columns.Add("game", typeof(int)); game_db.Columns.Add("bingoday", typeof(DateTime)); game_db.Columns.Add("pattern_id_1", typeof(int)); game_db.Columns.Add("pattern_id_2", typeof(int)); game_db.Columns.Add("pattern_id_3", typeof(int)); game_db.Columns.Add("pattern_id_4", typeof(int)); game_db.Columns.Add("pattern_id_5", typeof(int)); //game_db.Create(); ds = new DataSet(); ds.Tables.Add(play_db); ds.Tables.Add(game_db); ds.Relations.Add(new DataRelation("game_play" , game_db.Columns[0] , play_db.Columns[XDataTable.Name(game_db)]) ); }
public static void GetPlayedSessions(DateTime bingoday) { List <String> sessionList = new List <String>(); List <Int32> sessionIdList = new List <Int32>(); MySQLDataTable win_table = new MySQLDataTable(StaticDsnConnection.dsn , "select * from prize_validations where bingoday=" + MySQLDataTable.MakeDateOnly(bingoday) + " group by session_id" ); //ScheduleDataSet scheduleDataSet = new ScheduleDataSet( StaticDsnConnection.dsn, bingoday, 1, true ); //scheduleDataSet.sessions.Fill(); ScheduleDataSet scheduleDataSet = new ScheduleDataSet(StaticDsnConnection.dsn, bingoday, 1, true); foreach (DataRow row in scheduleDataSet.sessions.Rows) { sessionList.Add(row["session_name"].ToString()); sessionIdList.Add(Convert.ToInt32(row["session_id"])); MySQLDataTable game_table1 = new MySQLDataTable(StaticDsnConnection.dsn, "SELECT * from bingo_sched3_session_game where session_id=" + row["session_id"].ToString()); DataRow[] game_table = scheduleDataSet.session_games.Select(scheduleDataSet.games.PrimaryKeyName + "=" + row[scheduleDataSet.games.PrimaryKeyName].ToString()); game_table1.Clear(); foreach (DataRow gameRow in game_table1.Rows) { game_table1.Rows.Add(gameRow["game_id"], gameRow["session_game_name"]); } } sessions = sessionList.ToArray(); sessionIds = sessionIdList.ToArray(); }
public SessionSalesDefine() { initializing = true; InitializeComponent(); SessionList.DataSource = Local.session_info; SessionList.DisplayMember = MySQLDataTable.Name(Local.session_info); PageList.DataSource = Local.session_info.page_view; PageList.Columns[2].SortMode = DataGridViewColumnSortMode.Automatic; //PageList.Rows[0].Cells[0].Selected = false; //PageList.Rows[0].Cells[1].Selected = true; PageList.Columns[0].Width = 0; PageList.Columns[1].Width = 90; PageList.Columns[2].Width = 70; PageList.Columns[3].Width = 70; PageList.Columns[4].Width = 36; PageList.Columns[5].Visible = false; PageList.Columns[0].Visible = false; initializing = false; //PageList.Columns[0].Visible = false; Local.session_info.UpdatePages(); }
private void InitClass() { this.DataSetName = "Preferences"; this.Prefix = ""; this.Namespace = "http://dol.oecken.net/ItemCreator/schemas/Preferences.xsd"; this.EnforceConstraints = true; this.SchemaSerializationMode = global::System.Data.SchemaSerializationMode.IncludeSchema; this.tableBasic = new BasicDataTable(); base.Tables.Add(this.tableBasic); this.tableMySQL = new MySQLDataTable(); base.Tables.Add(this.tableMySQL); }
internal void InitVars(bool initTable) { this.tableBasic = ((BasicDataTable)(base.Tables["Basic"])); if ((initTable == true)) { if ((this.tableBasic != null)) { this.tableBasic.InitVars(); } } this.tableMySQL = ((MySQLDataTable)(base.Tables["MySQL"])); if ((initTable == true)) { if ((this.tableMySQL != null)) { this.tableMySQL.InitVars(); } } }
void UpdatePriceGrid() { dataGridView1.Columns.Clear(); int n; int prior_game_number = 0; LoadPrices(DateTime.Now, 1); n = dataGridView1.Columns.Add("session", "Session"); dataGridView1.Columns[n].ReadOnly = true; n = dataGridView1.Columns.Add("game group", "Game Group"); dataGridView1.Columns[n].ReadOnly = true; n = dataGridView1.Columns.Add("pack", "Pack"); dataGridView1.Columns[n].ReadOnly = true; //n = dataGridView1.Columns.Add( "game_number", "Number" ); //dataGridView1.Columns[n].ReadOnly = true; n = dataGridView1.Columns.Add("session_game_group_game_row", "Hidden"); dataGridView1.Columns[n].Visible = false; DataRow real_session_game_group = game_group["original_row"] as DataRow; DataRow real_game_group = real_session_game_group.GetParentRow("game_group_in_session"); n = dataGridView1.Columns.Add("price", "Price"); //dataGridView1.Columns[n].ReadOnly = true; n = dataGridView1.Columns.Add("validation", "Validation"); DataGridViewCheckBoxColumn checkbox = new DataGridViewCheckBoxColumn(); checkbox.Name = "sale_validation"; checkbox.HeaderText = "Sale Validation"; n = dataGridView1.Columns.Add(checkbox); //dataGridView1.Columns[n].ReadOnly = true; if (session == null) { return; } if (session_macro == null) { return; } if (game_group == null) { return; } DataRow original = this.game_group["original_row"] as DataRow; DataRow this_game_group = original; throw new Exception("commented out this line... how do we do prices anyhow?"); DataRow[] rows = new DataRow[0]; //DataRow[] rows = ControlList.data.session_packs.Select( // SessionTable.PrimaryKey + "=" + session[SessionTable.PrimaryKey] // + " and " + SessionPackOrder.PrimaryKey + "=" + this_game_group[GameGroupTable.PrimaryKey] ); dataGridView1.Rows.Clear(); foreach (DataRow row in rows) { int game_number = Convert.ToInt32(row[SessionGame.NumberColumn]); DataRow tmp_game = row.GetParentRow("session_game_group_game_meta_game_info"); DataRow tmp_game_group = row.GetParentRow("session_game_group_game_meta_game_group_info"); DataRow tmp_session = row.GetParentRow("session_game_group_game_meta_session_info"); object[] o = new object[] { tmp_session[SessionTable.NameColumn] , tmp_game_group[PackGroupTable.NameColumn] , tmp_game[GameTable.NameColumn] , row[SessionGame.NumberColumn] , row }; if (prior_game_number != (game_number - 1)) { for (int x = prior_game_number; x < (game_number - 1); x++) { object[] o_blank = new object[] { "Game", "not in", "this group", "-" }; dataGridView1.Rows.Add(o_blank); } } prior_game_number = game_number; dataGridView1.Rows.Add(o); } // checking for specific session (and specific day) if (checkBox1.Checked) { prize_data = new MySQLDataTable(dsn, "select if(isnull(d.new_amount),if(isnull(b.amount),if(isnull(c.new_amount),a.amount,c.new_amount),b.amount),d.new_amount) as amount,game_number,a.prize_level_id,a.session_macro_id,a.session_number,a.session_game_group_game_id,a.price_schedule_id,d.new_amount as day_session_prize,c.new_amount as day_prize,b.amount as session_prize,a.amount as default_prize" + " from " + Names.schedule_prefix + "price_schedule as a " + " left join " + Names.schedule_prefix + "price_schedule_override as c on a.price_schedule_id=c.price_schedule_id and c.day_of_week=" + day_of_week_type + ((day_of_week_type == 10) ? " and c.specific_day=" + MySQLDataTable.MakeDateOnly(date) : "") + " left join " + Names.schedule_prefix + "price_schedule as b on a.session_macro_id=b.session_macro_id and a.session_game_group_game_id=b.session_game_group_game_id and b.session_number=" + session_macro_session["session_number"] + " and a.prize_level_id=b.prize_level_id" + " left join " + Names.schedule_prefix + "price_schedule_override as d on b.price_schedule_id=d.price_schedule_id and d.day_of_week=" + day_of_week_type + ((day_of_week_type == 10) ? " and d.specific_day=" + MySQLDataTable.MakeDateOnly(date) : "") + " join " + Names.schedule_prefix + "session_game_group_game on (" + Names.schedule_prefix + "session_game_group_game.session_game_group_game_id=a.session_game_group_game_id)" + " where " + Names.schedule_prefix + "session_game_group_game.session_id=" + session[SessionTable.PrimaryKey] + " and a.session_macro_id=" + session_macro[SessionMacroTable.PrimaryKey] + " and a.session_number=0" ); } else { // checking for default session, and maybe specific day. prize_data = new MySQLDataTable(dsn, "select if(isnull(new_amount),amount,new_amount)as amount,game_number,prize_level_id,session_macro_id,session_number,session_game_group_game_id," + Names.schedule_prefix + "price_schedule.price_schedule_id,new_amount as day_prize" + " from " + Names.schedule_prefix + "price_schedule " + " left join " + Names.schedule_prefix + "price_schedule_override on " + Names.schedule_prefix + "price_schedule.price_schedule_id=" + Names.schedule_prefix + "price_schedule_override.price_schedule_id and " + Names.schedule_prefix + "price_schedule_override.day_of_week=" + day_of_week_type + ((day_of_week_type == 10) ? " and specific_day=" + MySQLDataTable.MakeDateOnly(date) : "") + " join " + Names.schedule_prefix + "session_game_group_game using(session_game_group_game_id)" + " where " + Names.schedule_prefix + "session_game_group_game.session_id=" + session[SessionTable.PrimaryKey] + " and " + Names.schedule_prefix + "price_schedule.session_macro_id=" + session_macro[SessionMacroTable.PrimaryKey] + " and session_number=0" ); } foreach (DataRow row in prize_data.Rows) { int number = Convert.ToInt32(row["game_number"]); foreach (DataGridViewRow row2 in dataGridView1.Rows) { if (row2.Cells["game_number"].Value == "-") { continue; } if (Convert.ToInt32(row2.Cells["game_number"].Value) == number) { int col = 0; foreach (int prize_id in prize_levels) { if (Convert.ToInt32(row["prize_level_id"]) == prize_id) { row2.Cells[prize_col_start + col].Value = new Money(Convert.ToInt64(row["amount"])); break; } col++; } break; } } //dataGridView1.Rows[Convert.ToInt32( row["game_number"] )-1]. } }
internal MySQLRow(global::System.Data.DataRowBuilder rb) : base(rb) { this.tableMySQL = ((MySQLDataTable)(this.Table)); }
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); }
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(); }
public static void UpdateRanks( DateTime day_in_week, int session ) { if( input_db != null ) { long week_id = StateWriter.GetWeekID( day_in_week, session ); input_db.KindExecuteNonQuery( "replace into called_game_player_rank (card,session,bingoday,week_id,pack_set_id,game_count,total_points)" + " SELECT card,session,bingoday,"+week_id+",pack_set_id,count(*) as game_count,sum(total_points) as total_points" + " FROM called_game_player_rank2 where " //+ (true?"pack_set_id=1":"pack_set_id>0") + " card<>'000000000000000000'" //+ " and session=" + playing_session.session_number + " and " + String_Utilities.BuildSessionRangeCondition( null, day_in_week, session ) //+ " and bingoday=" + MySQLDataTable.MakeDateOnly( playing_session.bingoday ) + " group by card,pack_set_id,session,bingoday order by bingoday,session,card,pack_set_id" ); if( use_bonus_points ) { MySQLDataTable table = new MySQLDataTable( input_db, "select * from rate_rank_bonus_points" ); MySQLDataTable totals = new MySQLDataTable( input_db, "select * from called_game_player_rank where bingoday="+DsnSQLUtil.MakeDateOnly( input_db, day_in_week ) +" and session="+session+" order by total_points desc" ); if( totals != null && ( totals.Rows.Count > 0 ) ) { int place_num; foreach( DataRow row in table.Rows ) { place_num = Convert.ToInt32( row["place_in_session"] ); input_db.KindExecuteNonQuery( "replace into called_game_player_rank_bonus (card,week_id,bonus_points,bingoday,session)values(" + input_db.sql_value_quote_open + totals.Rows[place_num - 1]["card"] + input_db.sql_value_quote_close + "," + week_id + "," + row["bonus_points"].ToString() + "," + DsnSQLUtil.MakeDateOnly( input_db, day_in_week ) + "," + session + ")" ); } } } if( use_bonus_points ) { input_db.KindExecuteNonQuery( "replace into called_game_player_rank_partial (card,session,bingoday,total_points,week_id)" + "select a.card,a.session,a.bingoday,a.total_points+sum(IF(ISNULL(c.bonus_points),0,c.bonus_points)),a.week_id from called_game_player_rank as a left" + " join called_game_player_rank as b on a.card=b.card and a.week_id=b.week_id and a.total_points<b.total_points" + " left join called_game_player_rank_bonus as c on a.card=c.card " + " where b.card is null and a.week_id=" + week_id + " group by a.card,a.session,a.bingoday,a.total_points,a.week_id" ); } else { input_db.KindExecuteNonQuery( "replace into called_game_player_rank_partial (card,session,bingoday,total_points,week_id)" + "select a.card,a.session,a.bingoday,a.total_points,a.week_id from called_game_player_rank as a left" + " join called_game_player_rank as b on a.card=b.card and a.week_id=b.week_id and a.total_points<b.total_points" + " where b.card is null and a.week_id=" + week_id ); } #if asdfasdf "replace into called_game_player_rank_partial(card,session,bingoday,week_id,total_points)" + " select card,session,bingoday,week_id,max(total_points) as total_points" + " from called_game_player_rank" + " where week_id=" + week_id + " group by bingoday,session,card" ); #endif } }
void LoadElectronics(BingoSessionEvent session, BingoPacks pack_list, PackDNA rated_packs) { string misc_item = Options.Default["Rate Rank"]["Misc Item To Select Sale", "none"].Value; string misc_dept = Options.Default["Rate Rank"]["Misc Dept To Select Sale", "none"].Value; MySQLDataTable table; if (misc_dept != "none") { MySQLDataTable specials = new MySQLDataTable(StaticDsnConnection.dsn , "select transnum,sum(quantity) as count from misc_trans join misc_item using(item_id) join misc_dept using(dept_id)" + " where misc_item.name='" + misc_item + "' and misc_dept.name='" + misc_dept + "'" + " and misc_trans.bingoday=cast( " + DsnSQLUtil.MakeDate(StaticDsnConnection.dsn, session.bingoday) + " as date)" + " and misc_trans.session=" + session + " and misc_trans.void=0" + " group by transnum" ); table = new MySQLDataTable(StaticDsnConnection.dsn , "select access_db_sale.transnum,pack_type,start_card,pack_type_name,unit_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 by transnum,access_db_packs.id" ); foreach (DataRow row in specials.Rows) { int transnum = Convert.ToInt32(row["transnum"]); PlayerTransaction transaction = null; BingoPlayer player = GetPlayer(Convert.ToDateTime(row["bingoday"]), transnum, ref transaction); int count = Convert.ToInt32(row["count"]) + player.pack_sets.Count; for (int n = player.pack_sets.Count; n < count; n++) { PackSet tmp; player.pack_sets.Add(tmp = new PackSet()); tmp.set_id = n + 1; } } } else { 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 by transnum,access_db_packs.id" ); } foreach (DataRow row in table.Rows) { int transnum = Convert.ToInt32(row["transnum"]); PlayerTransaction transaction = null; BingoPlayer player = GetPlayer(Convert.ToDateTime(row["bingoday"]), transnum, ref transaction); //Log.log( "Player : " + player.card ); int packnum = Convert.ToInt32(row["pack_type"]); // ignore the macro pack labels. if (packnum < 100) { PlayerPack pack = new PlayerPack(); transaction.Add(pack); 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.game_list = _games; pack.player = player; pack.unit_number = Convert.ToInt32(row["unit_num"]); if (rated_packs != null) { bool found = false; string packname = row["pack_type_name"].ToString(); //Log.log( "Looking for pack to stack: " + packname ); foreach (PackSet check_pack_set in player.pack_sets) { if (check_pack_set.Count == rated_packs.pack_sequence.Count) { bool empty_slot = false; int tmp_pos = 0; foreach (BingoPack seq_pack in rated_packs.pack_sequence) { if (check_pack_set.Count > tmp_pos && check_pack_set[tmp_pos] == null) { empty_slot = true; break; } tmp_pos++; } if (!empty_slot) { // this pack set is already full. //Log.log( "(all manager packs already loaded)stack is full... skipping..." ); continue; } } int pos = 0; foreach (BingoPack seq_pack in rated_packs.pack_sequence) { if (check_pack_set.Count > pos && check_pack_set[pos] != null) { //Log.log( "slot is full... skipping..." ); pos++; continue; } //Log.log( "Comparing " + seq_pack.name +" vs " + packname ); if (((check_pack_set.Count <= pos) || (check_pack_set.Count > pos && check_pack_set[pos] == null)) && String.Compare(packname, seq_pack.name, true) == 0) { //Log.log( "Steppig match_pos... setting id " + check_pack_set.set_id ); check_pack_set.match_pos++; pack.pack_set = check_pack_set.set_id; check_pack_set.Set(pos, pack.pack_info); found = true; break; } pos++; } if (found) { //Log.log( "located..." ); break; } } if (!found) { //if( player.card == "000000015200000761" ) // Log.log( "something bad." ); } } Log.log("electronic pack starting card " + pack.start_card); player.played_packs.Add(pack); } } //if( match_pos > 0 ) foreach (BingoPlayer player in this) { foreach (PackSet check_pack_set in player.pack_sets) { if (check_pack_set.Count == rated_packs.pack_sequence.Count) { } else { Log.log("Incomplete pack sequence?"); } } } }
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); } } }
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(); }