ปรับ response นาน

This commit is contained in:
Bright 2025-09-23 11:53:54 +07:00
parent 6f36f71f60
commit 9ce6c503c3

View file

@ -2050,43 +2050,58 @@ namespace BMA.EHR.Recruit.Service.Controllers
// 3⃣ ดึงสรุปคะแนน (sum_exam_info)
// ---------------------------
dynamic header = null;
using (var cmd = _context.Database.GetDbConnection().CreateCommand())
if (data.Count == 0)
{
cmd.CommandTimeout = 0;
var sb = new StringBuilder();
cmd.Parameters.Clear();
sb.Append(" SELECT count, pass, notpass, missed_exam, other FROM sum_exam_info WHERE recruit_import_id = @id ");
cmd.Parameters.Add(p_Id);
cmd.CommandText = sb.ToString();
_context.Database.OpenConnection();
using (var reader = cmd.ExecuteReader())
header = new
{
if (!reader.HasRows)
count = 0,
pass = 0,
notpass = 0,
missed_exam = 0,
other = 0
};
}
else
{
using (var cmd = _context.Database.GetDbConnection().CreateCommand())
{
cmd.CommandTimeout = 0;
var sb = new StringBuilder();
cmd.Parameters.Clear();
sb.Append(" SELECT count, pass, notpass, missed_exam, other FROM sum_exam_info WHERE recruit_import_id = @id ");
cmd.Parameters.Add(p_Id);
cmd.CommandText = sb.ToString();
_context.Database.OpenConnection();
using (var reader = cmd.ExecuteReader())
{
header = new
if (!reader.HasRows)
{
count = 0,
pass = 0,
notpass = 0,
missed_exam = 0,
other = 0
};
}
else
{
reader.Read();
header = new
header = new
{
count = 0,
pass = 0,
notpass = 0,
missed_exam = 0,
other = 0
};
}
else
{
count = reader["count"].ToString().ToInteger(),
pass = reader["pass"].ToString().ToInteger(),
notpass = reader["notpass"].ToString().ToInteger(),
missed_exam = reader["missed_exam"].ToString().ToInteger(),
other = reader["other"].ToString().ToInteger()
};
reader.Read();
header = new
{
count = reader["count"].ToString().ToInteger(),
pass = reader["pass"].ToString().ToInteger(),
notpass = reader["notpass"].ToString().ToInteger(),
missed_exam = reader["missed_exam"].ToString().ToInteger(),
other = reader["other"].ToString().ToInteger()
};
}
}
}
}
// ---------------------------
// 4⃣ ดึง period