public ActionResult DeclineInvite(int notificationId)
        {
            var notify = NotificationsController.Instance.GetNotification(notificationId);

            ParseKey(notify.Context);

            var controller = new SocialEventsController();
            var objEvent   = controller.GetEvent(_eventId, UserInfo.UserID, UserInfo.Profile.PreferredTimeZone);

            if (objEvent == null)
            {
                return(Json(new { Result = "error" }));
            }

            // update the user status to 'not attending', NO journal integration here.
            var objGuest = new EventGuestInfo
            {
                EventId       = objEvent.EventId,
                UserId        = UserInfo.UserID,
                Email         = UserInfo.Email,
                InvitedOnDate = objEvent.CreatedOnDate,
                RepliedOnDate = DateTime.Now,
                RSVPStatus    = (int)Constants.AttendingStatus.No
            };

            controller.UpdateGuestStatus(objGuest);

            NotificationsController.Instance.DeleteNotificationRecipient(notificationId, UserInfo.UserID);


            return(Json(new { Result = "success" }));
        }
        public ActionResult AcceptInvite(int notificationId)
        {
            var notify = NotificationsController.Instance.GetNotification(notificationId);
            ParseKey(notify.Context);

            var controller = new SocialEventsController();
            var objEvent = controller.GetEvent(_eventId, UserInfo.UserID, UserInfo.Profile.PreferredTimeZone);
            if (objEvent == null)
            {
                return Json(new { Result = "error" });
            }

            var objGuest = new EventGuestInfo
            {
                EventId = objEvent.EventId,
                UserId = UserInfo.UserID,
                Email = UserInfo.Email,
                InvitedOnDate = objEvent.CreatedOnDate,
                RepliedOnDate = DateTime.Now,
                RSVPStatus = (int)Constants.AttendingStatus.Yes
            };
            controller.UpdateGuestStatus(objGuest);

            var url = DotNetNuke.Common.Globals.NavigateURL(_tabId, "", "eventid=" + objEvent.EventId);
            if (objEvent.GroupId > Null.NullInteger) url = DotNetNuke.Common.Globals.NavigateURL(_tabId, "", "eventid=" + objEvent.EventId, "groupid=" + objEvent.GroupId);

            var cntJournal = new Journal();
            cntJournal.AddSocialEventAttendToJournal(objGuest, objEvent.Name, objEvent.GroupId, _tabId, objEvent.PortalId, objGuest.UserId, url);

            NotificationsController.Instance.DeleteNotificationRecipient(notificationId, UserInfo.UserID);

            return Json(new { Result = "success" });
        }
        public ActionResult UpdateAttendStatus(int portalId, int tabId, int groupId, int eventId, int status)
        {
            var controller = new SocialEventsController();
            var @event     = controller.GetEvent(
                eventId, UserInfo.UserID, UserInfo.Profile.PreferredTimeZone);

            if (@event == null)
            {
                return(Json(new { Result = "success" }));
            }

            var objGuest = new EventGuestInfo
            {
                EventId       = @event.EventId,
                UserId        = UserInfo.UserID,
                Email         = UserInfo.Email,
                InvitedOnDate = @event.CreatedOnDate,
                RepliedOnDate = DateTime.Now,
                RSVPStatus    = status
            };

            controller.UpdateGuestStatus(objGuest);

            var url = DotNetNuke.Common.Globals.NavigateURL(tabId, "", "eventid=" + eventId);

            if (groupId > Null.NullInteger)
            {
                url = DotNetNuke.Common.Globals.NavigateURL(tabId, "", "eventid=" + eventId, "groupid=" + groupId);
            }

            var cntJournal = new Journal();

            cntJournal.AddSocialEventAttendToJournal(objGuest, @event.Name, @event.GroupId, tabId, @event.PortalId, objGuest.UserId, url);

            // Notification Integration
            var notificationType = NotificationsController.Instance.GetNotificationType(Constants.NotificationEventInviteTypeName);
            var notificationKey  = string.Format("{0}:{1}:{2}:{3}", Constants.ContentTypeName, @event.EventId, @event.GroupId, PortalSettings.ActiveTab.TabID);
            var objNotify        = NotificationsController.Instance.GetNotificationByContext(notificationType.NotificationTypeId, notificationKey).SingleOrDefault();

            if (objNotify != null)
            {
                NotificationsController.Instance.DeleteNotificationRecipient(objNotify.NotificationID, UserInfo.UserID);
            }

            var response = new { Value = eventId, Result = "success" };

            return(Json(response));
        }
        public ActionResult AcceptInvite(int notificationId)
        {
            var notify = NotificationsController.Instance.GetNotification(notificationId);

            ParseKey(notify.Context);

            var controller = new SocialEventsController();
            var objEvent   = controller.GetEvent(_eventId, UserInfo.UserID, UserInfo.Profile.PreferredTimeZone);

            if (objEvent == null)
            {
                return(Json(new { Result = "error" }));
            }

            var objGuest = new EventGuestInfo
            {
                EventId       = objEvent.EventId,
                UserId        = UserInfo.UserID,
                Email         = UserInfo.Email,
                InvitedOnDate = objEvent.CreatedOnDate,
                RepliedOnDate = DateTime.Now,
                RSVPStatus    = (int)Constants.AttendingStatus.Yes
            };

            controller.UpdateGuestStatus(objGuest);

            var url = DotNetNuke.Common.Globals.NavigateURL(_tabId, "", "eventid=" + objEvent.EventId);

            if (objEvent.GroupId > Null.NullInteger)
            {
                url = DotNetNuke.Common.Globals.NavigateURL(_tabId, "", "eventid=" + objEvent.EventId, "groupid=" + objEvent.GroupId);
            }

            var cntJournal = new Journal();

            cntJournal.AddSocialEventAttendToJournal(objGuest, objEvent.Name, objEvent.GroupId, _tabId, objEvent.PortalId, objGuest.UserId, url);

            NotificationsController.Instance.DeleteNotificationRecipient(notificationId, UserInfo.UserID);

            return(Json(new { Result = "success" }));
        }
        public ActionResult DeclineInvite(int notificationId)
        {
            var notify = NotificationsController.Instance.GetNotification(notificationId);
            ParseKey(notify.Context);

            var controller = new SocialEventsController();
            var objEvent = controller.GetEvent(_eventId, UserInfo.UserID, UserInfo.Profile.PreferredTimeZone);
            if (objEvent == null)
            {
                return Json(new { Result = "error" });
            }

            // update the user status to 'not attending', NO journal integration here.
            var objGuest = new EventGuestInfo
            {
                EventId = objEvent.EventId,
                UserId = UserInfo.UserID,
                Email = UserInfo.Email,
                InvitedOnDate = objEvent.CreatedOnDate,
                RepliedOnDate = DateTime.Now,
                RSVPStatus = (int)Constants.AttendingStatus.No
            };
            controller.UpdateGuestStatus(objGuest);

            NotificationsController.Instance.DeleteNotificationRecipient(notificationId, UserInfo.UserID);

            return Json(new { Result = "success" });
        }
        public ActionResult UpdateAttendStatus(int portalId, int tabId, int groupId, int eventId, int status)
        {
            var controller = new SocialEventsController();
            var @event = controller.GetEvent(
                eventId, UserInfo.UserID, UserInfo.Profile.PreferredTimeZone);
            if (@event == null) return Json(new { Result = "success" });

            var objGuest = new EventGuestInfo
                               {
                                   EventId = @event.EventId,
                                   UserId = UserInfo.UserID,
                                   Email = UserInfo.Email,
                                   InvitedOnDate = @event.CreatedOnDate,
                                   RepliedOnDate = DateTime.Now,
                                   RSVPStatus = status
                               };
            controller.UpdateGuestStatus(objGuest);

            var url = DotNetNuke.Common.Globals.NavigateURL(tabId, "", "eventid=" + eventId);
            if (groupId > Null.NullInteger) url = DotNetNuke.Common.Globals.NavigateURL(tabId, "", "eventid=" + eventId, "groupid=" + groupId);

            var cntJournal = new Journal();
            cntJournal.AddSocialEventAttendToJournal(objGuest, @event.Name, @event.GroupId, tabId, @event.PortalId, objGuest.UserId, url);

            // Notification Integration
            var notificationType = NotificationsController.Instance.GetNotificationType(Constants.NotificationEventInviteTypeName);
            var notificationKey = string.Format("{0}:{1}:{2}:{3}", Constants.ContentTypeName, @event.EventId, @event.GroupId, PortalSettings.ActiveTab.TabID);
            var objNotify = NotificationsController.Instance.GetNotificationByContext(notificationType.NotificationTypeId, notificationKey).SingleOrDefault();

            if (objNotify != null)
            {
                NotificationsController.Instance.DeleteNotificationRecipient(objNotify.NotificationID, UserInfo.UserID);
            }

            var response = new { Value = eventId, Result = "success" };

            return Json(response);
        }