public void removeAttendance(Attendance attendance, User currUser) { if (!currUser.Admin && currUser != Owner && currUser != attendance.Person) { throw new InvalidAccessException(); } else if (!Attendances.Contains(attendance)) { throw new DoNotContainElementException(); } else { if (attendance.Person != null) { attendance.Person.removeAtendace(attendance, currUser); } Attendances.Remove(attendance); } }
public void DeleteAttendance(Attendance attendance, User currUser) { if (attendance == null) { throw new CantBeNullException(); } else if (currUser != Owner && !currUser.Admin) { throw new InvalidAccessException(); } else if (!Attendances.Contains(attendance)) { throw new DoNotContainElementException(); } else { Attendances.Remove(attendance); } }
public void ChangeAttendeeRole(Attendance attendee, string attendeeRole, bool state) { if (Attendances.Contains(attendee)) { switch (attendeeRole) { case "chairman": attendee.setChairman(state); break; case "referrent": attendee.setReferrent(state); break; default: break; } } }