90 lines
3.4 KiB
C#
90 lines
3.4 KiB
C#
|
|
using FineUIPro;
|
||
|
|
using System;
|
||
|
|
using System.Collections;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
namespace BLL
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 人员培训考试记录。
|
||
|
|
/// 该服务只保留人员档案和现场人员接口仍使用的查询能力。
|
||
|
|
/// </summary>
|
||
|
|
public static class Person_TrainingTestRecordService
|
||
|
|
{
|
||
|
|
/// <summary>
|
||
|
|
/// 查询结果总数。
|
||
|
|
/// </summary>
|
||
|
|
public static int count
|
||
|
|
{
|
||
|
|
get;
|
||
|
|
set;
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 获取人员培训考试记录分页数据。
|
||
|
|
/// </summary>
|
||
|
|
public static IEnumerable getListData(string personId, Grid grid)
|
||
|
|
{
|
||
|
|
var db = Funs.DB;
|
||
|
|
IQueryable<Model.Training_TestRecord> records = from x in db.Training_TestRecord
|
||
|
|
where x.TestStartTime.HasValue
|
||
|
|
&& x.TestManId == personId
|
||
|
|
select x;
|
||
|
|
count = records.Count();
|
||
|
|
if (count == 0)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
|
||
|
|
records = SortConditionHelper.SortingAndPaging(records, grid.SortField, grid.SortDirection, grid.PageIndex, grid.PageSize);
|
||
|
|
return from x in records
|
||
|
|
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||
|
|
join z in db.Training_Plan on y.PlanId equals z.PlanId into planGroup
|
||
|
|
from z in planGroup.DefaultIfEmpty()
|
||
|
|
select new
|
||
|
|
{
|
||
|
|
x.TestRecordId,
|
||
|
|
x.TestPlanId,
|
||
|
|
x.ProjectId,
|
||
|
|
db.Base_Project.First(p => p.ProjectId == x.ProjectId).ProjectName,
|
||
|
|
y.PlanName,
|
||
|
|
y.PlanCode,
|
||
|
|
y.TestPalce,
|
||
|
|
y.PlanDate,
|
||
|
|
x.TestStartTime,
|
||
|
|
x.TestEndTime,
|
||
|
|
x.TestScores,
|
||
|
|
z.TrainTypeId,
|
||
|
|
db.Base_TrainType.First(u => u.TrainTypeId == z.TrainTypeId).TrainTypeName,
|
||
|
|
z.TrainStartDate,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 根据主键获取人员培训考试记录。
|
||
|
|
/// </summary>
|
||
|
|
public static Model.Training_TestRecord GetTestRecordById(string testRecordId)
|
||
|
|
{
|
||
|
|
return Funs.DB.Training_TestRecord.FirstOrDefault(e => e.TestRecordId == testRecordId);
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// 根据人员和入场时间获取入场教育合格记录。
|
||
|
|
/// </summary>
|
||
|
|
public static Model.Training_TestRecord GetOKTestRecordByPersonIdAndDate(string testManId, DateTime? date)
|
||
|
|
{
|
||
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||
|
|
{
|
||
|
|
return (from x in db.Training_TestRecord
|
||
|
|
join y in db.Training_TestPlan on x.TestPlanId equals y.TestPlanId
|
||
|
|
join z in db.Training_Plan on y.PlanId equals z.PlanId
|
||
|
|
where x.TestManId == testManId
|
||
|
|
&& x.TestStartTime >= date
|
||
|
|
&& x.TestScores >= 60
|
||
|
|
&& z.TrainTypeId == Const.EntryEducationTrainTypeId
|
||
|
|
select x).FirstOrDefault();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|