123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using System.Transactions;
- using Bowin.Common.Linq;
- using Bowin.Common.Data;
- using Bowin.Common.Linq.Entity;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.EvaluationManage.EvaluationResult;
- using EMIS.DataLogic.EvaluationManage.EvaluationResult;
- using EMIS.DataLogic.EvaluationManage.StudentEvaluation;
- using EMIS.CommonLogic.EvaluationManage.EvaluationManage;
- namespace EMIS.CommonLogic.EvaluationManage.EvaluationResult
- {
- public class EvaluationStaffScoreServices : BaseServices, IEvaluationStaffScoreServices
- {
- public Lazy<EvaluationStaffScoreDAL> EvaluationStaffScoreDAL { get; set; }
- public Lazy<EvaluationStudentSettingDAL> EvaluationStudentSettingDAL { get; set; }
- public Lazy<IEvaluationStudentScoreServices> EvaluationStudentScoreServices { get; set; }
- public Lazy<IEvaluationCollegeScoreServices> EvaluationCollegeScoreServices { get; set; }
- /// <summary>
- /// 查询对应的教师评分信息View
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="departmentID"></param>
- /// <param name="userID"></param>
- /// <param name="incumbencyState"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<EvaluationStaffScoreView> GetEvaluationStaffScoreViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID,
- Guid? departmentID, Guid? userID, int? incumbencyState, Guid? coursematerialID, int pageIndex, int pageSize)
- {
- Expression<Func<EM_EvaluationStaffScore, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (departmentID.HasValue)
- {
- exp = exp.And(x => x.DepartmentID == departmentID);
- }
- if (userID.HasValue)
- {
- exp = exp.And(x => x.UserID == userID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.CoursematerialID == coursematerialID);
- }
- var query = EvaluationStaffScoreDAL.Value.GetEvaluationStaffScoreViewQueryable(exp);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (incumbencyState.HasValue)
- {
- query = query.Where(x => x.IncumbencyState == incumbencyState);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRange(query, x => x.UserID).OrderByDescending(x => x.SchoolyearValue).ThenBy(x => x.DepartmentNo.Length)
- .ThenBy(x => x.DepartmentNo).ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ThenBy(x => x.StaffCode).ToGridResultSet<EvaluationStaffScoreView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询对应的教师评分信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="schoolyearID"></param>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="departmentID"></param>
- /// <param name="userID"></param>
- /// <param name="incumbencyState"></param>
- /// <param name="coursematerialID"></param>
- /// <returns></returns>
- public IList<EvaluationStaffScoreView> GetEvaluationStaffScoreViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID,
- Guid? departmentID, Guid? userID, int? incumbencyState, Guid? coursematerialID)
- {
- Expression<Func<EM_EvaluationStaffScore, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (departmentID.HasValue)
- {
- exp = exp.And(x => x.DepartmentID == departmentID);
- }
- if (userID.HasValue)
- {
- exp = exp.And(x => x.UserID == userID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.CoursematerialID == coursematerialID);
- }
- var query = EvaluationStaffScoreDAL.Value.GetEvaluationStaffScoreViewQueryable(exp);
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (incumbencyState.HasValue)
- {
- query = query.Where(x => x.IncumbencyState == incumbencyState);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRange(query, x => x.UserID).OrderByDescending(x => x.SchoolyearValue).ThenBy(x => x.DepartmentNo.Length)
- .ThenBy(x => x.DepartmentNo).ThenBy(x => x.CourseCode.Length).ThenBy(x => x.CourseCode).ThenBy(x => x.StaffCode).ToList();
- }
- /// <summary>
- /// 查询对应的教师评分信息EvaluationStaffScoreView
- /// </summary>
- /// <param name="evaluationStaffScoreID"></param>
- /// <returns></returns>
- public EvaluationStaffScoreView GetEvaluationStaffScoreView(Guid? evaluationStaffScoreID)
- {
- try
- {
- Expression<Func<EM_EvaluationStaffScore, bool>> exp = (x => x.EvaluationStaffScoreID == evaluationStaffScoreID);
- var query = EvaluationStaffScoreDAL.Value.GetEvaluationStaffScoreViewQueryable(exp).SingleOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 评分生成
- /// </summary>
- /// <param name="campusID"></param>
- /// <param name="collegeID"></param>
- /// <param name="departmentID"></param>
- /// <param name="coursematerialID"></param>
- /// <param name="userID"></param>
- /// <param name="schoolyearID"></param>
- /// <returns></returns>
- public string EvaluationStaffScoreCreate(Guid? campusID, Guid? collegeID, Guid? departmentID, Guid? coursematerialID, Guid? userID, Guid? schoolyearID)
- {
- try
- {
- var schoolyear = EvaluationStaffScoreDAL.Value.SchoolyearRepository.GetList(x => x.SchoolyearID == schoolyearID).SingleOrDefault();
- if (schoolyear == null)
- {
- throw new Exception("选择的学年学期有误,请核查。");
- }
- var stuPassNoEndStatusID = EvaluationStudentScoreServices.Value.GetPassNoEndStatus();
- if (stuPassNoEndStatusID == null)
- {
- throw new Exception("工作流平台中,学生评分流程通过环节未配置,请核查。");
- }
- var colPassNoEndStatusID = EvaluationCollegeScoreServices.Value.GetPassNoEndStatus();
- if (colPassNoEndStatusID == null)
- {
- throw new Exception("工作流平台中,院系评分流程通过环节未配置,请核查。");
- }
- Expression<Func<EM_EducationMissionClass, bool>> expEducationMissionClass = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- expEducationMissionClass = expEducationMissionClass.And(x => x.RecordStatus == (int)EM_EducationMissionClassStatus.Submitted || x.RecordStatus == (int)EM_EducationMissionClassStatus.Scheduled);
- if (coursematerialID.HasValue)
- {
- expEducationMissionClass = expEducationMissionClass.And(x => x.CoursematerialID == coursematerialID);
- }
- var query = EvaluationStudentSettingDAL.Value.GetEvaluationMissionStaffViewQueryable(expEducationMissionClass).Distinct().AsQueryable();
- if (schoolyearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == schoolyearID);
- }
- if (campusID.HasValue)
- {
- query = query.Where(x => x.CampusID == campusID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (departmentID.HasValue)
- {
- query = query.Where(x => x.DepartmentID == departmentID);
- }
- if (userID.HasValue)
- {
- query = query.Where(x => x.UserID == userID);
- }
- var evaluationMissionStaffViewList = this.GetQueryByDataRangeByDepartment(query).ToList();
- if (evaluationMissionStaffViewList == null || evaluationMissionStaffViewList.Count() <= 0)
- {
- throw new Exception("对应的教学任务信息为空,请核查(如:任务状态为未提交)。");
- }
- var schoolyearIDList = evaluationMissionStaffViewList.Select(x => x.SchoolyearID).Distinct().ToList();
- var evaluationStaffScoreList = EvaluationStaffScoreDAL.Value.EvaluationStaffScoreRepository.GetList(x => schoolyearIDList.Contains(x.SchoolyearID), (x => x.EM_EvaluationStaffScoreDetail)).ToList();
- var evaluationStudentScoreList = EvaluationStaffScoreDAL.Value.EvaluationStudentScoreRepository.GetList(x => schoolyearIDList.Contains(x.SchoolyearID)).ToList();
- var evaluationCollegeScoreList = EvaluationStaffScoreDAL.Value.EvaluationCollegeScoreRepository.GetList(x => schoolyearIDList.Contains(x.SchoolyearID)).ToList();
- int inSuccess = 0;
- int upSuccess = 0;
- string tipMessage = null;
- var evaluationStaffScoreInList = new List<EM_EvaluationStaffScore>();
- var evaluationStaffScoreUpList = new List<EM_EvaluationStaffScore>();
- var evaluationStaffScoreDetailInList = new List<EM_EvaluationStaffScoreDetail>();
- List<Guid?> evaluationStaffScoreIDDelList = new List<Guid?>();
- foreach (var evaluationMissionStaffView in evaluationMissionStaffViewList)
- {
- var evaluationStaffScore = evaluationStaffScoreList.Where(x => x.SchoolyearID == evaluationMissionStaffView.SchoolyearID && x.UserID == evaluationMissionStaffView.UserID
- && x.CoursematerialID == evaluationMissionStaffView.CoursematerialID && x.DepartmentID == evaluationMissionStaffView.DepartmentID).SingleOrDefault();
- var evaluationStudentScore = evaluationStudentScoreList.Where(x => x.SchoolyearID == evaluationMissionStaffView.SchoolyearID && x.UserID == evaluationMissionStaffView.UserID
- && x.CoursematerialID == evaluationMissionStaffView.CoursematerialID && x.DepartmentID == evaluationMissionStaffView.DepartmentID && x.ApprovalStatus == stuPassNoEndStatusID).SingleOrDefault();
- var evaluationCollegeScore = evaluationCollegeScoreList.Where(x => x.SchoolyearID == evaluationMissionStaffView.SchoolyearID && x.UserID == evaluationMissionStaffView.UserID
- && x.CoursematerialID == evaluationMissionStaffView.CoursematerialID && x.DepartmentID == evaluationMissionStaffView.DepartmentID && x.ApprovalStatus == colPassNoEndStatusID).SingleOrDefault();
- if (evaluationStaffScore == null)
- {
- var newEvaluationStaffScore = new EM_EvaluationStaffScore();
- newEvaluationStaffScore.EvaluationStaffScoreID = Guid.NewGuid();
- newEvaluationStaffScore.SchoolyearID = evaluationMissionStaffView.SchoolyearID;
- newEvaluationStaffScore.UserID = evaluationMissionStaffView.UserID;
- newEvaluationStaffScore.CoursematerialID = evaluationMissionStaffView.CoursematerialID;
- newEvaluationStaffScore.DepartmentID = evaluationMissionStaffView.DepartmentID;
- if (evaluationStudentScore != null)
- {
- if (evaluationCollegeScore != null)
- {
- newEvaluationStaffScore.TotalScore = Math.Round(((evaluationStudentScore.TotalScore ?? 0) * (decimal)0.7) + ((evaluationCollegeScore.TotalScore ?? 0) * (decimal)0.3), 2, MidpointRounding.AwayFromZero);
- }
- else
- {
- newEvaluationStaffScore.TotalScore = Math.Round(((evaluationStudentScore.TotalScore ?? 0) * (decimal)0.7), 2, MidpointRounding.AwayFromZero);
- }
- }
- else
- {
- if (evaluationCollegeScore != null)
- {
- newEvaluationStaffScore.TotalScore = Math.Round(((evaluationCollegeScore.TotalScore ?? 0) * (decimal)0.3), 2, MidpointRounding.AwayFromZero);
- }
- else
- {
- newEvaluationStaffScore.TotalScore = 0;
- }
- }
- newEvaluationStaffScore.Remark = null;
- SetNewStatus(newEvaluationStaffScore);
- evaluationStaffScoreInList.Add(newEvaluationStaffScore);
- var newEvaStuStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreID = newEvaluationStaffScore.EvaluationStaffScoreID;
- newEvaStuStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.StudentScore;
- if (evaluationStudentScore != null)
- {
- newEvaStuStaffScoreDetail.Score = evaluationStudentScore.TotalScore;
- }
- else
- {
- newEvaStuStaffScoreDetail.Score = 0;
- }
- SetNewStatus(newEvaStuStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaStuStaffScoreDetail);
- var newEvaColStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaColStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaColStaffScoreDetail.EvaluationStaffScoreID = newEvaluationStaffScore.EvaluationStaffScoreID;
- newEvaColStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.CollegeScore;
- if (evaluationCollegeScore != null)
- {
- newEvaColStaffScoreDetail.Score = evaluationCollegeScore.TotalScore;
- }
- else
- {
- newEvaColStaffScoreDetail.Score = 0;
- }
- SetNewStatus(newEvaColStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaColStaffScoreDetail);
- inSuccess++;
- }
- else
- {
- if (evaluationStudentScore != null)
- {
- if (evaluationCollegeScore != null)
- {
- evaluationStaffScore.TotalScore = Math.Round(((evaluationStudentScore.TotalScore ?? 0) * (decimal)0.7) + ((evaluationCollegeScore.TotalScore ?? 0) * (decimal)0.3), 2, MidpointRounding.AwayFromZero);
- }
- else
- {
- evaluationStaffScore.TotalScore = Math.Round(((evaluationStudentScore.TotalScore ?? 0) * (decimal)0.7), 2, MidpointRounding.AwayFromZero);
- }
- }
- else
- {
- if (evaluationCollegeScore != null)
- {
- evaluationStaffScore.TotalScore = Math.Round(((evaluationCollegeScore.TotalScore ?? 0) * (decimal)0.3), 2, MidpointRounding.AwayFromZero);
- }
- else
- {
- evaluationStaffScore.TotalScore = 0;
- }
- }
- SetModifyStatus(evaluationStaffScore);
- evaluationStaffScoreUpList.Add(evaluationStaffScore);
- if (evaluationStaffScore.EM_EvaluationStaffScoreDetail.Count() > 0)
- {
- evaluationStaffScoreIDDelList.Add(evaluationStaffScore.EvaluationStaffScoreID);
- }
- var newEvaStuStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreID = evaluationStaffScore.EvaluationStaffScoreID;
- newEvaStuStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.StudentScore;
- if (evaluationStudentScore != null)
- {
- newEvaStuStaffScoreDetail.Score = evaluationStudentScore.TotalScore;
- }
- else
- {
- newEvaStuStaffScoreDetail.Score = 0;
- }
- SetNewStatus(newEvaStuStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaStuStaffScoreDetail);
- var newEvaColStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaColStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaColStaffScoreDetail.EvaluationStaffScoreID = evaluationStaffScore.EvaluationStaffScoreID;
- newEvaColStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.CollegeScore;
- if (evaluationCollegeScore != null)
- {
- newEvaColStaffScoreDetail.Score = evaluationCollegeScore.TotalScore;
- }
- else
- {
- newEvaColStaffScoreDetail.Score = 0;
- }
- SetNewStatus(newEvaColStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaColStaffScoreDetail);
- upSuccess++;
- }
- }
- using (TransactionScope ts = new TransactionScope())
- {
- UnitOfWork.Delete<EM_EvaluationStaffScoreDetail>(x => evaluationStaffScoreIDDelList.Contains(x.EvaluationStaffScoreID));
- UnitOfWork.BulkInsert(evaluationStaffScoreInList);
- if (evaluationStaffScoreUpList != null && evaluationStaffScoreUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(evaluationStaffScoreUpList);
- }
- UnitOfWork.BulkInsert(evaluationStaffScoreDetailInList);
- ts.Complete();
- }
- if (inSuccess > 0 && upSuccess <= 0)
- {
- tipMessage = inSuccess + "条";
- }
- else
- {
- tipMessage = inSuccess + "条,更新成功" + upSuccess + "条";
- }
- return tipMessage;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 编辑
- /// </summary>
- /// <param name="evaluationStaffScoreView"></param>
- public void EvaluationStaffScoreEdit(EvaluationStaffScoreView evaluationStaffScoreView)
- {
- try
- {
- var evaluationStaffScoreVerify = EvaluationStaffScoreDAL.Value.EvaluationStaffScoreRepository.GetList(x => x.EvaluationStaffScoreID != evaluationStaffScoreView.EvaluationStaffScoreID && x.SchoolyearID == evaluationStaffScoreView.SchoolyearID
- && x.UserID == evaluationStaffScoreView.UserID && x.CoursematerialID == evaluationStaffScoreView.CoursematerialID && x.DepartmentID == evaluationStaffScoreView.DepartmentID).SingleOrDefault();
- if (evaluationStaffScoreVerify == null)
- {
- var evaluationStaffScoreInList = new List<EM_EvaluationStaffScore>();
- var evaluationStaffScoreUpList = new List<EM_EvaluationStaffScore>();
- var evaluationStaffScoreDetailInList = new List<EM_EvaluationStaffScoreDetail>();
- List<Guid?> evaluationStaffScoreIDDelList = new List<Guid?>();
- if (evaluationStaffScoreView.EvaluationStaffScoreID != Guid.Empty)
- {
- var evaluationStaffScore = EvaluationStaffScoreDAL.Value.EvaluationStaffScoreRepository.GetList(x => x.EvaluationStaffScoreID == evaluationStaffScoreView.EvaluationStaffScoreID).SingleOrDefault();
- if (evaluationStaffScore == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
- //表示修改
- evaluationStaffScore.SchoolyearID = evaluationStaffScoreView.SchoolyearID;
- evaluationStaffScore.UserID = evaluationStaffScoreView.UserID;
- evaluationStaffScore.CoursematerialID = evaluationStaffScoreView.CoursematerialID;
- evaluationStaffScore.DepartmentID = evaluationStaffScoreView.DepartmentID;
- evaluationStaffScore.TotalScore = evaluationStaffScoreView.TotalScore;
- evaluationStaffScore.Remark = evaluationStaffScoreView.Remark;
- SetModifyStatus(evaluationStaffScore);
- evaluationStaffScoreUpList.Add(evaluationStaffScore);
- evaluationStaffScoreIDDelList.Add(evaluationStaffScore.EvaluationStaffScoreID);
- var newEvaStuStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreID = evaluationStaffScore.EvaluationStaffScoreID;
- newEvaStuStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.StudentScore;
- newEvaStuStaffScoreDetail.Score = evaluationStaffScoreView.StudentScore;
- SetNewStatus(newEvaStuStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaStuStaffScoreDetail);
- var newEvaColStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaColStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaColStaffScoreDetail.EvaluationStaffScoreID = evaluationStaffScore.EvaluationStaffScoreID;
- newEvaColStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.CollegeScore;
- newEvaColStaffScoreDetail.Score = evaluationStaffScoreView.CollegeScore;
- SetNewStatus(newEvaColStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaColStaffScoreDetail);
- }
- }
- else
- {
- //表示新增
- var newEvaluationStaffScore = new EM_EvaluationStaffScore();
- newEvaluationStaffScore.EvaluationStaffScoreID = Guid.NewGuid();
- newEvaluationStaffScore.SchoolyearID = evaluationStaffScoreView.SchoolyearID;
- newEvaluationStaffScore.UserID = evaluationStaffScoreView.UserID;
- newEvaluationStaffScore.CoursematerialID = evaluationStaffScoreView.CoursematerialID;
- newEvaluationStaffScore.DepartmentID = evaluationStaffScoreView.DepartmentID;
- newEvaluationStaffScore.TotalScore = evaluationStaffScoreView.TotalScore;
- newEvaluationStaffScore.Remark = evaluationStaffScoreView.Remark;
- SetNewStatus(newEvaluationStaffScore);
- evaluationStaffScoreInList.Add(newEvaluationStaffScore);
- var newEvaStuStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaStuStaffScoreDetail.EvaluationStaffScoreID = newEvaluationStaffScore.EvaluationStaffScoreID;
- newEvaStuStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.StudentScore;
- newEvaStuStaffScoreDetail.Score = evaluationStaffScoreView.StudentScore;
- SetNewStatus(newEvaStuStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaStuStaffScoreDetail);
- var newEvaColStaffScoreDetail = new EM_EvaluationStaffScoreDetail();
- newEvaColStaffScoreDetail.EvaluationStaffScoreDetailID = Guid.NewGuid();
- newEvaColStaffScoreDetail.EvaluationStaffScoreID = newEvaluationStaffScore.EvaluationStaffScoreID;
- newEvaColStaffScoreDetail.EvaluationScoreTypeID = (int)EMIS.ViewModel.EM_EvaluationScoreType.CollegeScore;
- newEvaColStaffScoreDetail.Score = evaluationStaffScoreView.CollegeScore;
- SetNewStatus(newEvaColStaffScoreDetail);
- evaluationStaffScoreDetailInList.Add(newEvaColStaffScoreDetail);
- }
- using (TransactionScope ts = new TransactionScope())
- {
- UnitOfWork.Delete<EM_EvaluationStaffScoreDetail>(x => evaluationStaffScoreIDDelList.Contains(x.EvaluationStaffScoreID));
- UnitOfWork.BulkInsert(evaluationStaffScoreInList);
- if (evaluationStaffScoreUpList != null && evaluationStaffScoreUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(evaluationStaffScoreUpList);
- }
- UnitOfWork.BulkInsert(evaluationStaffScoreDetailInList);
- ts.Complete();
- }
- }
- else
- {
- throw new Exception("已存在相同的教师评分信息(学年学期、学生信息、课程信息唯一),请核查。");
- }
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="evaluationStaffScoreIDs"></param>
- /// <returns></returns>
- public bool EvaluationStaffScoreDelete(List<Guid?> evaluationStaffScoreIDs)
- {
- try
- {
- using (TransactionScope ts = new TransactionScope())
- {
- UnitOfWork.Delete<EM_EvaluationStaffScoreDetail>(x => evaluationStaffScoreIDs.Contains(x.EvaluationStaffScoreID));
- UnitOfWork.Delete<EM_EvaluationStaffScore>(x => evaluationStaffScoreIDs.Contains(x.EvaluationStaffScoreID));
- ts.Complete();
- return true;
- }
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|