public override Category CreateCategory(string name, string displayName)
        {
            using (var transaction = new TransactionScope(Configuration))
            {
                var dataStore = new CategoryDataStore(transaction);

                var category = new Category(name, displayName);

                dataStore.Insert(category);

                transaction.Commit();

                return category;
            }
        }
Beispiel #2
0
 public static IList<Topic> GetTopics(Category category, PagingInfo paging)
 {
     return Provider.GetTopics(category, paging);
 }
Beispiel #3
0
 public static IList<Topic> GetTopics(Category category, DateTime fromDate, DateTime toDate)
 {
     return Provider.GetTopics(category, fromDate, toDate);
 }
Beispiel #4
0
 public static void DeleteCategory(Category category)
 {
     Provider.DeleteCategory(category);
 }
Beispiel #5
0
 /// <summary>
 /// Create the topic and the relative root message.
 /// </summary>
 /// <param name="category"></param>
 /// <param name="owner"></param>
 /// <param name="title"></param>
 /// <param name="body"></param>
 /// <param name="attachment">Use null if you don't have any attachment</param>
 /// <param name="topic">Returns the topic created</param>
 /// <param name="rootMessage">Returns the message created</param>
 public static void CreateTopic(Category category, string owner,
                                   string title, string body, Attachment.FileInfo attachment,
                                   out Topic topic,
                                   out Message rootMessage)
 {
     Provider.CreateTopic(category, owner, title, body, attachment, out topic, out rootMessage);
 }
Beispiel #6
0
 public abstract void UpdateCategory(Category category);
Beispiel #7
0
 public abstract IList<Topic> GetTopics(Category category, PagingInfo paging);
        /// <summary>
        /// Create the topic and the relative root message.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="owner"></param>
        /// <param name="title"></param>
        /// <param name="body"></param>
        /// <param name="attachment">Use null if you don't have any attachment</param>
        /// <param name="topic">Returns the topic created</param>
        /// <param name="rootMessage">Returns the message created</param>
        public override void CreateTopic(Category category, string owner,
                                          string title, string body, Attachment.FileInfo attachment,
                                          out Topic topic,
                                          out Message rootMessage)
        {
            //Check attachment
            if (attachment != null)
                Attachment.FileHelper.CheckFile(attachment, category.AttachExtensions, category.AttachMaxSize);

            using (TransactionScope transaction = new TransactionScope(Configuration))
            {
                CategoryDataStore forumStore = new CategoryDataStore(transaction);
                forumStore.Attach(category);

                //Insert topic
                TopicDataStore topicStore = new TopicDataStore(transaction);
                topic = new Topic(category, owner, title);
                topicStore.Insert(topic);

                //Insert root message
                MessageDataStore messageStore = new MessageDataStore(transaction);
                rootMessage = new Message(topic, null, owner, title, body, attachment);
                messageStore.Insert(rootMessage);

                transaction.Commit();
            }
        }
Beispiel #9
0
 public abstract void DeleteCategory(Category category);
Beispiel #10
0
 /// <summary>
 /// Create the topic and the relative root message.
 /// </summary>
 /// <param name="category"></param>
 /// <param name="owner"></param>
 /// <param name="title"></param>
 /// <param name="body"></param>
 /// <param name="attachment">Use null if you don't have any attachment</param>
 /// <param name="topic">Returns the topic created</param>
 /// <param name="rootMessage">Returns the message created</param>
 public abstract void CreateTopic(Category category, string owner, 
                                   string title, string body, Attachment.FileInfo attachment,
                                   out Topic topic,
                                   out Message rootMessage);
        public override void UpdateCategory(Category category)
        {
            using (TransactionScope transaction = new TransactionScope(Configuration))
            {
                CategoryDataStore dataStore = new CategoryDataStore(transaction);

                dataStore.Update(category);

                transaction.Commit();
            }
        }
        public override IList<Topic> GetTopics(Category category, PagingInfo paging)
        {
            using (TransactionScope transaction = new TransactionScope(Configuration))
            {
                TopicDataStore dataStore = new TopicDataStore(transaction);

                return dataStore.Find(category, paging);
            }
        }
        public override IList<Topic> GetTopics(Category category, DateTime fromDate, DateTime toDate)
        {
            using (TransactionScope transaction = new TransactionScope(Configuration))
            {
                TopicDataStore dataStore = new TopicDataStore(transaction);

                return dataStore.Find(category, fromDate, toDate);
            }
        }
Beispiel #14
0
 public static void UpdateCategory(Category category)
 {
     Provider.UpdateCategory(category);
 }
Beispiel #15
0
 public abstract IList<Topic> GetTopics(Category category, DateTime fromDate, DateTime toDate);
Beispiel #16
0
        /// <summary>
        /// Create the topic and the relative root message.
        /// </summary>
        /// <param name="category"></param>
        /// <param name="owner"></param>
        /// <param name="title"></param>
        /// <param name="body"></param>
        /// <param name="attachment">Use null if you don't have any attachment</param>
        /// <param name="topic">Returns the topic created</param>
        /// <param name="rootMessage">Returns the message created</param>
        public static void CreateTopic(Category category, string owner,
                                          string title, string body, Attachment.FileInfo attachment)
        {
            Topic tp;
            Message msg;

            CreateTopic(category, owner, title, body, attachment, out tp, out msg);
        }
Beispiel #17
0
 public Topic(Category pCategory, string pOwner, string pTitle)
 {
     Category = pCategory;
     Owner = pOwner;
     Title = pTitle;
 }