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); } }
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); }
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); }
public virtual void DeleteTempAttachment(int id) { AttachmentTemp at = AttachmentTemp.findById(id); if (at == null) { return; } at.delete(); Img.DeleteImgAndThumb(at.FileUrl); }
public virtual void UpdateFile(ContentAttachment a, String oldFilePath) { a.update(); if (a.IsImage) { Img.DeleteImgAndThumb(oldFilePath); } else { Img.DeleteFile(oldFilePath); } }
//-------------------------------------------------------------------------------------------------------------- public virtual void Delete(int id) { Attachment at = Attachment.findById(id); if (at == null) { return; } at.delete(); Img.DeleteImgAndThumb(at.FileUrl); // 重新统计所属主题的附件数 refreshTopicCount(at); }
//-------------------------------------------------------------------------------------------------------------- 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); }
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); }
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)); } }