public ActionResult ButtonAction(int id, string buttonAction) { var eventt = EventCommand.Get(id); if (LoggedUserIs(RoleEnum.EventAdministrator) && eventt.Organizer.Id != GetLoggedUser().Id) { return(RedirectToAction("Index", "ManageEvent")); } switch (buttonAction) { case "begin": return(Begin(id)); case "finalize": return(Finalize(id)); case "cancelFinalize": return(CancelFinalize(id)); case "emergency": return(Emergency(id)); case "cancelEmergency": return(CancelEmergency(id)); case "startCollaborativeSearch": return(StartCollaborativeSearch(id)); } return(RedirectToAction("Index", "ManageEvent")); }
public ActionResult PersonMonitor(int eventId, int userId) { var eventt = EventCommand.Get(eventId); var user = UserCommand.Get(userId); var seenInfo = AreYouOkCommand.GetSeenInfo(eventId, userId); if (seenInfo == null) { seenInfo = new SeenInfo(); } if (LoggedUserIs(RoleEnum.EventAdministrator) && eventt.Organizer.Id != GetLoggedUser().Id) { return(RedirectToAction("Monitor", "EventMonitor", new { id = eventId })); } var status = IAmOkEnum.WithoutAnswer; var statusRow = AreYouOkEvents.Where(x => x.Target == user && x.Event == eventt).FirstOrDefault(); if (statusRow?.ReplyDatetime != null) { status = statusRow.IAmOk ? IAmOkEnum.Ok : IAmOkEnum.NotOk; } var eventPersonMonitorModel = new EventPersonMonitorModel() { Username = user.Username, Image = user.Image, EventId = eventId, UserId = userId, EventLatitude = eventt.Latitude, EventLongitude = eventt.Longitude, EventName = eventt.Name, Status = status, Seen = seenInfo.Seen, SeenOk = seenInfo.SeenOk, SeenNotOk = seenInfo.SeenNotOk, SeenWithoutAnswer = seenInfo.SeenWithoutAnswer }; return(View(eventPersonMonitorModel)); }
public ActionResult Monitor(int id) { var eventt = EventCommand.Get(id); if (LoggedUserIs(RoleEnum.EventAdministrator) && eventt.Organizer.Id != GetLoggedUser().Id) { return(RedirectToAction("Index", "ManageEvent")); } var eventtModel = new EventMonitorModel() { Id = eventt.Id, Name = eventt.Name, Latitude = eventt.Latitude, Longitude = eventt.Longitude, BeginDateTime = eventt.BeginDateTime, EndDateTime = eventt.EndDateTime, Address = eventt.Address.ToDisplay(), OrganizerDisplay = eventt.Organizer.ToDisplay(), Status = eventt.Status, AmountPeople = Activities.Where(e => e.Event == eventt).Count(), IsCollaborativeSearchStart = eventt.CollaborativeSearchDateTime.HasValue, IAmOk = true, LastUpdate = eventt.EndDateTime, WithoutAnswer = true, IAmNotOk = true, Clustered = true, }; if (eventt.EmergencyDateTime.HasValue) { eventtModel.EmergencyDateTime = eventt.EmergencyDateTime.Value; } if (eventt.CollaborativeSearchDateTime.HasValue) { eventtModel.CollaborativeSearchDateTime = eventt.CollaborativeSearchDateTime.Value; } return(View(eventtModel)); }