public void ChangeContactAttendanceStatus(Guid userId, Guid eventId, EventAttendantsStatus attendStatus) { try { if (attendStatus == EventAttendantsStatus.All || attendStatus == EventAttendantsStatus.Cancel) { throw new InvalidEventStatusException(attendStatus); } IEvent evt = FindEvent(eventId); if (evt == null) { throw new EventException("Specified event cannot be found"); } if (!EvtRepository.Guest(evt, userId)) { throw new EventException("Specified user is not an invited guest:" + userId.ToString()); } EvtRepository.ChangeUserAttendStatus(userId, eventId, attendStatus); } catch (Exception ex) { Logger.Instance.Log = new ExceptionDTO() { FaultClass = "EventFacade", FaultMethod = "ChangeContactAttendanceStatus", Exception = ex }; throw; } }
public IEnumerable <IUser> InviteesByStatus(Guid userId, Guid eventId, EventAttendantsStatus attendStatus) { try { if (userId == new Guid("99999999-9999-9999-9999-999999999999") || userId == new Guid()) { throw new InvalidEventIdException(string.Format("Invalid UserId passed to the InviteesByStatus method: {0} ", userId.ToString())); } if (eventId == new Guid("99999999-9999-9999-9999-999999999999") || eventId == new Guid()) { throw new InvalidEventIdException(string.Format("Invalid eventId passed to the InviteesByStatus method: {0} ", eventId.ToString())); } IEvent evt = FindEvent(eventId); if (!EvtRepository.Guest(evt, userId) && (userId != EvtRepository.Owner(evt))) { throw new EventException("User is not the owner of the event, nor an invited guest."); } var results = EvtRepository.AttendingByStatus(eventId, attendStatus); return(results); } catch (Exception ex) { Logger.Instance.Log = new ExceptionDTO() { FaultClass = "EventFacade", FaultMethod = "EventAttendeesByStatus", Exception = ex }; throw; } }
//Update Contacts attendents status public APIResponse Post(Guid userId, Guid eventId, EventAttendantsStatus attendStatus) { try { if (attendStatus == EventAttendantsStatus.Cancel) { using (UserFacade userFacade = new UserFacade()) userFacade.CancelEvent(userId, eventId); APIResponse response = new APIResponse(APIResponse.ReponseStatus.success, null); return(response); } else { using (EventFacade eventFacade = new EventFacade()) eventFacade.ChangeContactAttendanceStatus(userId, eventId, attendStatus); APIResponse response = new APIResponse(APIResponse.ReponseStatus.success, null); return(response); } } catch (Exception ex) { APIResponse response = new APIResponse(APIResponse.ReponseStatus.error, new { Error = ex.Message }); return(response); } }
public IEnumerable <IEvent> RetrieveAllEventsByStatus(Guid usrId, EventAttendantsStatus status) { if (ThrowException) { throw new Exception(); } return(ListOfEvents); }
public void ChangeUserAttendStatus(Guid userId, Guid eventId, EventAttendantsStatus attendStatus) { if (ThrowException) { throw new Exception(); } AttendStatus = attendStatus; }
public IEnumerable <IUser> AttendingByStatus(Guid eventId, EventAttendantsStatus attendStatus) { if (ThrowException) { throw new Exception(); } return(ListOfUsers); }
public IEnumerable <IUser> AttendingByStatus(Guid eventId, EventAttendantsStatus status) { var query = _dbms.Cypher.Match("(user:User)-[rel]->(evt:Event)") .Where((ScheduledEvent evt) => evt.ID.ToString() == eventId.ToString()) .AndWhere((EventRelationship rel) => rel.AttendStatus == status || status.ToString() == EventAttendantsStatus.All.ToString()) .Return(user => user.As <User>()) .Results; return(query); throw new NotImplementedException(); }
public void ChangeUserAttendStatus(Guid userId, Guid eventId, EventAttendantsStatus attendStatus) { EventRelationship rel = new EventRelationship { AttendStatus = attendStatus }; _dbms.Cypher .Match("(user:User)-[rel:GUEST]->(evtImp:Event)") .Where((User user) => user.ID.ToString() == userId.ToString()) .AndWhere((ScheduledEvent evtImp) => evtImp.ID.ToString() == eventId.ToString()) .Set("rel = {rel}") .WithParam("rel", rel) .ExecuteWithoutResults(); }
//Get User's Status public APIResponse Get(Guid eventId, Guid userId) { try { using (UserFacade facade = new UserFacade()) { EventAttendantsStatus status = facade.RetrieveUsersEventStatus(userId, eventId); APIResponse response = new APIResponse(APIResponse.ReponseStatus.success, new { Status = status.ToString() }); return(response); } } catch (Exception ex) { APIResponse response = new APIResponse(APIResponse.ReponseStatus.error, new { Error = ex.Message }); return(response); } }
public IEnumerable <IEvent> RetrieveAllEventsByStatus(Guid usrId, EventAttendantsStatus status) { var query = _dbms.Cypher.Match("(user:User)-[rel:EVENTOWNER]->(evt:Event)") .Where((User user) => user.ID.ToString() == usrId.ToString()) .AndWhere((ScheduledEvent evt) => evt.Active == true) .AndWhere((EventRelationship rel) => rel.AttendStatus.ToString() == status.ToString() || status.ToString() == EventAttendantsStatus.All.ToString()) .Return(evt => evt.As <ScheduledEvent>()) .Union() .Match("(user:User)-[rel:GUEST]->(evt:Event)") .Where((User user) => user.ID.ToString() == usrId.ToString()) .AndWhere((ScheduledEvent evt) => evt.Active == true) .AndWhere((EventRelationship rel) => rel.AttendStatus.ToString() == status.ToString() || status.ToString() == EventAttendantsStatus.All.ToString()) .Return(evt => evt.As <ScheduledEvent>()) .Results; return(query); }
//List Of Invited by Status public APIResponse Get(Guid userId, Guid eventId, EventAttendantsStatus attendStatus) { try { using (EventFacade facade = new EventFacade()) { IEnumerable <IUser> userList = facade.InviteesByStatus(userId, eventId, attendStatus); APIResponse response = new APIResponse(APIResponse.ReponseStatus.success, new { Users = userList }); return(response); } } catch (Exception ex) { APIResponse response = new APIResponse(APIResponse.ReponseStatus.error, new { Error = ex.Message }); return(response); } }
public IEnumerable <IEvent> RetrieveEventsByAttendanceStatus(Guid usrId, EventAttendantsStatus status) { if (usrId == new Guid("99999999-9999-9999-9999-999999999999") || usrId == new Guid()) { throw new InvalidUserIdException(usrId); } try { IEnumerable <IEvent> evtList = UsrRepository.RetrieveAllEventsByStatus(usrId, status); return(evtList); } catch (Exception ex) { Logger.Instance.Log = new ExceptionDTO() { FaultClass = "UserFacade", FaultMethod = "RetrieveContacts", Exception = ex }; throw; } }
public InvalidEventStatusException(EventAttendantsStatus attendStatus) : base(string.Format(MESSAGE + ": {0} ", attendStatus.ToString())) { }