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;
            }
        }
Exemplo n.º 2
0
 public static IList<Topic> GetTopics(Category category, PagingInfo paging)
 {
     return Provider.GetTopics(category, paging);
 }
Exemplo n.º 3
0
 public static IList<Topic> GetTopics(Category category, DateTime fromDate, DateTime toDate)
 {
     return Provider.GetTopics(category, fromDate, toDate);
 }
Exemplo n.º 4
0
 public static void DeleteCategory(Category category)
 {
     Provider.DeleteCategory(category);
 }
Exemplo n.º 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);
 }
Exemplo n.º 6
0
 public abstract void UpdateCategory(Category category);
Exemplo n.º 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();
            }
        }
Exemplo n.º 9
0
 public abstract void DeleteCategory(Category category);
Exemplo n.º 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);
Exemplo n.º 11
0
        public override void UpdateCategory(Category category)
        {
            using (TransactionScope transaction = new TransactionScope(Configuration))
            {
                CategoryDataStore dataStore = new CategoryDataStore(transaction);

                dataStore.Update(category);

                transaction.Commit();
            }
        }
Exemplo n.º 12
0
        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);
            }
        }
Exemplo n.º 13
0
        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);
            }
        }
Exemplo n.º 14
0
 public static void UpdateCategory(Category category)
 {
     Provider.UpdateCategory(category);
 }
Exemplo n.º 15
0
 public abstract IList<Topic> GetTopics(Category category, DateTime fromDate, DateTime toDate);
Exemplo n.º 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);
        }
Exemplo n.º 17
0
 public Topic(Category pCategory, string pOwner, string pTitle)
 {
     Category = pCategory;
     Owner = pOwner;
     Title = pTitle;
 }