예제 #1
0
        public override Article CreateArticle(Category category, string owner,
                                            string name, string title, 
                                            string description, string body)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ArticleDataStore articleStore = new ArticleDataStore(transaction);
                if (articleStore.FindByName(name) != null)
                    throw new ArticleNameAlreadyExistsException(name);

                CategoryDataStore dataStore = new CategoryDataStore(transaction);
                dataStore.Attach(category);

                Article article = new Article(category, name, owner, title, description, body);
                article.Author = owner;

                if (category.AutoApprove)
                    article.Approved = true;

                articleStore.Insert(article);

                transaction.Commit();

                return article;
            }
        }
예제 #2
0
 public Article(Category pCategory, string pName, string pOwner, 
                 string pTitle, string pDescription, string pBody)
     : base(pOwner, pTitle)
 {
     Category = pCategory;
     Name = pName;
     Description = pDescription;
     Body = pBody;
 }
예제 #3
0
        public override Category CreateCategory(string name, string displayName)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                CategoryDataStore dataStore = new CategoryDataStore(transaction);

                Category category = new Category(name, displayName);

                dataStore.Insert(category);

                transaction.Commit();

                return category;
            }
        }
예제 #4
0
        public override void UpdateCategory(Category category)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                CategoryDataStore dataStore = new CategoryDataStore(transaction);

                dataStore.Update(category);

                transaction.Commit();
            }
        }
예제 #5
0
        public override IList<Article> GetArticlesByOwner(Category category,
                            string owner, ArticleStatus status)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ArticleDataStore dataStore = new ArticleDataStore(transaction);

                return dataStore.FindByCategoryAndOwner(category, owner, status);
            }
        }
예제 #6
0
 public abstract void UpdateCategory(Category category);
예제 #7
0
 public abstract IList<Article> GetArticles(Category category,
                     ArticleStatus status);
예제 #8
0
 public abstract IList<Article> GetArticlesByOwner(Category category,
                     string owner, ArticleStatus status);
예제 #9
0
 public abstract Article CreateArticle(Category category, string owner, 
                                     string name, string title, string description, string body);
예제 #10
0
 public abstract void DeleteCategory(Category category);
예제 #11
0
 public static void DeleteCategory(Category category)
 {
     Provider.DeleteCategory(category);
 }
예제 #12
0
 public static Article CreateArticle(Category category, string owner,
                                     string name, string title, string description, string body)
 {
     return Provider.CreateArticle(category, owner, name, title, description, body);
 }
예제 #13
0
 public static void UpdateCategory(Category category)
 {
     Provider.UpdateCategory(category);
 }
예제 #14
0
 public static IList<Article> GetArticlesByOwner(Category category,
                     string owner, ArticleStatus status)
 {
     return Provider.GetArticlesByOwner(category, owner, status);
 }
예제 #15
0
 public static IList<Article> GetArticles(Category category,
                     ArticleStatus status)
 {
     return Provider.GetArticles(category, status);
 }