コード例 #1
0
    protected void HandleTagNotification(MessageWrapper message)
    {
        TagNotification tn = JsonUtility.FromJson <TagNotification>(message.message);

        if (tn.taggedBy.Equals(CurrentGame.Instance.LocalPlayer.ClientId))
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("Je hebt iemand getikt", new object[] { });
        }
        else
        {
            InGameUIManager.s_Singleton.LogUI.AddToLog("Je bent getikt", new object[] { });
        }
    }
コード例 #2
0
        public virtual void Subscribe(EmailSubscriptionViewModel subscription)
        {
            if (Request.IsAjaxRequest())
            {
                try
                {
                    // Add logic to add subscr
                    var isGroup = subscription.SubscriptionType.Contains("Group");
                    var isTag   = subscription.SubscriptionType.Contains("tag");
                    var id      = subscription.Id;
                    var dbUser  = MembershipService.GetUser(User.Identity.Name);

                    if (isGroup)
                    {
                        // get the Group
                        var cat = _groupService.Get(id);

                        if (cat != null)
                        {
                            // Create the notification
                            var GroupNotification = new GroupNotification
                            {
                                Group = cat,
                                User  = dbUser
                            };
                            //save

                            _notificationService.Add(GroupNotification);
                        }
                    }
                    else if (isTag)
                    {
                        // get the tag
                        var tag = _topicTagService.Get(id);

                        if (tag != null)
                        {
                            // Create the notification
                            var tagNotification = new TagNotification
                            {
                                Tag  = tag,
                                User = dbUser
                            };
                            //save

                            _notificationService.Add(tagNotification);
                        }
                    }
                    else
                    {
                        // get the Group
                        var topic = _topicService.Get(id);

                        // check its not null
                        if (topic != null)
                        {
                            // Create the notification
                            var topicNotification = new TopicNotification
                            {
                                Topic = topic,
                                User  = dbUser
                            };
                            //save

                            _notificationService.Add(topicNotification);
                        }
                    }

                    Context.SaveChanges();
                }
                catch (Exception ex)
                {
                    Context.RollBack();
                    LoggingService.Error(ex);
                    throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
                }
            }
            else
            {
                throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
            }
        }
コード例 #3
0
 public TagNotification Add(TagNotification tagNotification)
 {
     return(_context.TagNotification.Add(tagNotification));
 }
コード例 #4
0
 public void Delete(TagNotification notification)
 {
     _context.TagNotification.Remove(notification);
 }
コード例 #5
0
 public void Delete(TagNotification notification)
 {
     _context.TagNotification.Remove(notification);
 }
コード例 #6
0
 public TagNotification Add(TagNotification tagNotification)
 {
     return _context.TagNotification.Add(tagNotification);
 }
コード例 #7
0
ファイル: EmailController.cs プロジェクト: lenwen/mvcforum
        public void Subscribe(SubscribeEmailViewModel subscription)
        {
            if(Request.IsAjaxRequest())
            {
                using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
                {
                    try
                    {
                        // Add logic to add subscr
                        var isCategory = subscription.SubscriptionType.Contains("category");
                        var isTag = subscription.SubscriptionType.Contains("tag");
                        var id = subscription.Id;
                        var dbUser = MembershipService.GetUser(LoggedOnReadOnlyUser.Id);

                        if (isCategory)
                        {
                            // get the category
                            var cat = _categoryService.Get(id);

                            if(cat != null)
                            {

                                // Create the notification
                                var categoryNotification = new CategoryNotification
                                {
                                    Category = cat,
                                    User = dbUser
                                };
                                //save

                                _categoryNotificationService.Add(categoryNotification);
                            }
                        }
                        else if (isTag)
                        {
                            // get the tag
                            var tag = _topicTagService.Get(id);

                            if (tag != null)
                            {

                                // Create the notification
                                var tagNotification = new TagNotification
                                {
                                    Tag = tag,
                                    User = dbUser
                                };
                                //save

                                _tagNotificationService.Add(tagNotification);
                            }
                        }
                        else
                        {
                            // get the category
                            var topic = _topicService.Get(id);

                            // check its not null
                            if (topic != null)
                            {

                                // Create the notification
                                var topicNotification = new TopicNotification
                                {
                                    Topic = topic,
                                    User = dbUser
                                };
                                //save

                                _topicNotificationService.Add(topicNotification);
                            }
                        }

                        unitOfWork.Commit();
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.Rollback();
                        LoggingService.Error(ex);
                        throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
                    }
                }
            }
            else
            {
                throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
            }
        }
コード例 #8
0
ファイル: EmailController.cs プロジェクト: yaobos/mvcforum
        public void Subscribe(SubscribeEmailViewModel subscription)
        {
            if (Request.IsAjaxRequest())
            {
                using (var unitOfWork = UnitOfWorkManager.NewUnitOfWork())
                {
                    try
                    {
                        // Add logic to add subscr
                        var isCategory = subscription.SubscriptionType.Contains("category");
                        var isTag      = subscription.SubscriptionType.Contains("tag");
                        var id         = subscription.Id;
                        var dbUser     = MembershipService.GetUser(LoggedOnReadOnlyUser.Id);

                        if (isCategory)
                        {
                            // get the category
                            var cat = _categoryService.Get(id);

                            if (cat != null)
                            {
                                // Create the notification
                                var categoryNotification = new CategoryNotification
                                {
                                    Category = cat,
                                    User     = dbUser
                                };
                                //save

                                _categoryNotificationService.Add(categoryNotification);
                            }
                        }
                        else if (isTag)
                        {
                            // get the tag
                            var tag = _topicTagService.Get(id);

                            if (tag != null)
                            {
                                // Create the notification
                                var tagNotification = new TagNotification
                                {
                                    Tag  = tag,
                                    User = dbUser
                                };
                                //save

                                _tagNotificationService.Add(tagNotification);
                            }
                        }
                        else
                        {
                            // get the category
                            var topic = _topicService.Get(id);

                            // check its not null
                            if (topic != null)
                            {
                                // Create the notification
                                var topicNotification = new TopicNotification
                                {
                                    Topic = topic,
                                    User  = dbUser
                                };
                                //save

                                _topicNotificationService.Add(topicNotification);
                            }
                        }

                        unitOfWork.Commit();
                    }
                    catch (Exception ex)
                    {
                        unitOfWork.Rollback();
                        LoggingService.Error(ex);
                        throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
                    }
                }
            }
            else
            {
                throw new Exception(LocalizationService.GetResourceString("Errors.GenericMessage"));
            }
        }
コード例 #9
0
 public void Add(TagNotification tagNotification)
 {
     _notificationRepository.Add(tagNotification);
 }
コード例 #10
0
 public void Delete(TagNotification notification)
 {
     _notificationRepository.Delete(notification);
 }