提交代码
This commit is contained in:
@@ -616,5 +616,116 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 扫码获取培训记录
|
||||
/// <summary>
|
||||
/// 培训记录主表实体类
|
||||
/// </summary>
|
||||
public class EduTrainRecord {
|
||||
public string TrainTitle { get; set; }
|
||||
public string UnitsName { get; set; }
|
||||
public string TrainType { get; set; }
|
||||
public string TrainStartDate { get; set; }
|
||||
public string TeachHour { get; set; }
|
||||
public string TrainContent { get; set; }
|
||||
public List<EduTrain_TrainRecordDetailDto> ChildList { get; set; }
|
||||
}
|
||||
public class EduTrain_TrainRecordDetailDto {
|
||||
public string PersonName { get; set; }
|
||||
public string IdCard { get; set; }
|
||||
public string CheckScore { get; set; }
|
||||
public string CheckResult { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫码获取培训记录
|
||||
/// </summary>
|
||||
/// <param name="TrainingId"></param>
|
||||
/// <returns></returns>
|
||||
public static EduTrainRecord getTestRecordByTestRecordIdQrCode(string TrainingId)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = from x in db.EduTrain_TrainRecord
|
||||
where x.TrainingId == TrainingId
|
||||
select new EduTrainRecord
|
||||
{
|
||||
TrainTitle=x.TrainTitle,
|
||||
UnitsName= getUnitNameByUnitids(x.UnitIds),
|
||||
TrainType= getTrainTypeNameByTrainTypeId(x.TrainTypeId),
|
||||
TrainStartDate = string.Format("{0:yyyy-MM-dd}", x.TrainStartDate),
|
||||
TeachHour=x.TeachHour.ToString(),
|
||||
TrainContent=x.TrainContent,
|
||||
ChildList=getChildEduTrainChild(x.TrainingId)
|
||||
};
|
||||
return getDataLists.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据单位id获取单位名称
|
||||
/// </summary>
|
||||
/// <param name="unitId"></param>
|
||||
/// <returns></returns>
|
||||
private static string getUnitNameByUnitids(string unitId) {
|
||||
if (!string.IsNullOrEmpty(unitId))
|
||||
{
|
||||
string unitNames = string.Empty;
|
||||
string[] unitIds = unitId.Split(',');
|
||||
foreach (var item in unitIds)
|
||||
{
|
||||
Model.Base_Unit unit = BLL.UnitService.GetUnitByUnitId(item);
|
||||
if (unit != null)
|
||||
{
|
||||
unitNames += unit.UnitName + ",";
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(unitNames))
|
||||
{
|
||||
unitNames = unitNames.Substring(0, unitNames.LastIndexOf(","));
|
||||
}
|
||||
return unitNames;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static string getPerIdCardByPersonId(string personId) {
|
||||
var pmodel = Funs.DB.SitePerson_Person.FirstOrDefault(x => x.PersonId == personId);
|
||||
if (pmodel != null)
|
||||
{
|
||||
return pmodel.IdentityCard;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static string getTrainTypeNameByTrainTypeId(string TrainTypeId) {
|
||||
if (!string.IsNullOrEmpty(TrainTypeId))
|
||||
{
|
||||
return BLL.TrainTypeService.GetTrainTypeById(TrainTypeId).TrainTypeName;
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
private static List<EduTrain_TrainRecordDetailDto> getChildEduTrainChild(string TrainingId) {
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = from x in db.View_EduTrain_TrainRecordDetail
|
||||
where x.TrainingId == TrainingId
|
||||
select new EduTrain_TrainRecordDetailDto
|
||||
{
|
||||
PersonName=x.PersonName,
|
||||
IdCard= getPerIdCardByPersonId(x.PersonId),
|
||||
CheckScore=x.CheckScore.ToString(),
|
||||
CheckResult=x.CheckResult==true?"合格":"不合格"
|
||||
|
||||
};
|
||||
return getDataLists.ToList();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user