Example #1
0
 void Init()
 {
     number_column  = NumberColumn;
     base.TableName = TableName;
     AddingRow     += new MySQLRelationTable.OnNewRow(initrow);
     Fill(SessionPackOrder.NumberColumn);
 }
Example #2
0
        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);
        }