123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Common.EvaluationManage;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.EvaluationManage;
- using EMIS.ViewModel;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using Bowin.Common.Linq;
- using Bowin.Common.Utility;
- using Bowin.Common.Mapping;
- using EMIS.CommonLogic.SystemServices;
- namespace EMIS.CommonLogic.EvaluationManage
- {
- public class TeacherEvaluationServices : BaseServices, ITeacherEvaluationServices
- {
- public TeacherEvaluationDAL TeacherEvaluationDAL { get; set; }
- public ISerialNumberServices SerialNumberServices { get; set; }
- public IGridResultSet<TeacherEvaluationView> GetTeacherEvaluationViewGrid(ConfiguretView configuretView, Guid? schoolYearID, Guid? campusID, Guid? collegeID, int? openStatus, int pageIndex, int pageSize)
- {
- Expression<Func<EM_TeacherEvaluation, bool>> filter = w => w.RecordStatus == (int)SYS_STATUS.USABLE;
- if (openStatus.HasValue && openStatus != -1)
- {
- filter = filter.And(w => w.OpenStatus == openStatus);
- }
- var query = TeacherEvaluationDAL.GetTeacherEvaluationQuery(filter);
- if (schoolYearID.HasValue && schoolYearID != Guid.Empty)
- {
- query.Where(w => w.SchoolyearID == schoolYearID);
- }
- if (campusID.HasValue && campusID != Guid.Empty)
- {
- query.Where(w => w.CampusID == campusID);
- }
- if (collegeID.HasValue && collegeID != Guid.Empty)
- {
- query.Where(w => w.CollegeID == collegeID);
- }
- query = GetQueryByDataRangeByCollege(query);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- query = query.OrderByDescending(o => o.EntityCreateTime);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- public TeacherEvaluationView GetTeacherEvaluationView(Guid? id)
- {
- var result = new TeacherEvaluationView();
- if (id.HasValue && id != Guid.Empty)
- result = TeacherEvaluationDAL.GetTeacherEvaluationQuery(w => w.ID == id).FirstOrDefault();
- return result;
- }
- public void AddOrUpdateTeacherEvaluation(TeacherEvaluationView model)
- {
- EM_TeacherEvaluation entity;
- if (model.EntityID == Guid.Empty)
- {
- entity = new EM_TeacherEvaluation();
- model.DynamicCloneTo(entity);
- //SetNewStatus方法去掉了设置ID的功能
- entity.ID = Guid.NewGuid();
- SetNewStatus(entity);
- entity.Code = SerialNumberServices.SetSN(model.CourseCode + "(" + model.SchoolyearCode + ")");
- entity.CreateTime = DateTime.Now;
- UnitOfWork.Add(entity);
- }
- else
- {
- entity = TeacherEvaluationDAL.TeacherEvaluationRepository.GetSingle(w => w.ID == model.EntityID);
- model.DynamicCloneTo(entity);
- SetModifyStatus(entity);
- UnitOfWork.Update(entity);
- }
- UnitOfWork.Commit();
- }
- public void DeleteTeacherEvaluation(List<Guid> ids)
- {
- UnitOfWork.Delete<EM_TeacherEvaluation>(w => ids.Contains(w.ID));
- }
- }
- }
|