using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace EMIS.ExtensionLogic.ServiceLogic.GraduationManage
{
public class GraduationApplyServices : EMIS.CommonLogic.GraduationManage.GraduationManage.GraduationApplyServices
{
///
/// 结业
/// 注:结业通过需对结业证书编号进行生成(广东松山职业技术学院)
/// 生成规则:学校代码+办学类型Value(1位)+毕业年份+培养层次Value(2位)+6位流水号(学号的后6位)
/// 例如:学校代码+普通高等教育+毕业年份+专科+6位流水号(学号的后6位),12060+1+2017+06+101116
///
///
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位)+毕业年份+培养层次Value(2位)+6位流水号(学号的后6位))
var graduateCardNo = string.Format("{0}{1}{2}{3}{4}", graduationApplyView.UniversityCode,
graduationApplyView.SchoolTypeID ?? null,
graduationApplyView.GraduationYear ?? null,
graduationApplyView.EducationCode ?? null,
graduationApplyView.StudentNo.Substring(graduationApplyView.StudentNo.Length - 6, 6));
graduationApply.CF_Student.GraduateCardNo = graduateCardNo;
this.SetModifyStatus(graduationApply.CF_Student);
}
var updateStudentList = graduationApplyList.Select(x => x.CF_Student).ToList();
this.UnitOfWork.BatchUpdate(updateStudentList);
}
}
}