public void AddLocation(Location location) { if (location.Country == null) { throw new NullReqiuredFieldException("Country"); } addLocation.Parameters["@country"].Value = location.Country; if (location.City != null) { addLocation.Parameters["@city"].Value = location.City; } if (location.Image != null) { addLocation.Parameters["@image"].Value = location.Image; } try { connection.Open(); if (addLocation.ExecuteNonQuery() == 0) { throw new ZeroRowsExecutedException(); } } finally { Close(); addLocation.Parameters["@country"].Value = DBNull.Value; addLocation.Parameters["@city"].Value = DBNull.Value; addLocation.Parameters["@image"].Value = DBNull.Value; } LocationsChanged?.Invoke(); }
public void RemoveLocation(Location location) { if (location.ID == null) { throw new NullIdException("Location id is null."); } removeLocation.Parameters["@ID"].Value = location.ID; try { connection.Open(); if (removeLocation.ExecuteNonQuery() == 0) { throw new ZeroRowsExecutedException(); } } finally { Close(); removeLocation.Parameters["@ID"].Value = DBNull.Value; } LocationsChanged?.Invoke(); }
internal static void InvokeLocationsChanged(List <GameLocation> newLocations) { LocationsChanged.Invoke(null, new EventArgsGameLocationsChanged(newLocations)); }
public static void InvokeLocationsChanged(List <GameLocation> newLocations) { LocationsChanged.Invoke(newLocations); }