ใช้ Math.Round

This commit is contained in:
Bright 2025-09-04 16:30:15 +07:00
parent 9794c018c3
commit 8f85d92a9c

View file

@ -1414,23 +1414,22 @@ namespace BMA.EHR.Recruit.Service.Controllers
// ภาคความรู้ความสามารถที่ใช้เฉพาะตำแหน่ง
r.FullA = 200;
r.SumA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 5]?.GetValue<double>();
r.PercentageA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 6]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 6]?.GetValue<double>();
r.SumA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 5].GetValue<double>(), 2);
r.PercentageA = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 6]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 6].GetValue<double>(), 2);
r.AStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
r.SumAB = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 5]?.GetValue<double>();
r.SumAB = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 5]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 5].GetValue<double>(), 2);
r.ABStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 7]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 7]?.GetValue<string>();
// ภาคความเหมาะสมกับตำแหน่ง
r.FullC = 50;
r.SumC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 8]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 8]?.GetValue<double>();
r.SumC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 8]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 8].GetValue<double>(), 2);
r.FullD = 50;
r.SumD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 9]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 9]?.GetValue<double>();
r.SumCD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 10]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 10]?.GetValue<double>();
r.PercentageC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 11]?.GetValue<double>();
r.SumD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 9]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 9].GetValue<double>(), 2);
r.SumCD = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 10]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 10].GetValue<double>(), 2);
r.PercentageC = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 11]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 11].GetValue<double>(), 2);
r.CStatus = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 12]?.GetValue<string>()) ? "" : workSheet?.Cells[row, 12]?.GetValue<string>();
r.FullScore = 300;
r.TotalScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 13]?.GetValue<string>()) ? 0.00 : (double)workSheet?.Cells[row, 13]?.GetValue<double>(); ;
r.TotalScore = string.IsNullOrWhiteSpace(workSheet?.Cells[row, 13]?.GetValue<string>()) ? 0.00 : Math.Round(workSheet.Cells[row, 13].GetValue<double>(), 2);
if (workSheet?.Cells[row, 7]?.GetValue<string>() == "ขาดสอบ")
{