public void Guestlist(int EventK, bool GuestlistOrNot, Transaction transaction) { Event e = new Event(EventK); if (!e.HasGuestlist) return; if (!e.GuestlistOpen) return; if (e.GuestlistFull && GuestlistOrNot) return; try { UsrEventGuestlist u = new UsrEventGuestlist(this.K, EventK); if (!GuestlistOrNot) { u.Delete(transaction); } } catch { if (GuestlistOrNot) { UsrEventGuestlist newG = new UsrEventGuestlist(); newG.DateTime = DateTime.Now; newG.UsrK = this.K; newG.EventK = EventK; newG.Update(); try { UsrEventAttended u = new UsrEventAttended(this.K, EventK); } catch { this.AttendEvent(EventK, true, null, transaction); } } } e.UpdateGuestlistCount(transaction); }