/// <summary> /// 删除用户在应用中的数据 /// </summary> /// <param name="userId">用户Id</param> /// <param name="takeOverUserName">用于接管删除用户时不能删除的内容(例如:用户创建的群组)</param> /// <param name="isTakeOver">是否接管被删除用户可被接管的内容</param> protected override void DeleteUser(long userId, string takeOverUserName, bool isTakeOver) { BlogService blogService = new BlogService(); blogService.DeleteUser(userId, takeOverUserName, isTakeOver); }
/// <summary> /// 转换成BlogThread类型 /// </summary> /// <returns>日志实体</returns> public BlogThread AsBlogThread() { BlogThread blogThread = null; //写日志 if (this.ThreadId == 0) { blogThread = BlogThread.New(); blogThread.UserId = UserContext.CurrentUser.UserId; blogThread.Author = UserContext.CurrentUser.DisplayName; if (this.OwnerId.HasValue) { blogThread.OwnerId = this.OwnerId.Value; blogThread.TenantTypeId = TenantTypeIds.Instance().Group(); } else { blogThread.OwnerId = UserContext.CurrentUser.UserId; blogThread.TenantTypeId = TenantTypeIds.Instance().User(); } blogThread.OriginalAuthorId = UserContext.CurrentUser.UserId; } //编辑日志 else { BlogService blogService = new BlogService(); blogThread = blogService.Get(this.ThreadId).Clone(); blogThread.LastModified = DateTime.UtcNow; } blogThread.Subject = this.Subject; blogThread.Body = this.Body; blogThread.IsDraft = this.IsDraft; blogThread.IsSticky = this.IsSticky; blogThread.IsLocked = this.IsLocked; blogThread.PrivacyStatus = this.PrivacyStatus; blogThread.Keywords = this.Keywords; if (string.IsNullOrEmpty(blogThread.Keywords)) { string[] keywords = ClauseScrubber.TitleToKeywords(this.Subject); blogThread.Keywords = string.Join(" ", keywords); } blogThread.Summary = this.Summary; //if (string.IsNullOrEmpty(blogThread.Summary)) //{ blogThread.Summary = HtmlUtility.TrimHtml(this.Body, this.Body.Length).Substring(0, HtmlUtility.TrimHtml(this.Body, this.Body.Length).Length >= TextLengthSettings.TEXT_DESCRIPTION_MAXLENGTH ? TextLengthSettings.TEXT_DESCRIPTION_MAXLENGTH : HtmlUtility.TrimHtml(this.Body, this.Body.Length).Length); //} blogThread.FeaturedImageAttachmentId = this.FeaturedImageAttachmentId; if (blogThread.FeaturedImageAttachmentId > 0) { Attachment attachment = attachmentService.Get(blogThread.FeaturedImageAttachmentId); if (attachment != null) { blogThread.FeaturedImage = attachment.GetRelativePath() + "\\" + attachment.FileName; } else { blogThread.FeaturedImageAttachmentId = 0; } } else { blogThread.FeaturedImage = string.Empty; } return(blogThread); }