add orderyby search data list
This commit is contained in:
parent
806fadc24f
commit
e830632ac6
17 changed files with 3493 additions and 1239 deletions
|
|
@ -269,12 +269,12 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Supervised = x.ShortName,
|
||||
Telephone = x.Telephone,
|
||||
Address = x.Address + " " + (x.SubDistrictName == null ? "" : "แขวง" + x.SubDistrictName + " ") + (x.DistrictName == null ? "" : "เขต" + x.DistrictName) + " " + (x.ProvinceName == null ? "" : x.ProvinceName) + " " + (x.ZipCode == null ? "" : x.ZipCode),
|
||||
Divisions = x.CMSAgencys.Select(s => new HomePageLinkResponseItem
|
||||
Divisions = x.CMSAgencys.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
|
||||
{
|
||||
Title = s.Name,
|
||||
Url = s.Link,
|
||||
}).ToList(),
|
||||
Institutes = x.CMSGovernments.Select(s => new HomePageLinkResponseItem
|
||||
Institutes = x.CMSGovernments.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
|
||||
{
|
||||
Title = s.Name,
|
||||
Url = s.Link,
|
||||
|
|
@ -337,6 +337,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
.Where(x => x.AnnouncementStartDate <= DateTime.Now)
|
||||
.Where(x => x.AnnouncementEndDate >= DateTime.Now)
|
||||
.Include(x => x.PeriodExamImages)
|
||||
.OrderByDescending(x => x.AnnouncementStartDate)
|
||||
.Select(x => new CMSExamResponseItem
|
||||
{
|
||||
Id = x.Id.ToString(),
|
||||
|
|
@ -347,6 +348,55 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
Exam_date = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
|
||||
AnnouncementExam = x.AnnouncementExam,
|
||||
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
|
||||
Title = x.Name,
|
||||
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
|
||||
"" :
|
||||
x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault().Document.Id.ToString(),
|
||||
})
|
||||
.ToListAsync();
|
||||
if (limit > 0)
|
||||
periodExams = periodExams.Take(limit).ToList();
|
||||
|
||||
var i = 0;
|
||||
foreach (var item in periodExams)
|
||||
{
|
||||
if (periodExams[i].Image != null && periodExams[i].Image != "")
|
||||
periodExams[i].Image = _minioService.ImagesPath(Guid.Parse(periodExams[i].Image)).Result;
|
||||
i++;
|
||||
}
|
||||
|
||||
return periodExams;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<CMSExamResponseItem?>> GetsCMSPostsAsync(int limit)
|
||||
{
|
||||
var cms = await createCMS();
|
||||
|
||||
var periodExams = await _context.PeriodExams.AsQueryable()
|
||||
.Where(x => x.AnnouncementStartDate <= DateTime.Now)
|
||||
.Where(x => x.AnnouncementEndDate >= DateTime.Now)
|
||||
.OrderByDescending(x => x.AnnouncementStartDate)
|
||||
.Include(x => x.PeriodExamImages)
|
||||
.Select(x => new CMSExamResponseItem
|
||||
{
|
||||
Id = x.Id.ToString(),
|
||||
Category = "doctor",
|
||||
Category_id = "doctor",
|
||||
Start = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
End = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
Exam_date = x.ExamDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_date = x.AnnouncementStartDate.ToString("yyyy-MM-dd"),
|
||||
Announcement_endDate = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
|
||||
AnnouncementExam = x.AnnouncementExam,
|
||||
Register_startDate = x.RegisterStartDate.ToString("yyyy-MM-dd"),
|
||||
Register_endDate = x.RegisterEndDate.ToString("yyyy-MM-dd"),
|
||||
Payment_startDate = x.PaymentStartDate.ToString("yyyy-MM-dd"),
|
||||
Payment_endDate = x.PaymentEndDate.ToString("yyyy-MM-dd"),
|
||||
Title = x.Name,
|
||||
Image = x.PeriodExamImages.OrderBy(o => o.CreatedAt).FirstOrDefault() == null ?
|
||||
"" :
|
||||
|
|
@ -385,20 +435,21 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
End = x.AnnouncementEndDate.ToString("yyyy-MM-dd"),
|
||||
Title = x.Name,
|
||||
Detail = x.Detail,
|
||||
Images = x.PeriodExamImages.Select(s => new HomePageLinkResponseItem
|
||||
Images = x.PeriodExamImages.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
|
||||
{
|
||||
Title = s.Document.FileName,
|
||||
Url = s.Document.Id.ToString(),
|
||||
}).ToList(),
|
||||
Files = x.PeriodExamDocuments.Select(s => new HomePageLinkResponseItem
|
||||
Files = x.PeriodExamDocuments.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
|
||||
{
|
||||
Title = s.Document.FileName,
|
||||
Url = s.Document.Id.ToString(),
|
||||
}).ToList(),
|
||||
Positions = x.PositionExam.Select(s => new HomePageLinkResponseItem
|
||||
Positions = x.PositionExam.OrderBy(x => x.CreatedAt).Select(s => new HomePageLinkResponseItem
|
||||
{
|
||||
Title = s.Id.ToString(),
|
||||
Url = $"{Configuration.GetValue<string>("Domain")}/exam/{x.Id}/{s.Id}",
|
||||
Id = s.Id.ToString(),
|
||||
Title = s.PositionName == null ? x.Name : s.PositionName,
|
||||
Path = $"{x.Id}/{s.Id}",
|
||||
}).ToList(),
|
||||
})
|
||||
.FirstOrDefaultAsync();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue