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;
            }
        }
Exemple #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;
 }
        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;
            }
        }
        public override void UpdateCategory(Category category)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                CategoryDataStore dataStore = new CategoryDataStore(transaction);

                dataStore.Update(category);

                transaction.Commit();
            }
        }
        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);
            }
        }
Exemple #6
0
 public abstract void UpdateCategory(Category category);
Exemple #7
0
 public abstract IList<Article> GetArticles(Category category,
                     ArticleStatus status);
Exemple #8
0
 public abstract IList<Article> GetArticlesByOwner(Category category,
                     string owner, ArticleStatus status);
Exemple #9
0
 public abstract Article CreateArticle(Category category, string owner, 
                                     string name, string title, string description, string body);
Exemple #10
0
 public abstract void DeleteCategory(Category category);
Exemple #11
0
 public static void DeleteCategory(Category category)
 {
     Provider.DeleteCategory(category);
 }
Exemple #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);
 }
Exemple #13
0
 public static void UpdateCategory(Category category)
 {
     Provider.UpdateCategory(category);
 }
Exemple #14
0
 public static IList<Article> GetArticlesByOwner(Category category,
                     string owner, ArticleStatus status)
 {
     return Provider.GetArticlesByOwner(category, owner, status);
 }
Exemple #15
0
 public static IList<Article> GetArticles(Category category,
                     ArticleStatus status)
 {
     return Provider.GetArticles(category, status);
 }