1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.ScoreManage;
- using EMIS.ViewModel.ScoreManage;
- using EMIS.Entities;
- using System.Linq.Expressions;
- using EMIS.ViewModel;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.DataTime;
- using Bowin.Common.Utility;
- using System.Text.RegularExpressions;
- using EMIS.DataLogic.Repositories;
- using EMIS.DataLogic.ExaminationApply;
- using EMIS.DataLogic.Common.CalendarManage;
- using EMIS.ViewModel.Cache;
- namespace EMIS.CommonLogic.ScoreManage
- {
- public class LevelScoreServices : BaseServices, ILevelScoreServices
- {
- public LevelScoreDAL levelScoreDAL { get; set; }
- public ExaminationScoreDAL examinationScoreDAL { get; set; }
- public StudentRepository studentRepository { get; set; }
- public ExaminationSubjectDAL examinationSubjectDAL { get; set; }
- public SchoolYearDAL schoolYearDAL { get; set; }
- //学生版过级成绩
- public IGridResultSet<LevelScoreView> GetStudentLevelScoreGrid(ConfiguretView configuretView, Guid userId, int pageIndex, int pageSize)
- {
- Expression<Func<ER_ProjectScore, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- exp = (x => x.UserID == userId);
- var query = levelScoreDAL.GetLevelScoreViewQueryable(exp).ToList();
- var examinationScoreList = examinationScoreDAL.GetExaminationScoreViewForProjectScore(exp).ToList();
- //if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- // query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- query.ForEach(x =>
- {
- var examinationScore = examinationScoreList.Where(y => y.UserID == userId && y.ExaminationProjectID == x.ExaminationProjectID);
- //x.ScoreList = new Dictionary<int?, decimal?>();
- foreach (var score in examinationScore)
- {
- //x.ScoreList.Add(score.ExaminationSubjectID, score.Score);
- x.ScoreStr += score.ExaminationSubjectName + ":" + score.Score + ";\r\n";
- }
-
- });
- var result = query.OrderBy(x => x.ExaminationProjectName).AsQueryable<LevelScoreView>().ToGridResultSet<LevelScoreView>(pageIndex, pageSize);
- return result;
- }
- public IGridResultSet<ExaminationScoreView> GetExaminationScoreViewGrid(ConfiguretView configuretView, Guid? schoolYearID, Guid? examinationBatchID,
- Guid? examinationTypeID, Guid? examinationProjectID, int pageIndex, int pageSize)
- {
- Expression<Func<ER_ExaminationScore, bool>> esexp = x => true;
- Expression<Func<EX_ExaminationBatchProject, bool>> ebrexp = x => true;
- Expression<Func<EX_ExaminationBatch, bool>> ebexp = x => true;
- Expression<Func<EX_ExaminationProject, bool>> epexp = x => true;
- var user = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- if (user != null)
- {
- esexp = esexp.And(x => x.UserID == user.UserID);
- }
- if (schoolYearID.HasValue)
- ebexp = ebexp.And(x => x.SchoolyearID == schoolYearID);
- if (examinationBatchID.HasValue)
- ebrexp = ebrexp.And(x => x.ExaminationBatchID == examinationBatchID);
- if (examinationTypeID.HasValue)
- epexp = epexp.And(x => x.ExaminationTypeID == examinationTypeID);
- if (examinationProjectID.HasValue)
- ebrexp = ebrexp.And(x => x.ExaminationProjectID == examinationProjectID);
- var query = examinationScoreDAL.GetExaminationScoreView(esexp, ebrexp, ebexp, epexp, x => true, x => true, x => true, x => true);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue) && !string.IsNullOrEmpty(configuretView.Attribute))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue);
- return query.OrderByDescending(x => x.SchoolyearCode).ThenBy(x => x.ExaminationBatchID).ThenBy(x => x.ExaminationTypeID).ThenBy(x => x.ExaminationProjectID)
- .ThenBy(x => x.ExaminationSubjectID).ToGridResultSet<ExaminationScoreView>(pageIndex, pageSize);
- }
- }
- }
|