public CharacterSheetSkills(SQLiteDataReader reader) { IDBRecord iobj = (IDBRecord)this; foreach (QueryValues val in Enum.GetValues(typeof(QueryValues))) { iobj.SetValue((long)val, reader[iobj.GetFieldName((long)val)]); }//foreach }
void IDBRecord.PrepareCommandDelete(Database.DatabaseCommand dbCommand) { IDBRecord iobj = this as IDBRecord; dbCommand.SetCommand(String.Format( "DELETE FROM {0} " + "WHERE {1}=? AND {2}=? AND {3}=? AND {4}=? AND {5}=? AND {6}=? AND {7}=?;", TableName, iobj.GetFieldName((long)QueryValues.CharID), iobj.GetFieldName((long)QueryValues.refID), iobj.GetFieldName((long)QueryValues.refTypeID), iobj.GetFieldName((long)QueryValues.date), iobj.GetFieldName((long)QueryValues.ownerID1), iobj.GetFieldName((long)QueryValues.ownerID2), iobj.GetFieldName((long)QueryValues.argID))); }
void IDBRecord.PrepareCommandUpdate(Database.DatabaseCommand dbCommand) { IDBRecord iobj = this as IDBRecord; dbCommand.SetCommand(String.Format( "UPDATE {0} SET {1}=?, {2}=?, {3}=?, {4}=?, {5}=?, {6}=? " + "WHERE {7}=? AND {8}=? AND {9}=? AND {10}=? AND {11}=? AND {12}=? AND {13}=?;", TableName, // data iobj.GetFieldName((long)QueryValues.ownerName1), iobj.GetFieldName((long)QueryValues.ownerName2), iobj.GetFieldName((long)QueryValues.argName1), iobj.GetFieldName((long)QueryValues.amount), iobj.GetFieldName((long)QueryValues.balance), iobj.GetFieldName((long)QueryValues.reason), // key iobj.GetFieldName((long)QueryValues.CharID), iobj.GetFieldName((long)QueryValues.refID), iobj.GetFieldName((long)QueryValues.refTypeID), iobj.GetFieldName((long)QueryValues.date), iobj.GetFieldName((long)QueryValues.ownerID1), iobj.GetFieldName((long)QueryValues.ownerID2), iobj.GetFieldName((long)QueryValues.argID))); // data dbCommand.AddParameter((long)QueryValues.ownerName1); dbCommand.AddParameter((long)QueryValues.ownerName2); dbCommand.AddParameter((long)QueryValues.argName1); dbCommand.AddParameter((long)QueryValues.amount); dbCommand.AddParameter((long)QueryValues.balance); dbCommand.AddParameter((long)QueryValues.reason); // key dbCommand.AddParameter((long)QueryValues.CharID); dbCommand.AddParameter((long)QueryValues.refID); dbCommand.AddParameter((long)QueryValues.refTypeID); dbCommand.AddParameter((long)QueryValues.date); dbCommand.AddParameter((long)QueryValues.ownerID1); dbCommand.AddParameter((long)QueryValues.ownerID2); dbCommand.AddParameter((long)QueryValues.argID); }
void IDBRecord.PrepareCommandInsert(Database.DatabaseCommand dbCommand) { IDBRecord iobj = this as IDBRecord; dbCommand.SetCommand(String.Format( "INSERT INTO {0} ({1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}" + "{9}, {10}, {11}, {12}, {13}) " + "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", TableName, iobj.GetFieldName((long)QueryValues.CharID), iobj.GetFieldName((long)QueryValues.refID), iobj.GetFieldName((long)QueryValues.refTypeID), iobj.GetFieldName((long)QueryValues.date), iobj.GetFieldName((long)QueryValues.ownerID1), iobj.GetFieldName((long)QueryValues.ownerID2), iobj.GetFieldName((long)QueryValues.argID), iobj.GetFieldName((long)QueryValues.ownerName1), iobj.GetFieldName((long)QueryValues.ownerName2), iobj.GetFieldName((long)QueryValues.argName1), iobj.GetFieldName((long)QueryValues.amount), iobj.GetFieldName((long)QueryValues.balance), iobj.GetFieldName((long)QueryValues.reason))); // key dbCommand.AddParameter((long)QueryValues.CharID); dbCommand.AddParameter((long)QueryValues.refID); dbCommand.AddParameter((long)QueryValues.refTypeID); dbCommand.AddParameter((long)QueryValues.date); dbCommand.AddParameter((long)QueryValues.ownerID1); dbCommand.AddParameter((long)QueryValues.ownerID2); dbCommand.AddParameter((long)QueryValues.argID); // data dbCommand.AddParameter((long)QueryValues.ownerName1); dbCommand.AddParameter((long)QueryValues.ownerName2); dbCommand.AddParameter((long)QueryValues.argName1); dbCommand.AddParameter((long)QueryValues.amount); dbCommand.AddParameter((long)QueryValues.balance); dbCommand.AddParameter((long)QueryValues.reason); }