123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using System.Reflection;
- using System.ComponentModel;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.StudentManage.OnlineChecking;
- using EMIS.ViewModel.StudentManage.StudentProfile;
- using EMIS.DataLogic.StudentManage.OnlineChecking;
- namespace EMIS.CommonLogic.StudentManage.OnlineChecking
- {
- public class CheckingControlServices : BaseServices , ICheckingControlServices
- {
- public Lazy<CheckingControlDAL> CheckingControlDAL { get; set; }
- /// <summary>
- /// 查询对应的学生校对控制信息CheckingControlView
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="checkingTypeID"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<CheckingControlView> GetStudentEditControlViewGrid(ConfiguretView configuretView, int? checkingTypeID, int pageIndex, int pageSize)
- {
- Expression<Func<CF_StudentEditControl, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (checkingTypeID.HasValue)
- {
- exp = exp.And(x => x.CheckingTypeID == checkingTypeID);
- }
- var query = CheckingControlDAL.Value.GetStudentEditControlQueryable(exp);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = query.OrderBy(x => x.OrderNo).ToGridResultSet<CheckingControlView>(pageIndex, pageSize);
- result.rows.ForEach(x =>
- {
- var property = typeof(StudentView).GetProperty(x.ColumnName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
- if (property == null)
- {
- return;
- }
- var displayNameAttribute = (DisplayNameAttribute)property.GetCustomAttributes(typeof(DisplayNameAttribute), false).FirstOrDefault();
- if (displayNameAttribute != null)
- {
- x.DisplayColumnName = displayNameAttribute.DisplayName;
- }
- });
- result.rows = result.rows.Where(x => x.DisplayColumnName != null).ToList();
- result.total = result.rows.Count;
- return result;
- }
- /// <summary>
- /// 查询对应的学生校对控制信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="checkingTypeID"></param>
- /// <returns></returns>
- public IList<CheckingControlView> GetStudentEditControlViewList(ConfiguretView configuretView, int? checkingTypeID)
- {
- Expression<Func<CF_StudentEditControl, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (checkingTypeID.HasValue)
- {
- exp = exp.And(x => x.CheckingTypeID == checkingTypeID);
- }
- var query = CheckingControlDAL.Value.GetStudentEditControlQueryable(exp);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = query.OrderBy(x => x.OrderNo).ToList();
- result.ForEach(x =>
- {
- var property = typeof(StudentView).GetProperty(x.ColumnName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
- if (property == null)
- {
- return;
- }
- var displayNameAttribute = (DisplayNameAttribute)property.GetCustomAttributes(typeof(DisplayNameAttribute), false).FirstOrDefault();
- if (displayNameAttribute != null)
- {
- x.DisplayColumnName = displayNameAttribute.DisplayName;
- }
- });
- result = result.Where(x => x.DisplayColumnName != null).ToList();
- return result;
- }
- /// <summary>
- /// 学生信息校对控制设置
- /// </summary>
- /// <param name="columnNames"></param>
- /// <param name="checkingTypeIDs"></param>
- public void StudentEditControlSet(IList<string> columnNames, IList<int?> checkingTypeIDs)
- {
- List<CF_StudentEditControl> studentEditControlUpList = new List<CF_StudentEditControl>();
- for (int i = 0; i < columnNames.Count(); i++)
- {
- var columnName = columnNames[i];
- Expression<Func<CF_StudentEditControl, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- exp = exp.And(x => x.ColumnName == columnName);
- var studentEditControl = CheckingControlDAL.Value.StudentEditControlRepository.GetList(exp).SingleOrDefault();
- if (studentEditControl != null)
- {
- studentEditControl.CheckingTypeID = checkingTypeIDs[i];
- this.SetModifyStatus(studentEditControl);
- studentEditControlUpList.Add(studentEditControl);
- }
- }
- if (studentEditControlUpList != null && studentEditControlUpList.Count() > 0)
- {
- UnitOfWork.BatchUpdate(studentEditControlUpList);
- }
- }
- }
- }
|