public override void Load() { DatabaseQuery query = new DatabaseQuery(Database.Tables.PERSONAL_DETAILS); query.Add(Database.Tables.PersonalDetails.FirstName); query.Add(Database.Tables.PersonalDetails.LastName); query.Add(Database.Tables.PersonalDetails.Address); query.Add(Database.Tables.PersonalDetails.PostcodeId); query.Add(Database.Tables.PersonalDetails.DateOfBirth); query.Add(Database.Tables.PersonalDetails.Sex); MySqlDataReader reader = DoLoad(query); if (Loaded) { FirstName = reader.GetString(0); LastName = reader.GetString(1); Address = reader.GetString(2); Postcode = AddressManager.GetPostcode(reader.GetInt32(3)); DateOfBirth = reader.GetDateTime(4); Sex = reader.GetChar(5); DetailsManager.Add(this); } reader.Close(); Identifications = DetailsManager.GetIdentificationsWithOwner(this); ContactNumbers = DetailsManager.GetContactNumbersWithOwner(this); }
public override void Save() { DatabaseQuery query = new DatabaseQuery(Database.Tables.CONTACT_NUMBERS); query.Add(Database.Tables.ContactNumbers.Number, Number); query.Add(Database.Tables.ContactNumbers.DetailsId, Owner); DoSave(query); DetailsManager.Add(this); }
public override void Save() { DatabaseQuery query = new DatabaseQuery(Database.Tables.IDENTIFICATIONS); query.Add(Database.Tables.Identifications.Value, Value); query.Add(Database.Tables.Identifications.DetailsId, Owner); DoSave(query); DetailsManager.Add(this); }
public override void Load() { DatabaseQuery query = new DatabaseQuery(Database.Tables.CONTACT_NUMBERS); query.Add(Database.Tables.ContactNumbers.Number); query.Add(Database.Tables.ContactNumbers.DetailsId); MySqlDataReader reader = DoLoad(query); if (Loaded) { Number = reader.GetString(0); Owner = DetailsManager.GetPersonalDetail(reader.GetInt32(1)); DetailsManager.Add(this); } reader.Close(); }
public override void Load() { DatabaseQuery query = new DatabaseQuery(Database.Tables.IDENTIFICATIONS); query.Add(Database.Tables.Identifications.Value); query.Add(Database.Tables.Identifications.DetailsId); MySqlDataReader reader = DoLoad(query); if (Loaded) { Value = reader.GetString(0); Owner = DetailsManager.GetPersonalDetail(reader.GetInt32(1)); DetailsManager.Add(this); } reader.Close(); }
public override void Save() { DatabaseQuery query = new DatabaseQuery(Database.Tables.PERSONAL_DETAILS); query.Add(Database.Tables.PersonalDetails.FirstName, FirstName); query.Add(Database.Tables.PersonalDetails.LastName, LastName); query.Add(Database.Tables.PersonalDetails.Address, Address); query.Add(Database.Tables.PersonalDetails.PostcodeId, Postcode); query.Add(Database.Tables.PersonalDetails.DateOfBirth, DateOfBirth); query.Add(Database.Tables.PersonalDetails.Sex, Sex); DoSave(query); DetailsManager.Add(this); foreach (Identification identification in Identifications) { identification.Validate(); } foreach (ContactNumber contactNumber in ContactNumbers) { contactNumber.Validate(); } }