Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 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();
            }
        }
Ejemplo n.º 4
0
 public abstract void UpdateFileAttachment(FileAttachment attachment);
Ejemplo n.º 5
0
 public abstract void DeleteFileAttachment(FileAttachment attachment);
Ejemplo n.º 6
0
 public static void DeleteFileAttachment(FileAttachment attachment)
 {
     Provider.DeleteFileAttachment(attachment);
 }
Ejemplo n.º 7
0
 public static void UpdateFileAttachment(FileAttachment attachment)
 {
     Provider.UpdateFileAttachment(attachment);
 }