This commit is contained in:
2024-11-20 09:08:00 +08:00
parent f1abdbc6d0
commit 9300d77ab0
181 changed files with 28244 additions and 119 deletions
+69 -1
View File
@@ -389,7 +389,7 @@ namespace BLL
var getDataLists = (from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
join z in db.SitePerson_Person on x.TestManId equals z.PersonId
where x.ProjectId == projectId && x.TestStartTime.HasValue && x.TestEndTime.HasValue
where ((string.IsNullOrEmpty(projectId) && x.ProjectId == null) || (!string.IsNullOrEmpty(projectId) && x.ProjectId == projectId)) && x.TestStartTime.HasValue && x.TestEndTime.HasValue
orderby x.TestStartTime descending
select new Model.TestRecordItem
{
@@ -697,5 +697,73 @@ namespace BLL
return newTestRecord.TestRecordId;
}
#endregion
public static List<Model.TestRecordItem> getTrainingTestRecordListByDepartId(string unitId, string departId, string strPass, string strParam)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var getDataLists = (from x in db.Training_TestRecord
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
join z in db.Sys_User on x.TestManId equals z.UserId
where x.ProjectId == null && x.TestStartTime.HasValue && x.TestEndTime.HasValue
orderby x.TestStartTime descending
select new Model.TestRecordItem
{
TestRecordId = x.TestRecordId,
ProjectId = x.ProjectId,
TestPlanId = x.TestPlanId,
TestPlanName = y.PlanName,
UnitId = z.UnitId,
UnitName = getUnitName(z.UnitId),
WorkPostId = z.WorkPostId,
WorkPostName = db.Base_WorkPost.FirstOrDefault(p => p.WorkPostId == z.WorkPostId).WorkPostName,
DepartId = z.DepartId,
TestManId = x.TestManId,
TestManName = db.SitePerson_Person.FirstOrDefault(p => p.PersonId == x.TestManId).PersonName,
TestStartTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime),
TestEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestEndTime),
Duration = x.Duration,
TestPlanEndTime = string.Format("{0:yyyy-MM-dd HH:mm}", x.TestStartTime.Value.AddMinutes(x.Duration)),
TotalScore = y.TotalScore ?? 0,
TestScores = x.TestScores ?? 0,
TestType = x.TestType,
TemporaryUser = x.TemporaryUser,
});
if (!string.IsNullOrEmpty(unitId))
{
getDataLists = getDataLists.Where(x => x.UnitId == unitId);
}
if (!string.IsNullOrEmpty(departId))
{
getDataLists = getDataLists.Where(x => x.DepartId == departId);
}
if (!string.IsNullOrEmpty(strParam))
{
getDataLists = getDataLists.Where(x => x.TestManName.Contains(strParam));
}
if (!string.IsNullOrEmpty(strPass))
{
int PassingScore = SysConstSetService.getPassScoreForApi();
if (strPass == "0")
{
getDataLists = getDataLists.Where(x => x.TestScores < PassingScore);
}
else
{
getDataLists = getDataLists.Where(x => x.TestScores >= PassingScore);
}
}
foreach (var item in getDataLists)
{
var depart = db.Base_Depart.FirstOrDefault(x => x.DepartId == item.DepartId);
if (depart != null)
{
item.DepartName = depart.DepartName;
}
}
return getDataLists.ToList();
}
}
}
}