|
|
@@ -39,12 +39,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
var dp = new DynamicParameters(new { }); |
|
|
|
if (!queryParam["LeaveType"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("LeaveType",queryParam["LeaveType"].ToString(), DbType.String); |
|
|
|
dp.Add("LeaveType", queryParam["LeaveType"].ToString(), DbType.String); |
|
|
|
strSql.Append(" AND t.LeaveType = @LeaveType "); |
|
|
|
} |
|
|
|
if (!queryParam["CheckStatus"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("CheckStatus",queryParam["CheckStatus"].ToString(), DbType.String); |
|
|
|
dp.Add("CheckStatus", queryParam["CheckStatus"].ToString(), DbType.String); |
|
|
|
strSql.Append(" AND t.CheckStatus = @CheckStatus "); |
|
|
|
} |
|
|
|
if (!queryParam["StuNo"].IsEmpty()) |
|
|
@@ -90,7 +90,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
strSql.Append(" ) "); |
|
|
|
} |
|
|
|
} |
|
|
|
return this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>(strSql.ToString(),dp, pagination); |
|
|
|
return this.BaseRepository("CollegeMIS").FindList<StuLeaveManagementEntity>(strSql.ToString(), dp, pagination); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@@ -222,7 +222,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
this.BaseRepository("CollegeMIS").Delete<StuLeaveManagementEntity>(t=>t.Id == keyValue); |
|
|
|
this.BaseRepository("CollegeMIS").Delete<StuLeaveManagementEntity>(t => t.Id == keyValue); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
@@ -244,21 +244,77 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
/// <param name="entity">实体</param> |
|
|
|
public void SaveEntity(string keyValue, StuLeaveManagementEntity entity) |
|
|
|
{ |
|
|
|
var db = this.BaseRepository("CollegeMIS"); |
|
|
|
try |
|
|
|
{ |
|
|
|
db.BeginTrans(); |
|
|
|
if (!string.IsNullOrEmpty(keyValue)) |
|
|
|
{ |
|
|
|
entity.Modify(keyValue); |
|
|
|
this.BaseRepository("CollegeMIS").Update(entity); |
|
|
|
db.Update(entity); |
|
|
|
|
|
|
|
if (entity.CheckStatus.Trim() == "1" && entity.StartTime != null) |
|
|
|
{ |
|
|
|
//请假审核通过后,该学生的对应日期的课表改为请假 |
|
|
|
var model = db.FindList<StuLeaveManagementEntity>( |
|
|
|
$"select * from StuLeaveManagement where Id='{keyValue}'").FirstOrDefault(); |
|
|
|
//请假开始时间和结束时间 |
|
|
|
var startTime = Convert.ToDateTime(model.StartTime?.ToString("yyyy-MM-dd") + " 00:00:00"); |
|
|
|
var endTime = Convert.ToDateTime(model.EndTime?.ToString("yyyy-MM-dd") + " 23:59:59"); |
|
|
|
|
|
|
|
//排课数据 |
|
|
|
var arrangeLessonTermList = db.FindList<ArrangeLessonTermEntity>($@"select a.*,b.StuName,b.Grade from [dbo].[ArrangeLessonTerm] a |
|
|
|
join stuinfobasic b on a.teachclassno=b.classno |
|
|
|
where b.stuno='{model.CreateUserNo}' |
|
|
|
and a.lessondate between '{startTime}' and '{endTime}'"); |
|
|
|
|
|
|
|
var deptList = db.FindList<CdDeptEntity>(); |
|
|
|
var majorList = db.FindList<CdMajorEntity>(); |
|
|
|
var classInfoList = db.FindList<ClassInfoEntity>(); |
|
|
|
foreach (var arrangeLessonTerm in arrangeLessonTermList) |
|
|
|
{ |
|
|
|
StuAttendanceLeaveEntity stuAttendanceLeave = new StuAttendanceLeaveEntity(); |
|
|
|
stuAttendanceLeave.Create(); |
|
|
|
stuAttendanceLeave.AcademicYearNo = arrangeLessonTerm.AcademicYearNo; |
|
|
|
stuAttendanceLeave.Semester = arrangeLessonTerm.Semester; |
|
|
|
stuAttendanceLeave.StuNo = model.CreateUserNo; |
|
|
|
stuAttendanceLeave.StuName = arrangeLessonTerm.StuName; |
|
|
|
stuAttendanceLeave.Grade = arrangeLessonTerm.Grade; |
|
|
|
stuAttendanceLeave.DeptNo = arrangeLessonTerm.DeptNo; |
|
|
|
stuAttendanceLeave.DeptName = deptList.Where(x => x.DeptNo == arrangeLessonTerm.DeptNo) |
|
|
|
.FirstOrDefault()?.DeptName; |
|
|
|
stuAttendanceLeave.MajorNo = arrangeLessonTerm.MajorNo; |
|
|
|
stuAttendanceLeave.MajorName = majorList.Where(x => x.MajorNo == arrangeLessonTerm.MajorNo) |
|
|
|
.FirstOrDefault()?.MajorName; |
|
|
|
stuAttendanceLeave.ClassNo = arrangeLessonTerm.TeachClassNo; |
|
|
|
stuAttendanceLeave.ClassName = classInfoList |
|
|
|
.Where(x => x.ClassNo == arrangeLessonTerm.TeachClassNo).FirstOrDefault()?.ClassName; |
|
|
|
stuAttendanceLeave.LessonNo = arrangeLessonTerm.LessonNo; |
|
|
|
stuAttendanceLeave.LessonName = arrangeLessonTerm.LessonName; |
|
|
|
stuAttendanceLeave.TeachClassNo = arrangeLessonTerm.TeachClassNo; |
|
|
|
stuAttendanceLeave.LessonSortNo = arrangeLessonTerm.LessonSortNo; |
|
|
|
//stuAttendanceLeave.LessonSortName = arrangeLessonTerm.LessonSortName; |
|
|
|
stuAttendanceLeave.LessonDate = arrangeLessonTerm.LessonDate; |
|
|
|
stuAttendanceLeave.LessonTime = arrangeLessonTerm.LessonTime; |
|
|
|
stuAttendanceLeave.LeaveType = "1"; |
|
|
|
stuAttendanceLeave.EmpNo = arrangeLessonTerm.EmpNo; |
|
|
|
stuAttendanceLeave.ClassRoomNo = arrangeLessonTerm.ClassroomNo; |
|
|
|
|
|
|
|
db.Insert(stuAttendanceLeave); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
entity.Create(); |
|
|
|
this.BaseRepository("CollegeMIS").Insert(entity); |
|
|
|
db.Insert(entity); |
|
|
|
} |
|
|
|
|
|
|
|
db.Commit(); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
db.Rollback(); |
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
|