Beispiel #1
0
 public virtual void DeleteImgOne(ContentImg articleImg)
 {
     db.delete(articleImg);
     Img.DeleteImgAndThumb(strUtil.Join(sys.Path.DiskPhoto, articleImg.ImgUrl));
     if (articleImg.ImgUrl.Equals(articleImg.Post.ImgLink))
     {
         this.setPreImgLogo(articleImg);
     }
 }
Beispiel #2
0
        public virtual void DeleteByPost(int postId)
        {
            List <Attachment> attachments = this.GetByPost(postId);

            foreach (Attachment attachment in attachments)
            {
                Img.DeleteImgAndThumb(attachment.FileUrl);
            }
            Attachment.deleteBatch("PostId=" + postId);
        }
Beispiel #3
0
        public virtual void DeleteByPost(long postId)
        {
            List <ContentAttachment> attachments = this.GetAttachmentsByPost(postId);

            foreach (ContentAttachment attachment in attachments)
            {
                Img.DeleteImgAndThumb(attachment.FileUrl);
            }
            ContentAttachment.deleteBatch("PostId=" + postId);
        }
Beispiel #4
0
        public virtual void DeleteTempAttachment(int id)
        {
            AttachmentTemp at = AttachmentTemp.findById(id);

            if (at == null)
            {
                return;
            }

            at.delete();

            Img.DeleteImgAndThumb(at.FileUrl);
        }
Beispiel #5
0
        public virtual void UpdateFile(ContentAttachment a, String oldFilePath)
        {
            a.update();

            if (a.IsImage)
            {
                Img.DeleteImgAndThumb(oldFilePath);
            }
            else
            {
                Img.DeleteFile(oldFilePath);
            }
        }
Beispiel #6
0
        //--------------------------------------------------------------------------------------------------------------

        public virtual void Delete(int id)
        {
            Attachment at = Attachment.findById(id);

            if (at == null)
            {
                return;
            }

            at.delete();
            Img.DeleteImgAndThumb(at.FileUrl);

            // 重新统计所属主题的附件数
            refreshTopicCount(at);
        }
Beispiel #7
0
        //--------------------------------------------------------------------------------------------------------------

        public virtual void Delete(long id)
        {
            ContentAttachment at = ContentAttachment.findById(id);

            if (at == null)
            {
                return;
            }

            at.delete();
            Img.DeleteImgAndThumb(strUtil.Join(sys.Path.DiskPhoto, at.Name));

            // 重新统计所属主题的附件数
            refreshAttachmentCount(at);
        }
Beispiel #8
0
        public virtual void UpdateFile(User user, Attachment a, String oldFilePath)
        {
            a.Created = DateTime.Now;
            a.update();

            if (a.IsImage)
            {
                Img.DeleteImgAndThumb(oldFilePath);
            }
            else
            {
                Img.DeleteFile(oldFilePath);
            }

            ForumTopicService topicService = new ForumTopicService();
            ForumPost         post         = ForumPost.findById(a.PostId);

            topicService.UpdateLastEditInfo(user, post);
        }
Beispiel #9
0
        public virtual Result DeleteTempFile(int id)
        {
            TempUploadFile tfile = TempUploadFile.findById(id);

            if (tfile == null)
            {
                return(new Result("file not found"));
            }

            try {
                tfile.delete();

                Img.DeleteImgAndThumb(tfile.FileUrl);

                return(new Result());
            }

            catch (Exception ex) {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);

                return(new Result(ex.Message));
            }
        }