เพิ่มapi dashboard exam
This commit is contained in:
parent
ac3d2c9d26
commit
eb567349b4
10 changed files with 1956 additions and 261 deletions
|
|
@ -53,7 +53,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
{
|
||||
return await _context.PeriodExams.AsQueryable()
|
||||
.Where(p => p.IsActive)
|
||||
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == false : p.AnnouncementExam == true))
|
||||
.Where(p => type.ToUpper() == "ALL" ? (p.AnnouncementExam == true || p.AnnouncementExam == false) : (type.ToUpper() == "EXAM" ? p.AnnouncementExam == true : p.AnnouncementExam == false))
|
||||
.OrderByDescending(d => d.CreatedAt)
|
||||
.Select(x => new PeriodExamCandidateResponseItem
|
||||
{
|
||||
|
|
@ -757,6 +757,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
ExamIdenNumber = worksheet.Cells[row, 2].Value != null ? worksheet.Cells[row, 2].Value.ToString() : "-",
|
||||
SeatNumber = worksheet.Cells[row, 3].Value != null ? worksheet.Cells[row, 3].Value.ToString() : "-",
|
||||
Point = worksheet.Cells[row, 4].Value != null ? worksheet.Cells[row, 4].Value.ToString() : "-",
|
||||
Pass = worksheet.Cells[row, 4].Value != null ? (worksheet.Cells[row, 4].Value.ToString() == "1" ? true : false) : null,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -830,6 +831,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
if (candidate.Status == "checkPoint" || candidate.Status == "done")
|
||||
{
|
||||
candidate.Point = item.Point;
|
||||
candidate.Pass = item.Pass;
|
||||
candidate.Status = "done";
|
||||
}
|
||||
else
|
||||
|
|
@ -884,6 +886,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[1, 2].Value = "เลขประจำตัวสอบ";
|
||||
summarySheet.Cells[1, 3].Value = "เลขที่นั่งสอบ";
|
||||
summarySheet.Cells[1, 4].Value = "คะแนน";
|
||||
summarySheet.Cells[1, 5].Value = "ผลการสอบ";
|
||||
int row = 2;
|
||||
|
||||
foreach (var item in candidates)
|
||||
|
|
@ -892,6 +895,7 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
summarySheet.Cells[row, 2].Value = item.ExamIdenNumber;
|
||||
summarySheet.Cells[row, 3].Value = item.SeatNumber;
|
||||
summarySheet.Cells[row, 4].Value = item.Point;
|
||||
summarySheet.Cells[row, 5].Value = item.Pass;
|
||||
row++;
|
||||
}
|
||||
summarySheet.Cells[summarySheet.Dimension.Address].AutoFitColumns();
|
||||
|
|
@ -919,6 +923,83 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
|||
|
||||
return periodExam;
|
||||
}
|
||||
|
||||
public async Task<List<DashboardResponseItem>> GetsDashboardPaymentExamAsync(string examId)
|
||||
{
|
||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||
.Include(x => x.Candidate)
|
||||
.Where(x => x.Id == Guid.Parse(examId))
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
if (periodExam == null)
|
||||
throw new Exception(GlobalMessages.ExamNotFound);
|
||||
|
||||
var dashboard = new List<DashboardResponseItem>
|
||||
{
|
||||
new DashboardResponseItem
|
||||
{
|
||||
Id = 1,
|
||||
Name = "ผู้สมัครสอบ",
|
||||
Count = periodExam.Candidate.Count()
|
||||
},
|
||||
new DashboardResponseItem
|
||||
{
|
||||
Id = 2,
|
||||
Name = "ผ่านการสอบ",
|
||||
Count = periodExam.Candidate.Where(x=>x.Pass == true).Count()
|
||||
},
|
||||
new DashboardResponseItem
|
||||
{
|
||||
Id = 3,
|
||||
Name = "ไม่ผ่านการสอบ",
|
||||
Count = periodExam.Candidate.Where(x=>x.Pass == false).Count()
|
||||
},
|
||||
new DashboardResponseItem
|
||||
{
|
||||
Id = 4,
|
||||
Name = "เพศชาย",
|
||||
Count = periodExam.Candidate.Where(x=>x.PrefixName != null && x.PrefixName.Contains("ชาย")).Count()
|
||||
},
|
||||
new DashboardResponseItem
|
||||
{
|
||||
Id = 5,
|
||||
Name = "เพศหญิง",
|
||||
Count = periodExam.Candidate.Where(x=>x.PrefixName != null && x.PrefixName.Contains("หญิง")).Count()
|
||||
},
|
||||
new DashboardResponseItem
|
||||
{
|
||||
Id = 6,
|
||||
Name = "เพศอื่นๆ",
|
||||
Count = periodExam.Candidate.Count() -periodExam.Candidate.Where(x=>x.PrefixName != null && x.PrefixName.Contains("ชาย")).Count()-periodExam.Candidate.Where(x=>x.PrefixName != null && x.PrefixName.Contains("หญิง")).Count()
|
||||
},
|
||||
// new DashboardResponseItem
|
||||
// {
|
||||
// Id = 7,
|
||||
// Name = "จังหวัด",
|
||||
// Count = provinceItem.ProvinceCount
|
||||
// },
|
||||
// new DashboardResponseItem
|
||||
// {
|
||||
// Id = 8,
|
||||
// Name = "เขต/อำเภอ",
|
||||
// Count = provinceItem.DistrictCount
|
||||
// },
|
||||
// new DashboardResponseItem
|
||||
// {
|
||||
// Id = 9,
|
||||
// Name = "แขวง/ตำบล",
|
||||
// Count = provinceItem.SubDistrictCount
|
||||
// },
|
||||
// new DashboardResponseItem
|
||||
// {
|
||||
// Id = 10,
|
||||
// Name = "รหัสไปรษณีย์",
|
||||
// Count = provinceItem.ZipCodeCount
|
||||
// },
|
||||
};
|
||||
|
||||
return dashboard;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue