示例#1
0
        internal NotificationRights GetProectNotificationSetting(string phase, int projectId, int userId)
        {
            var result = new NotificationRights();
            var right  = Context.AssociatedAccountProjectNotificationRights.Include(x => x.Right)
                         .FirstOrDefault(x => x.ProjectId == projectId && x.UserId == userId);

            if (right == null)
            {
                result = AddNewUserNotificationSetting(projectId, userId);
            }

            result = right.Right;
            return(result);
        }
        private int GetControlState(NotificationRights notificationRights, string phase)
        {
            var result = default(int);

            switch (phase)
            {
            case "PersonalMessage":
                result = notificationRights.PersonalMessageNenabled.Value;
                break;

            case "NewWorkItem":
                result = notificationRights.CreateWorkItemNenabled.Value;
                break;

            case "UpdatedWorkItem":
                result = notificationRights.UpdateWorkItemNenabled.Value;
                break;

            case "PublicFeedback":
                result = notificationRights.FeedbackNenabled.Value;
                break;

            case "PublicBugreport":
                result = notificationRights.BugReportNenabled.Value;
                break;

            case "PublicDiscussion":
                result = notificationRights.PublicDiscussionMnenabled.Value;
                break;

            case "ChatChannelMessage":
                result = notificationRights.ChatChannelNenabled.Value;
                break;

            case "ChangelogGenerated":
                result = notificationRights.ChanegelogNenabled.Value;
                break;
            }

            return(result);
        }
示例#3
0
        private NotificationRights UpdateNotificationRightValue(NotificationRights right, string phase, int id)
        {
            switch (phase)
            {
            case "PersonalMessage":
                right.PersonalMessageNenabled = id;
                break;

            case "NewWorkItem":
                right.CreateWorkItemNenabled = id;
                break;

            case "UpdatedWorkItem":
                right.UpdateWorkItemNenabled = id;
                break;

            case "PublicFeedback":
                right.FeedbackNenabled = id;
                break;

            case "PublicBugreport":
                right.BugReportNenabled = id;
                break;

            case "PublicDiscussion":
                right.PublicDiscussionMnenabled = id;
                break;

            case "ChatChannelMessage":
                right.ChatChannelNenabled = id;
                break;

            case "ChangelogGenerated":
                right.ChanegelogNenabled = id;
                break;
            }
            return(right);
        }
示例#4
0
        internal NotificationRights AddNewUserNotificationSetting(int projectId, int userId)
        {
            NotificationRights right = Context.NotificationRights.Add(new NotificationRights
            {
                BugReportNenabled         = 0,
                ChanegelogNenabled        = 0,
                ChatChannelNenabled       = 0,
                CreateWorkItemNenabled    = 0,
                FeedbackNenabled          = 0,
                PersonalMessageNenabled   = 0,
                PublicDiscussionMnenabled = 0,
                UpdateWorkItemNenabled    = 0
            }).Entity;

            Context.SaveChanges();
            Context.AssociatedAccountProjectNotificationRights.Add(new AssociatedAccountProjectNotificationRights
            {
                ProjectId = projectId,
                RightId   = right.Id,
                UserId    = userId
            });
            Context.SaveChanges();
            return(right);
        }