コード例 #1
0
ファイル: TopicDao.cs プロジェクト: bsimser/spforums
        public TopicCollection FindByDate(DateTime dateCriteria)
        {
            string isoDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(dateCriteria);
            SharePointListDescriptor listItems = Provider.GetListItemsByField(ForumConstants.Lists_Topics, "Modified", isoDate);
            TopicCollection          topics    = new TopicCollection();

            foreach (SharePointListItem item in listItems.SharePointListItems)
            {
                topics.Add(TopicMapper.CreateDomainObject(item));
            }
            return(topics);
        }
コード例 #2
0
ファイル: TopicDao.cs プロジェクト: bsimser/spforums
        public Topic GetById(int id)
        {
            SharePointListItem currentItem = Provider.GetListItemByField(ForumConstants.Lists_Topics, "ID", id.ToString());

            // FIXME bit of a hack
            if (currentItem == null)
            {
                return(new Topic(id, 1, "Unknown Topic"));
            }

            return(TopicMapper.CreateDomainObject(currentItem));
        }
コード例 #3
0
ファイル: TopicDao.cs プロジェクト: bsimser/spforums
        public TopicCollection FindInactive()
        {
            SharePointListDescriptor listItems = Provider.GetListItemsByField(
                ForumConstants.Lists_Topics, "NumPosts", "1");
            TopicCollection topics = new TopicCollection();

            foreach (SharePointListItem item in listItems.SharePointListItems)
            {
                topics.Add(TopicMapper.CreateDomainObject(item));
            }
            return(topics);
        }
コード例 #4
0
ファイル: TopicDao.cs プロジェクト: bsimser/spforums
        public TopicCollection GetAll()
        {
            TopicCollection topicCollection = new TopicCollection();

            SharePointListDescriptor descriptor = Provider.GetAllListItems(ForumConstants.Lists_Topics);

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                topicCollection.Add(TopicMapper.CreateDomainObject(listItem));
            }

            return(topicCollection);
        }
コード例 #5
0
ファイル: TopicDao.cs プロジェクト: bsimser/spforums
        public TopicCollection FindByForumId(int id)
        {
            TopicCollection topicCollection = new TopicCollection();

            SharePointListDescriptor descriptor = Provider.GetListItemsByField(ForumConstants.Lists_Topics, "ForumID", id.ToString());

            foreach (SharePointListItem listItem in descriptor.SharePointListItems)
            {
                topicCollection.Add(TopicMapper.CreateDomainObject(listItem));
            }

            return(topicCollection);
        }
コード例 #6
0
ファイル: TopicDao.cs プロジェクト: bsimser/spforums
        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);
        }