コード例 #1
0
        public override void UpdateFileAttachment(FileAttachment attachment)
        {
            //Check attachment
            if (attachment != null)
                Attachment.FileHelper.CheckFile(attachment, attachment.Article.Category.AttachExtensions, attachment.Article.Category.AttachMaxSize);

            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                FileAttachmentDataStore dataStore = new FileAttachmentDataStore(transaction);

                dataStore.Update(attachment);

                transaction.Commit();
            }
        }
コード例 #2
0
        public override FileAttachment CreateFileAttachment(Article article, string name, string contentType, byte[] contentData)
        {
            FileAttachment attachment = new FileAttachment(article, name, contentType, contentData);

            //Check attachment
            if (attachment != null)
                Attachment.FileHelper.CheckFile(attachment, article.Category.AttachExtensions, article.Category.AttachMaxSize);

            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ArticleDataStore dataStore = new ArticleDataStore(transaction);
                dataStore.Attach(article);

                FileAttachmentDataStore attachmentStore = new FileAttachmentDataStore(transaction);
                attachmentStore.Insert(attachment);

                transaction.Commit();

                return attachment;
            }
        }
コード例 #3
0
        public override void DeleteFileAttachment(FileAttachment attachment)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                FileAttachmentDataStore dataStore = new FileAttachmentDataStore(transaction);

                dataStore.Delete(attachment.Id);

                transaction.Commit();
            }
        }
コード例 #4
0
ファイル: WikiProvider.cs プロジェクト: Learion/BruceToolSet
 public abstract void UpdateFileAttachment(FileAttachment attachment);
コード例 #5
0
ファイル: WikiProvider.cs プロジェクト: Learion/BruceToolSet
 public abstract void DeleteFileAttachment(FileAttachment attachment);
コード例 #6
0
ファイル: WikiManager.cs プロジェクト: Learion/BruceToolSet
 public static void DeleteFileAttachment(FileAttachment attachment)
 {
     Provider.DeleteFileAttachment(attachment);
 }
コード例 #7
0
ファイル: WikiManager.cs プロジェクト: Learion/BruceToolSet
 public static void UpdateFileAttachment(FileAttachment attachment)
 {
     Provider.UpdateFileAttachment(attachment);
 }