public void RemoveEvents(string regionName, string events) { RtRegion rt = GetRtRegionByName(regionName); if (rt == null) { throw new Exception("Invalid region!"); } if (string.IsNullOrWhiteSpace(events) || events.ToLower() == Events.None) { throw new ArgumentException("Invalid events!"); } var originEvents = rt.Events; var toRemove = Events.ValidateEventsList(events).Item1; toRemove.ForEach(r => { rt.RemoveEvent(r); }); if (_database.Query("UPDATE RtRegions SET Events = @0 WHERE Id = @1", rt.Events, rt.Id) != 0) { return; } rt.Events = originEvents; throw new Exception("Database error: No affected rows."); }
public void RemoveEvents(RtRegion rt, Event ev) { rt.RemoveEvent(ev); _database.Query("UPDATE RtRegions SET Events = @0 WHERE Id = @1", rt.Events, rt.Id); }