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();
            }
        }
        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;
            }
        }
        public override void DeleteFileAttachment(FileAttachment attachment)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                FileAttachmentDataStore dataStore = new FileAttachmentDataStore(transaction);

                dataStore.Delete(attachment.Id);

                transaction.Commit();
            }
        }
Exemple #4
0
 public abstract void UpdateFileAttachment(FileAttachment attachment);
Exemple #5
0
 public abstract void DeleteFileAttachment(FileAttachment attachment);
Exemple #6
0
 public static void DeleteFileAttachment(FileAttachment attachment)
 {
     Provider.DeleteFileAttachment(attachment);
 }
Exemple #7
0
 public static void UpdateFileAttachment(FileAttachment attachment)
 {
     Provider.UpdateFileAttachment(attachment);
 }