/// <summary> /// 转化为ImpeachReportEntity /// </summary> /// <returns>ImpeachReportEntity</returns> public ImpeachReportEntity AsReportEntity() { ImpeachReportEntity reportEntity = ImpeachReportEntity.New(); User user = DIContainer.Resolve <UserService>().GetFullUser(this.UserId); UserProfile profile = user != null?user.Profile:null; if (profile != null) //登陆用户 { reportEntity.Reporter = user.DisplayName; reportEntity.Email = profile.Email; reportEntity.Telephone = profile.Mobile; } else { reportEntity.Reporter = this.Reporter; reportEntity.Email = this.Email ?? string.Empty; reportEntity.Telephone = this.Telephone ?? string.Empty; } reportEntity.Reason = this.Reason; reportEntity.Description = this.Description; reportEntity.Url = this.Url ?? string.Empty; reportEntity.ReportedUserId = this.ReportedUserId; reportEntity.UserId = this.UserId; reportEntity.Title = this.Title ?? string.Empty; reportEntity.DateCreated = DateTime.UtcNow; reportEntity.LastModified = DateTime.UtcNow; return(reportEntity); }
/// <summary> /// 标记为已处理 /// </summary> /// <param name="reportId">要处理的举报Id</param> /// <param name="disposerId">处理人Id</param> /// <returns></returns> public void Dispose(long reportId, long disposerId) { ImpeachReportEntity report = impeachReportRepository.Get(reportId); if (report == null) { return; } report.Status = true; report.DisposerId = disposerId; report.LastModified = DateTime.UtcNow; impeachReportRepository.Update(report); }
/// <summary> /// 新建实体时使用 /// </summary> /// <param name="userId">举报人Id</param> /// <returns>用户举报实体</returns> public static ImpeachReportEntity New() { ImpeachReportEntity impeachReport = new ImpeachReportEntity() { ReportId = 0, UserId = 0, Reporter = string.Empty, ReportedUserId = 0, Email = string.Empty, Title = string.Empty, Telephone = string.Empty, Reason = 0, Description = string.Empty, Url = string.Empty, DateCreated = DateTime.UtcNow, LastModified = DateTime.UtcNow, Status = false, DisposerId = 0 }; return(impeachReport); }
/// <summary> /// 创建举报 /// </summary> /// <param name="report">要创建的举报实体</param> /// <returns></returns> public bool Create(ImpeachReportEntity report) { impeachReportRepository.Insert(report); return(report.ReportId > 0); }
/// <summary> /// 新建实体时使用 /// </summary> /// <param name="userId">举报人Id</param> /// <returns>用户举报实体</returns> public static ImpeachReportEntity New() { ImpeachReportEntity impeachReport = new ImpeachReportEntity() { ReportId = 0, UserId = 0, Reporter = string.Empty, ReportedUserId = 0, Email = string.Empty, Title = string.Empty, Telephone = string.Empty, Reason = 0, Description = string.Empty, Url = string.Empty, DateCreated = DateTime.UtcNow, LastModified = DateTime.UtcNow, Status = false, DisposerId = 0 }; return impeachReport; }