Ejemplo n.º 1
0
        public int SavePermissions(int groupId, int forumId, Permission permission)
        {
            string[]           fieldNames  = { "GroupID", "ForumID" };
            string[]           fieldValues = { groupId.ToString(), forumId.ToString() };
            SharePointListItem listItem    = Provider.GetListItemByField(ForumConstants.Lists_ForumAccess, fieldNames, fieldValues);

            int rc = 0;

            if (listItem == null)
            {
                string[] values =
                {
                    "Title",   permission.ToString(),
                    "GroupID", groupId.ToString(),
                    "ForumID", forumId.ToString(),
                };

                listItem = new SharePointListItem(0, values);
                rc       = Provider.AddListItem(ForumConstants.Lists_ForumAccess, listItem);
            }
            else
            {
                listItem["Title"] = permission.ToString();
                rc = Provider.UpdateListItem(ForumConstants.Lists_ForumAccess, listItem);
            }

            return(rc);
        }
Ejemplo n.º 2
0
        public void Save(Message message)
        {
            SharePointListItem listItem = MessageMapper.CreateDto(message);

            if (message.Id == 0)
            {
                Provider.AddListItem(ForumConstants.Lists_Posts, listItem);
                //				TopicRepository.IncreasePostCount(message.TopicId);
            }
            else
            {
                Provider.UpdateListItem(ForumConstants.Lists_Posts, listItem);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Saves the specified category.
        /// </summary>
        /// <param name="category">The category.</param>
        /// <returns></returns>
        public int Save(Category category)
        {
            SharePointListItem listItem = CategoryMapper.CreateDto(category);
            int categoryId;

            if (listItem.Id == 0)
            {
                categoryId = Provider.AddListItem(ForumConstants.Lists_Category, listItem);
            }
            else
            {
                categoryId = Provider.UpdateListItem(ForumConstants.Lists_Category, listItem);
            }

            return(categoryId);
        }
Ejemplo n.º 4
0
        public int Save(ForumUser user)
        {
            int userId;

            SharePointListItem listItem = UserMapper.CreateDto(user);

            if (user.Id == 0)
            {
                userId = Provider.AddListItem(ForumConstants.Lists_Users, listItem);
            }
            else
            {
                userId = Provider.UpdateListItem(ForumConstants.Lists_Users, listItem);
            }

            return(userId);
        }
Ejemplo n.º 5
0
        public int Save(Topic topic)
        {
            SharePointListItem listItem = TopicMapper.CreateDto(topic);
            int newTopicId = 0;

            if (topic.Id == 0)
            {
                newTopicId = Provider.AddListItem(ForumConstants.Lists_Topics, listItem);
                RepositoryRegistry.ForumRepository.IncreaseCount(topic.ForumId);
            }
            else
            {
                newTopicId = Provider.UpdateListItem(ForumConstants.Lists_Topics, listItem);
            }

            return(newTopicId);
        }
Ejemplo n.º 6
0
        public int Save(Forum forum)
        {
            SharePointListItem listItem = ForumMapper.CreateDto(forum);
            int newId = 0;

            if (forum.Id == 0)
            {
                newId = Provider.AddListItem(ForumConstants.Lists_Forums, listItem);
                SetupDefaultPermissions(newId);
            }
            else
            {
                newId = Provider.UpdateListItem(ForumConstants.Lists_Forums, listItem);
            }

            return(newId);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Saves the specified group.
        /// </summary>
        /// <param name="group">The group.</param>
        /// <returns></returns>
        public int Save(Group group)
        {
            string[] values =
            {
                "Title", group.Name,
            };
            SharePointListItem listItem = new SharePointListItem(group.Id, values);

            if (group.Id == 0)
            {
                return(Provider.AddListItem(ForumConstants.Lists_Groups, listItem));
            }
            else
            {
                return(Provider.UpdateListItem(ForumConstants.Lists_Groups, listItem));
            }
        }