123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.Cultureplan;
- using EMIS.ViewModel;
- using EMIS.Entities;
- using EMIS.ViewModel.DQPSystem;
- namespace EMIS.CommonLogic.DQPSystem
- {
- public partial class SOCServices
- {
- public IGridResultSet<CoursematerialView> GetTeacherCoursematerialViewList(ConfiguretView conditionView,
- Guid schoolyearID, Guid userID, int? pageIndex, int? pageSize)
- {
- Expression<Func<DQP_SOC, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE && x.SchoolyearID == schoolyearID);
- Expression<Func<CF_Staff, bool>> staffExp = (x => x.UserID == userID);
- var query = this.SOCDAL.GetStaffRelateCoursematerialViewQueryable(exp, staffExp);
- if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
- query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
- query = query.OrderBy(x => x.CourseCode);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- public IGridResultSet<CoursematerialView> GetStudentCoursematerialViewList(ConfiguretView conditionView,
- Guid? schoolyearID, Guid userID, int? pageIndex, int? pageSize)
- {
- Expression<Func<DQP_SOC, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<CF_Student, bool>> studentExp = (x => x.UserID == userID);
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- }
- var query = this.SOCDAL.GetStudentRelateCoursematerialViewQueryable(exp, studentExp);
- if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
- query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
- query = query.OrderBy(x => x.CourseCode);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- public IGridResultSet<SOCStudentView> GetSOCStudentViewGrid(ConfiguretView conditionView, Guid? schoolyearID, Guid? coursematerialID, Guid userID, int? status, int? pageIndex, int? pageSize)
- {
- Expression<Func<DQP_SOC, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- Expression<Func<CF_Student, bool>> studentExp = (x => x.UserID == userID);
- if (schoolyearID.HasValue)
- {
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- }
- if (coursematerialID.HasValue)
- {
- exp = exp.And(x => x.CoursematerialID == coursematerialID);
- }
- if (status.HasValue)
- {
- exp = exp.And(x => x.RecordStatus == status);
- }
- var query = this.SOCDAL.GetSOCStudentViewQueryable(exp, studentExp);
- if (!string.IsNullOrEmpty(conditionView.ConditionValue) && !string.IsNullOrEmpty(conditionView.Attribute))
- query = query.DynamicWhere(conditionView.Attribute, conditionView.Condition, conditionView.ConditionValue);
- query = query.OrderByDescending(x => x.SchoolyearCode)
- .ThenBy(x => x.CourseCode)
- .ThenBy(x => x.Name);
- return query.ToGridResultSet(pageIndex, pageSize);
- }
- }
- }
|