|
|
@@ -1,4 +1,5 @@ |
|
|
|
using Dapper; |
|
|
|
using Learun.Application.Organization; |
|
|
|
using Learun.DataBase.Repository; |
|
|
|
using Learun.Util; |
|
|
|
using System; |
|
|
@@ -326,6 +327,348 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 修改教师和成绩 |
|
|
|
/// </summary> |
|
|
|
/// <param name="keyValue"></param> |
|
|
|
/// <param name="EmpNo"></param> |
|
|
|
public string UpSetTeach(string keyValue, string EmpNo) |
|
|
|
{ |
|
|
|
string Result = ""; |
|
|
|
var db = BaseRepository("CollegeMIS").BeginTrans(); |
|
|
|
try |
|
|
|
{ |
|
|
|
#region 获取班级开课计划的数据 |
|
|
|
var IdList = keyValue.Split(','); |
|
|
|
var TeachClassList = BaseRepository("CollegeMIS").FindList<TeachClassEntity>(x => IdList.Contains(x.ID.ToString())).ToList(); |
|
|
|
foreach (var item in IdList)//修改TeachClass表 |
|
|
|
{ |
|
|
|
var entityList = GetTeachClassEntity(item); |
|
|
|
entityList.EmpNo = EmpNo; |
|
|
|
db.Update(entityList); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
List<StuSelectLessonListEntity> stuLessonList = new List<StuSelectLessonListEntity>(); |
|
|
|
for (int i = 0; i < TeachClassList.Count; i++) |
|
|
|
{ |
|
|
|
var LessonData = db.FindList<LessonInfoEntity>().Where(x => x.LessonNo == TeachClassList[i].LessonNo).FirstOrDefault(); |
|
|
|
|
|
|
|
var stuDataList = db.FindList<StuInfoBasicEntity>().Where(s => |
|
|
|
s.DeptNo == TeachClassList[i].DeptNo && s.MajorNo == TeachClassList[i].MajorNo && |
|
|
|
s.F_SchoolId == TeachClassList[i].F_SchoolId && |
|
|
|
s.ClassNo == TeachClassList[i].TeachClassNo && s.CheckMark == "1"); |
|
|
|
var DeleteStuSelectLesson = db.FindList<StuSelectLessonListEntity>().Where( |
|
|
|
x => x.AcademicYearNo == TeachClassList[i].AcademicYearNo && |
|
|
|
x.LessonNo == TeachClassList[i].LessonNo && |
|
|
|
x.Semester == TeachClassList[i].Semester && |
|
|
|
x.F_SchoolId == TeachClassList[i].F_SchoolId && |
|
|
|
x.DeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.MajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.ClassNo == TeachClassList[i].TeachClassNo && |
|
|
|
x.Grade == TeachClassList[i].Grade && |
|
|
|
x.OpenLessonDeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.OpenLessonMajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.LessonSortNo == "1").ToList(); |
|
|
|
if (DeleteStuSelectLesson.Count > 0) |
|
|
|
{ |
|
|
|
db.Delete(DeleteStuSelectLesson); |
|
|
|
} |
|
|
|
if (stuDataList != null) |
|
|
|
{ |
|
|
|
#region 修改StuSelectLessonList表 |
|
|
|
|
|
|
|
foreach (var item in stuDataList) |
|
|
|
{ |
|
|
|
var StuSelectLessonEntity = new StuSelectLessonListEntity |
|
|
|
{ |
|
|
|
StuNo = item.StuNo, |
|
|
|
DeptNo = TeachClassList[i].DeptNo, |
|
|
|
MajorNo = TeachClassList[i].MajorNo, |
|
|
|
ClassNo = item.ClassNo, |
|
|
|
GenderNo = item.GenderNo == true ? "0" : "1", |
|
|
|
MajorDetailNo = TeachClassList[i].MajorDetailNo, |
|
|
|
MajorDetailName = TeachClassList[i].MajorDetailName, |
|
|
|
StuName = item.StuName, |
|
|
|
AcademicYearNo = TeachClassList[i].AcademicYearNo, |
|
|
|
Semester = TeachClassList[i].Semester, |
|
|
|
OpenLessonDeptNo = TeachClassList[i].DeptNo, |
|
|
|
OpenLessonMajorNo = TeachClassList[i].MajorNo, |
|
|
|
LessonNo = TeachClassList[i].LessonNo, |
|
|
|
LessonName = LessonData.LessonName, |
|
|
|
PartCode = TeachClassList[i].PartCode, |
|
|
|
OrdinaryScoreScale = 0, |
|
|
|
TermInScoreScale = 0, |
|
|
|
TermEndScoreScale = 0, |
|
|
|
OtherScoreScale = 0, |
|
|
|
TeachClassNo = TeachClassList[i].TeachClassNo, |
|
|
|
LessonSortNo = TeachClassList[i].LessonSortNo, |
|
|
|
StuSortNo = TeachClassList[i].LessonSortNo, |
|
|
|
Grade = item.Grade, |
|
|
|
StudyScore = 2, |
|
|
|
TotalStudyHour = 2, |
|
|
|
IsInEffect = "1", |
|
|
|
IsPitchOn = "1", |
|
|
|
F_SchoolId = TeachClassList[i].F_SchoolId, |
|
|
|
CheckMark = "1", |
|
|
|
InsertTime = DateTime.Now |
|
|
|
}; |
|
|
|
stuLessonList.Add(StuSelectLessonEntity); |
|
|
|
db.Insert(StuSelectLessonEntity); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
var ScoreList = db.FindList<StuScoreEntity>().Where(x => x.AcademicYearNo == TeachClassList[i].AcademicYearNo && x.Semester == TeachClassList[i].Semester && x.DeptNo == TeachClassList[i].DeptNo && x.MajorNo == TeachClassList[i].MajorNo && x.ClassNo == TeachClassList[i].TeachClassNo && x.LessonSortNo == TeachClassList[i].LessonSortNo && x.LessonNo == TeachClassList[i].LessonNo); |
|
|
|
var DeleteStuScore = db.FindList<StuScoreEntity>().Where( |
|
|
|
x => x.AcademicYearNo == TeachClassList[i].AcademicYearNo && |
|
|
|
x.LessonNo == TeachClassList[i].LessonNo && |
|
|
|
x.Semester == TeachClassList[i].Semester && |
|
|
|
x.F_SchoolId == TeachClassList[i].F_SchoolId && |
|
|
|
x.DeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.MajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.ClassNo == TeachClassList[i].TeachClassNo && |
|
|
|
x.Grade == TeachClassList[i].Grade && |
|
|
|
x.OpenLessonDeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.OpenLessonMajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.LessonSortNo == "1" && x.CheckMark == "1").ToList(); |
|
|
|
if (DeleteStuScore.Count > 0) |
|
|
|
{ |
|
|
|
return Result = "成绩已审核不可设置教师"; |
|
|
|
} |
|
|
|
db.Delete(DeleteStuScore); |
|
|
|
|
|
|
|
|
|
|
|
if (ScoreList != null) |
|
|
|
{ |
|
|
|
#region 添加StuScore表 |
|
|
|
foreach (var item in stuDataList) |
|
|
|
{ |
|
|
|
var stuScoreEntity = new StuScoreEntity |
|
|
|
{ |
|
|
|
StuNo = item.StuNo, |
|
|
|
DeptNo = item.DeptNo, |
|
|
|
MajorNo = item.MajorNo, |
|
|
|
ClassNo = item.ClassNo, |
|
|
|
StuName = item.StuName, |
|
|
|
EmpNo = EmpNo, |
|
|
|
GenderNo = item.GenderNo == true ? "0" : "1", |
|
|
|
AcademicYearNo = TeachClassList[i].AcademicYearNo, |
|
|
|
Semester = TeachClassList[i].Semester, |
|
|
|
OpenLessonDeptNo = TeachClassList[i].DeptNo, |
|
|
|
OpenLessonMajorNo = TeachClassList[i].MajorNo, |
|
|
|
LessonNo = TeachClassList[i].LessonNo, |
|
|
|
LessonName = LessonData.LessonName, |
|
|
|
PartCode = TeachClassList[i].PartCode, |
|
|
|
StuSortNo = item.TestStuSortNo, |
|
|
|
TeachClassNo = TeachClassList[i].TeachClassNo, |
|
|
|
LessonSortNo = TeachClassList[i].LessonSortNo, |
|
|
|
Grade = TeachClassList[i].Grade, |
|
|
|
StudyScore = 2, |
|
|
|
TotalStudyHour = 2, |
|
|
|
IsInEffect = "1", |
|
|
|
IsPitchOn = "1", |
|
|
|
F_SchoolId = TeachClassList[i].F_SchoolId, |
|
|
|
CheckMark = "0", |
|
|
|
TestKindNo = "1", |
|
|
|
IsEditable = "1", |
|
|
|
OrdinaryScore = 0, |
|
|
|
TermInScore = 0, |
|
|
|
TermEndScore = 0, |
|
|
|
OtherScore = 0 |
|
|
|
|
|
|
|
}; |
|
|
|
db.Insert(stuScoreEntity); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
db.Commit(); |
|
|
|
return Result = "设置教师成功"; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
db.Rollback(); |
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw ExceptionEx.ThrowServiceException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// 强制修改教师 |
|
|
|
/// </summary> |
|
|
|
/// <param name="keyValue"></param> |
|
|
|
/// <param name="EmpNo"></param> |
|
|
|
public string UpQzSetTeach(string keyValue, string EmpNo) |
|
|
|
{ |
|
|
|
string Result = ""; |
|
|
|
var db = BaseRepository("CollegeMIS").BeginTrans(); |
|
|
|
try |
|
|
|
{ |
|
|
|
#region 获取班级开课计划的数据 |
|
|
|
var IdList = keyValue.Split(','); |
|
|
|
var TeachClassList = BaseRepository("CollegeMIS").FindList<TeachClassEntity>(x => IdList.Contains(x.ID.ToString())).ToList(); |
|
|
|
foreach (var item in IdList)//修改TeachClass表 |
|
|
|
{ |
|
|
|
var entityList = GetTeachClassEntity(item); |
|
|
|
entityList.EmpNo = EmpNo; |
|
|
|
db.Update(entityList); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
|
|
|
|
List<StuSelectLessonListEntity> stuLessonList = new List<StuSelectLessonListEntity>(); |
|
|
|
for (int i = 0; i < TeachClassList.Count; i++) |
|
|
|
{ |
|
|
|
var LessonData = db.FindList<LessonInfoEntity>().Where(x => x.LessonNo == TeachClassList[i].LessonNo).FirstOrDefault(); |
|
|
|
|
|
|
|
var stuDataList = db.FindList<StuInfoBasicEntity>().Where(s => |
|
|
|
s.DeptNo == TeachClassList[i].DeptNo && s.MajorNo == TeachClassList[i].MajorNo && |
|
|
|
s.F_SchoolId == TeachClassList[i].F_SchoolId && |
|
|
|
s.ClassNo == TeachClassList[i].TeachClassNo && s.CheckMark == "1"); |
|
|
|
var DeleteStuSelectLesson = db.FindList<StuSelectLessonListEntity>().Where( |
|
|
|
x => x.AcademicYearNo == TeachClassList[i].AcademicYearNo && |
|
|
|
x.LessonNo == TeachClassList[i].LessonNo && |
|
|
|
x.Semester == TeachClassList[i].Semester && |
|
|
|
x.F_SchoolId == TeachClassList[i].F_SchoolId && |
|
|
|
x.DeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.MajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.ClassNo == TeachClassList[i].TeachClassNo && |
|
|
|
x.Grade == TeachClassList[i].Grade && |
|
|
|
x.OpenLessonDeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.OpenLessonMajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.LessonSortNo == "1").ToList(); |
|
|
|
if (DeleteStuSelectLesson.Count > 0) |
|
|
|
{ |
|
|
|
db.Delete(DeleteStuSelectLesson); |
|
|
|
} |
|
|
|
if (stuDataList != null) |
|
|
|
{ |
|
|
|
#region 修改StuSelectLessonList表 |
|
|
|
|
|
|
|
foreach (var item in stuDataList) |
|
|
|
{ |
|
|
|
var StuSelectLessonEntity = new StuSelectLessonListEntity |
|
|
|
{ |
|
|
|
StuNo = item.StuNo, |
|
|
|
DeptNo = TeachClassList[i].DeptNo, |
|
|
|
MajorNo = TeachClassList[i].MajorNo, |
|
|
|
ClassNo = item.ClassNo, |
|
|
|
GenderNo = item.GenderNo == true ? "0" : "1", |
|
|
|
MajorDetailNo = TeachClassList[i].MajorDetailNo, |
|
|
|
MajorDetailName = TeachClassList[i].MajorDetailName, |
|
|
|
StuName = item.StuName, |
|
|
|
AcademicYearNo = TeachClassList[i].AcademicYearNo, |
|
|
|
Semester = TeachClassList[i].Semester, |
|
|
|
OpenLessonDeptNo = TeachClassList[i].DeptNo, |
|
|
|
OpenLessonMajorNo = TeachClassList[i].MajorNo, |
|
|
|
LessonNo = TeachClassList[i].LessonNo, |
|
|
|
LessonName = LessonData.LessonName, |
|
|
|
PartCode = TeachClassList[i].PartCode, |
|
|
|
OrdinaryScoreScale = 0, |
|
|
|
TermInScoreScale = 0, |
|
|
|
TermEndScoreScale = 0, |
|
|
|
OtherScoreScale = 0, |
|
|
|
TeachClassNo = TeachClassList[i].TeachClassNo, |
|
|
|
LessonSortNo = TeachClassList[i].LessonSortNo, |
|
|
|
StuSortNo = TeachClassList[i].LessonSortNo, |
|
|
|
Grade = item.Grade, |
|
|
|
StudyScore = 2, |
|
|
|
TotalStudyHour = 2, |
|
|
|
IsInEffect = "1", |
|
|
|
IsPitchOn = "1", |
|
|
|
F_SchoolId = TeachClassList[i].F_SchoolId, |
|
|
|
CheckMark = "1", |
|
|
|
InsertTime = DateTime.Now |
|
|
|
}; |
|
|
|
stuLessonList.Add(StuSelectLessonEntity); |
|
|
|
db.Insert(StuSelectLessonEntity); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
var ScoreList = db.FindList<StuScoreEntity>().Where(x => x.AcademicYearNo == TeachClassList[i].AcademicYearNo && x.Semester == TeachClassList[i].Semester && x.DeptNo == TeachClassList[i].DeptNo && x.MajorNo == TeachClassList[i].MajorNo && x.ClassNo == TeachClassList[i].TeachClassNo && x.LessonSortNo == TeachClassList[i].LessonSortNo && x.LessonNo == TeachClassList[i].LessonNo); |
|
|
|
var DeleteStuScore = db.FindList<StuScoreEntity>().Where( |
|
|
|
x => x.AcademicYearNo == TeachClassList[i].AcademicYearNo && |
|
|
|
x.LessonNo == TeachClassList[i].LessonNo && |
|
|
|
x.Semester == TeachClassList[i].Semester && |
|
|
|
x.F_SchoolId == TeachClassList[i].F_SchoolId && |
|
|
|
x.DeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.MajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.ClassNo == TeachClassList[i].TeachClassNo && |
|
|
|
x.Grade == TeachClassList[i].Grade && |
|
|
|
x.OpenLessonDeptNo == TeachClassList[i].DeptNo && |
|
|
|
x.OpenLessonMajorNo == TeachClassList[i].MajorNo && |
|
|
|
x.LessonSortNo == "1" && x.CheckMark == "0").ToList(); |
|
|
|
if (DeleteStuScore.Count > 0) |
|
|
|
{ |
|
|
|
db.Delete(DeleteStuScore); |
|
|
|
|
|
|
|
} |
|
|
|
if (ScoreList != null) |
|
|
|
{ |
|
|
|
#region 添加StuScore表 |
|
|
|
foreach (var item in stuDataList) |
|
|
|
{ |
|
|
|
var stuScoreEntity = new StuScoreEntity |
|
|
|
{ |
|
|
|
StuNo = item.StuNo, |
|
|
|
DeptNo = item.DeptNo, |
|
|
|
MajorNo = item.MajorNo, |
|
|
|
ClassNo = item.ClassNo, |
|
|
|
StuName = item.StuName, |
|
|
|
EmpNo = EmpNo, |
|
|
|
GenderNo = item.GenderNo == true ? "0" : "1", |
|
|
|
AcademicYearNo = TeachClassList[i].AcademicYearNo, |
|
|
|
Semester = TeachClassList[i].Semester, |
|
|
|
OpenLessonDeptNo = TeachClassList[i].DeptNo, |
|
|
|
OpenLessonMajorNo = TeachClassList[i].MajorNo, |
|
|
|
LessonNo = TeachClassList[i].LessonNo, |
|
|
|
LessonName = LessonData.LessonName, |
|
|
|
PartCode = TeachClassList[i].PartCode, |
|
|
|
StuSortNo = item.TestStuSortNo, |
|
|
|
TeachClassNo = TeachClassList[i].TeachClassNo, |
|
|
|
LessonSortNo = TeachClassList[i].LessonSortNo, |
|
|
|
Grade = TeachClassList[i].Grade, |
|
|
|
StudyScore = 2, |
|
|
|
TotalStudyHour = 2, |
|
|
|
IsInEffect = "1", |
|
|
|
IsPitchOn = "1", |
|
|
|
F_SchoolId = TeachClassList[i].F_SchoolId, |
|
|
|
CheckMark = "0", |
|
|
|
TestKindNo = "1", |
|
|
|
IsEditable = "1", |
|
|
|
OrdinaryScore = 0, |
|
|
|
TermInScore = 0, |
|
|
|
TermEndScore = 0, |
|
|
|
OtherScore = 0 |
|
|
|
|
|
|
|
}; |
|
|
|
db.Insert(stuScoreEntity); |
|
|
|
} |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
db.Commit(); |
|
|
|
return Result = "设置教师成功"; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
db.Rollback(); |
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw ExceptionEx.ThrowServiceException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion |
|
|
|
} |
|
|
|
} |