/// <summary> /// get report history /// </summary> /// <param name="reportID"></param> /// <returns></returns> public IEnumerable <ReportListDto> GetReportListByReportID(string reportID) { List <ReportListDto> reportLists = new List <ReportListDto>(); var query = (from r in _dbContext.Set <ReportList>() join u in _dbContext.Set <User>() on r.Creater equals u.UniqueID into ru from ru1 in ru.DefaultIfEmpty() join u2 in _dbContext.Set <User>() on r.Mender equals u2.UniqueID into ru2 from ru3 in ru2.DefaultIfEmpty() where r.ReportID == reportID select new { UniqueID = r.UniqueID, WYS = r.WYS, WYG = r.WYG, IsPositive = r.IsPositive, Creater = ru1.LocalName, Mender = ru3.LocalName, OperationTime = r.OperationTime, Status = r.Status }).Distinct().OrderByDescending(c => c.OperationTime).ToList(); foreach (var r in query) { ReportListDto reportListDto = new ReportListDto { UniqueID = r.UniqueID, WYSText = ReportMapper.GetStrFromRTF(ReportMapper.GetStringFromBytes(r.WYS)), WYGText = ReportMapper.GetStrFromRTF(ReportMapper.GetStringFromBytes(r.WYG)), IsPositive = r.IsPositive, Creater = r.Creater, Mender = r.Mender, Status = r.Status, OperationTime = r.OperationTime }; reportLists.Add(reportListDto); } return(reportLists); }