123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel;
- using EMIS.ViewModel.ScoreManage;
- using EMIS.DataLogic.ScoreManage;
- using EMIS.Entities;
- namespace EMIS.CommonLogic.ScoreManage
- {
- public class ResitServices : BaseServices, IResitServices
- {
- public ResitDAL ResitDAL { get; set; }
- public IGridResultSet<ResitView> GetResitViewGrid(ConfiguretView conditionView, Guid? schoolyearID, Guid? examinationBatchID,
- Guid? examinationTypeID, Guid? examinationProjectID, int? examinationSubjectID, int? schoolAreaID, Guid? collegeID,
- int? yearID, int? standardID, Guid? classmajorID, int? pageIndex, int? pageSize)
- {
- Expression<Func<EX_ExaminationBatch, bool>> batchExp = (x => true);
- Expression<Func<EX_ExaminationProject, bool>> projectExp = (x => true);
- Expression<Func<ER_ExaminationScore, bool>> scoreExp = (x => true);
- Expression<Func<CF_Facultymajor, bool>> facutyExp = (x => true);
- Expression<Func<CF_Grademajor, bool>> gradeExp = (x => true);
- Expression<Func<CF_Student, bool>> studentExp = (x => true);
- if (schoolyearID.HasValue)
- {
- batchExp = batchExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (examinationBatchID.HasValue)
- {
- batchExp = batchExp.And(x => x.ExaminationBatchID == examinationBatchID);
- }
- if (examinationTypeID.HasValue)
- {
- projectExp = projectExp.And(x => x.ExaminationTypeID == examinationTypeID);
- }
- if (examinationProjectID.HasValue)
- {
- projectExp = projectExp.And(x => x.ExaminationProjectID == examinationProjectID);
- }
- if (examinationSubjectID.HasValue)
- {
- scoreExp = scoreExp.And(x => x.ExaminationSubjectID == examinationSubjectID);
- }
- if (schoolAreaID.HasValue)
- {
- gradeExp = gradeExp.And(x => x.SchoolAreaID == schoolAreaID);
- }
- if (collegeID.HasValue)
- {
- facutyExp = facutyExp.And(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- gradeExp = gradeExp.And(x => x.SchoolyearID == yearID);
- }
- if (standardID.HasValue)
- {
- facutyExp = facutyExp.And(x => x.StandardID == standardID);
- }
- if (classmajorID.HasValue)
- {
- studentExp = studentExp.And(x => x.ClassmajorID == classmajorID);
- }
- var query = ResitDAL.GetResitViewQueryable(batchExp, projectExp, scoreExp, facutyExp, gradeExp, studentExp);
- if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
- {
- query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
- }
- var result = GetQueryByDataRangeByCollege(query);
- return this.GetQueryByAssistant(query, (x => x.ClassmajorID), this.GetQueryByDataRangeByCollege(result)).OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.ExaminationBatchName)
- .ThenBy(x => x.ExaminationTypeName)
- .ThenBy(x => x.ExaminationProjectName)
- .ThenBy(x => x.ClassmajorName)
- .ThenBy(x => x.ExaminationSubjectID)
- .ThenBy(x => x.UserName)
- .ToGridResultSet(pageIndex, pageSize);
- }
- public List<ResitView> GetResitViewList(ConfiguretView conditionView, Guid? schoolyearID, Guid? examinationBatchID, Guid? examinationTypeID, Guid? examinationProjectID, int? examinationSubjectID, int? schoolAreaID, Guid? collegeID, int? yearID, int? standardID, Guid? classmajorID)
- {
- Expression<Func<EX_ExaminationBatch, bool>> batchExp = (x => true);
- Expression<Func<EX_ExaminationProject, bool>> projectExp = (x => true);
- Expression<Func<ER_ExaminationScore, bool>> scoreExp = (x => true);
- Expression<Func<CF_Facultymajor, bool>> facutyExp = (x => true);
- Expression<Func<CF_Grademajor, bool>> gradeExp = (x => true);
- Expression<Func<CF_Student, bool>> studentExp = (x => true);
- if (schoolyearID.HasValue)
- {
- batchExp = batchExp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (examinationBatchID.HasValue)
- {
- batchExp = batchExp.And(x => x.ExaminationBatchID == examinationBatchID);
- }
- if (examinationTypeID.HasValue)
- {
- projectExp = projectExp.And(x => x.ExaminationTypeID == examinationTypeID);
- }
- if (examinationProjectID.HasValue)
- {
- projectExp = projectExp.And(x => x.ExaminationProjectID == examinationProjectID);
- }
- if (examinationSubjectID.HasValue)
- {
- scoreExp = scoreExp.And(x => x.ExaminationSubjectID == examinationSubjectID);
- }
- if (schoolAreaID.HasValue)
- {
- gradeExp = gradeExp.And(x => x.SchoolAreaID == schoolAreaID);
- }
- if (collegeID.HasValue)
- {
- facutyExp = facutyExp.And(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- gradeExp = gradeExp.And(x => x.SchoolyearID == yearID);
- }
- if (standardID.HasValue)
- {
- facutyExp = facutyExp.And(x => x.StandardID == standardID);
- }
- if (classmajorID.HasValue)
- {
- studentExp = studentExp.And(x => x.ClassmajorID == classmajorID);
- }
- var query = ResitDAL.GetResitViewQueryable(batchExp, projectExp, scoreExp, facutyExp, gradeExp, studentExp);
- if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
- {
- query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
- }
- var result = GetQueryByDataRangeByCollege(query);
- return result.OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.ExaminationBatchName)
- .ThenBy(x => x.ExaminationTypeName)
- .ThenBy(x => x.ExaminationProjectName)
- .ThenBy(x => x.ClassmajorName)
- .ThenBy(x => x.ExaminationSubjectID)
- .ThenBy(x => x.UserName)
- .ToList();
- }
- }
- }
|