1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMISOnline.Entities;
- using EMISOnline.ViewModel.Educational;
- using Bowin.Common.Linq.Entity;
- using EMISOnline.DataLogic.Educational;
- using System.Linq.Expressions;
- using Bowin.Common.Linq;
- namespace EMISOnline.CommonLogic.EducationalServices
- {
- public class CourseWareServices : BaseServices, ICourseWareServices
- {
- public CourseWareDAL CourseWareDAL { get; set; }
- public IGridResultSet<CourseWareView> GetCourseWareList(int pageIndex, int pageSize, string CourseVideoName,DateTime? beginTime, DateTime? endTime)
- {
- Expression<Func<CourseWareView, bool>> exp = (e => true);
- //if (!string.IsNullOrEmpty(grademajorName))
- //{
- // exp = exp.And(e => e.GrademajorName.Contains(grademajorName.Trim()));
- //}
- //if (!string.IsNullOrEmpty(courseName))
- //{
- // exp = exp.And(e => e.CoursematerialName.Contains(courseName.Trim()));
- //}
- //if (!string.IsNullOrEmpty(createUser))
- //{
- // exp = exp.And(e => e.CreateUserName.Contains(createUser.Trim()));
- //}
- if (!string.IsNullOrEmpty(CourseVideoName))
- {
- exp = exp.And(e => e.CourseVideoName.Contains(CourseVideoName.Trim()));
- }
- if (beginTime.HasValue)
- {
- exp = exp.And(e => e.CreateTime >= beginTime);
- }
- if (endTime.HasValue)
- {
- DateTime d = endTime.Value.AddDays(1);
- exp = exp.And(e => e.CreateTime <= d);
- }
- var list = CourseWareDAL.GetCourseWareList().Where(exp).OrderByDescending(e => e.GrademajorName).ThenBy(e => e.CoursematerialName).ThenBy(e => e.CourseVideoName)
- .ThenByDescending(e => e.CreateTime).ToGridResultSet(pageIndex, pageSize);
- return list;
- }
- }
- }
|