protected override bool BeforeNewRecordInserting(SQLiteDataReader rpReader)
        {
            if (r_Type.Type == ResourceHistoryType.Detail)
            {
                return(true);
            }

            var rTime = rpReader.GetInt64("time");

            if (rTime >= r_Type.Maximum)
            {
                r_Type.Update();

                return(true);
            }

            LastInsertedRecord.ID                  = rTime;
            LastInsertedRecord.Fuel                = rpReader.GetInt32("fuel");
            LastInsertedRecord.Bullet              = rpReader.GetInt32("bullet");
            LastInsertedRecord.Steel               = rpReader.GetInt32("steel");
            LastInsertedRecord.Bauxite             = rpReader.GetInt32("bauxite");
            LastInsertedRecord.InstantConstruction = rpReader.GetInt32("instant_construction");
            LastInsertedRecord.Bucket              = rpReader.GetInt32("bucket");
            LastInsertedRecord.DevelopmentMaterial = rpReader.GetInt32("development_material");
            LastInsertedRecord.ImprovementMaterial = rpReader.GetInt32("improvement_material");

            LastInsertedRecord.Update();

            return(false);
        }
Пример #2
0
        protected override void OnRecordUpdate(string rpTable, long rpRowID)
        {
            if (LastInsertedRecord == null || LastInsertedRecord.ID != rpRowID)
            {
                return;
            }

            using (var rCommand = CreateCommand())
            {
                rCommand.CommandText = @"SELECT rank, dropped_ship, battle_dropped_item.item as dropped_item, battle_detail.first IS NOT NULL AS battle_detail, participant_hd.ships AS heavily_damaged FROM battle
LEFT JOIN battle_dropped_item ON battle.id = battle_dropped_item.id
LEFT JOIN battle_detail.battle battle_detail ON battle.id = battle_detail.id
LEFT JOIN battle_detail.participant_hd_view participant_hd ON battle.id = participant_hd.battle
WHERE battle.id = @id";
                rCommand.Parameters.AddWithValue("@id", rpRowID);

                using (var rReader = rCommand.ExecuteReader())
                    if (rReader.Read())
                    {
                        LastInsertedRecord.Update(rReader);
                    }
            }
        }