using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.CommonLogic.SystemServices;
namespace EMIS.ExtensionLogic.ServiceLogic.GraduationManage
{
public class GraduationApplyServices : EMIS.CommonLogic.GraduationManage.GraduationManage.GraduationApplyServices
{
///
/// 流水号生成Services
///
public Lazy SerialNumberServices { get; set; }
///
/// 结业
/// 注:结业通过需对结业证书编号进行生成(东莞理工学院)
/// 生成规则:学校代码+办学类型Value(1位)+毕业年份+培养层次类型Code(2位)+6位流水号
/// 例如:学校代码+成人高等继续教育+毕业年份+专科或本科+6位流水号,11819+2+2016+05或06+000001
///
///
public override void GraduationApplyCompletion(List graduationApplyIDList)
{
//更新毕业申请信息、学生信息
base.GraduationApplyCompletion(graduationApplyIDList);
//查询对应的毕业申请信息List
var graduationApplyList = GraduationApplyDAL.GraduationApplyRepository
.GetList(x => graduationApplyIDList.Contains(x.GraduationApplyID), (x => x.CF_Student)).ToList();
//查询对应的毕业申请信息ViewList
var graduationApplyViewList = GraduationApplyDAL
.GetGraduationApplyViewQueryable(x => graduationApplyIDList.Contains(x.GraduationApplyID)).ToList();
//更新对应的学生信息(结业证书编号)
foreach (var graduationApply in graduationApplyList)
{
//查询对应的毕业申请信息View
var graduationApplyView = graduationApplyViewList
.Where(x => x.GraduationApplyID == graduationApply.GraduationApplyID).SingleOrDefault();
//结业证书编号生成(学校代码+办学类型Value(1位)+毕业年份+培养层次类型Code(2位)+6位流水号)
var graduateCardNoPrefix = string.Format("{0}{1}{2}{3}", graduationApplyView.UniversityCode,
graduationApplyView.SchoolTypeID ?? null,
graduationApplyView.GraduationYear ?? null,
graduationApplyView.EducationCode ?? null);
graduationApply.CF_Student.GraduateCardNo = SerialNumberServices.Value.SetSN(graduateCardNoPrefix, 6);
this.SetModifyStatus(graduationApply.CF_Student);
}
var updateStudentList = graduationApplyList.Select(x => x.CF_Student).ToList();
this.UnitOfWork.BatchUpdate(updateStudentList);
}
}
}