private void UpdateQuizzNotification(NewNotification entity)
        {
            var editor = new NewNotificationEditor(entity);

            editor.AddNewFrom(_currentUser.Id);

            _uow.NewNotifications.Update(entity);
        }
        private void CreateNewQuizzmateNotification(NotificationTypeEnum type, int friendRequestId, int quizzlingId, int parentId)
        {
            var editor = new NewNotificationEditor(type, quizzlingId, parentId);

            editor.AddQuizzmateRequest(friendRequestId);
            var entity = editor.GetEntity();

            _uow.NewNotifications.Add(entity);
        }
        private void CreateNewQuizzNotification(NotificationTypeEnum type, Quizz quizz)
        {
            var editor = new NewNotificationEditor(type, _currentUser.Id, quizz.OwnerId);

            editor.AddQuizz(quizz.Id);
            var entity = editor.GetEntity();

            _uow.NewNotifications.Add(entity);
        }
        private void CreateNewQuestionNotification(NotificationTypeEnum type, Question question)
        {
            var editor = new NewNotificationEditor(type, _currentUser.Id, question.AuthorId);

            editor.AddQuestion(question.Id);
            var entity = editor.GetEntity();

            _uow.NewNotifications.Add(entity);
        }
Beispiel #5
0
        private void CreateNewQuizzCommentNotification(NotificationTypeEnum type, QuizzComment quizzComment)
        {
            var editor = new NewNotificationEditor(type, _currentUser.Id, quizzComment.AuthorId);

            editor.AddQuizz(quizzComment.QuizzId);
            editor.AddQuizzComment(quizzComment.Id);
            var entity = editor.GetEntity();

            _uow.NewNotifications.Add(entity);
        }
Beispiel #6
0
        private void CreateNewAssignmentFinishedNotification(int quizzId, int assignmentGroupId, int toId)
        {
            var editor = new NewNotificationEditor(NotificationTypeEnum.AssignmentFinished, _currentUser.Id, toId);

            editor.AddQuizz(quizzId);
            editor.AddAssignmentGroup(assignmentGroupId);
            var entity = editor.GetEntity();

            _uow.NewNotifications.Add(entity);
        }
        public bool AddDepUnQuizzmateNotification(int toUnQuizzmateId, bool callSaveChanges = true)
        {
            try
            {
                var  quizzlingId = _currentUser.Id;
                User dependent   = _uow.Users.GetAll()
                                   .Where(u => u.Id == quizzlingId)
                                   .Include(u => u.DependentPermission)
                                   .Include(u => u.AsChildDependsOn.Select(d => d.User))
                                   .FirstOrDefault();

                if (dependent.UserType == UserTypeEnum.Standard)
                {
                    return(true);
                }

                foreach (var depEntity in dependent.AsChildDependsOn)
                {
                    if (NotificationTypeUtil.WillNotify(depEntity, NotificationTypeEnum.DepUnQuizzmate) == false)
                    {
                        continue;
                    }

                    var editor = new NewNotificationEditor(NotificationTypeEnum.DepUnQuizzmate, quizzlingId, depEntity.UserId);
                    editor.AddToUnQuizzmateUser(toUnQuizzmateId);
                    var entity = editor.GetEntity();
                    _uow.NewNotifications.Add(entity);
                }

                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }
        public bool AddQuizzlingRequestAcceptNotification(DependentRequestFromUser depRequest, bool callSaveChanges = true)
        {
            try
            {
                var editor = new NewNotificationEditor(NotificationTypeEnum.QuizzlingAccept, depRequest.ToChildId, depRequest.FromUserId);

                var entity = editor.GetEntity();
                _uow.NewNotifications.Add(entity);

                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }
Beispiel #9
0
        public bool AddQuizzmateRequestAcceptNofication(FriendRequest friendRequest, bool callSaveChanges = true)
        {
            try
            {
                var editor = new NewNotificationEditor(NotificationTypeEnum.QuizzmateAccept, friendRequest.RequestToId, friendRequest.RequestFromId);

                var entity = editor.GetEntity();
                editor.AddQuizzmateRequest(friendRequest.Id);
                _uow.NewNotifications.Add(entity);

                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }
Beispiel #10
0
        public bool AddAssignmentAssignedNotification(int quizzId, int assignmentGroupId, int assignmentId, int toId, bool callSaveChanges = true)
        {
            try
            {
                var editor = new NewNotificationEditor(NotificationTypeEnum.AssignmentAssigned, _currentUser.Id, toId);
                editor.AddQuizz(quizzId);
                editor.AddAssignmentGroup(assignmentGroupId);
                editor.AddAssignment(assignmentId);
                var entity = editor.GetEntity();
                _uow.NewNotifications.Add(entity);

                if (callSaveChanges)
                {
                    _uow.SaveChanges();
                }

                return(true);
            }
            catch (Exception ex)
            {
                _svcContainer.LoggingSvc.Log(ex);
                return(false);
            }
        }