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 System.Linq.Expressions; using Bowin.Common.Linq; using EMISOnline.DataLogic.Educational; namespace EMISOnline.CommonLogic.EducationalServices { public class StudentsServices : BaseServices, IStudentsServices { public StudentsDAL StudentsDAL { get; set; } public IGridResultSet GetStudentList(int pageIndex, int pageSize, string loginID, string name, int? studentStatus, string schoolyear, string standardName) { Expression> exp = (e => true); if (!string.IsNullOrEmpty(loginID)) { exp = exp.And(e => e.LoginID.Contains(loginID.Trim())); } if (!string.IsNullOrEmpty(name)) { exp = exp.And(e => e.Name.Contains(name.Trim())); } if (studentStatus.HasValue && studentStatus > 0) { exp = exp.And(e => e.StudentStatus == studentStatus); } if (!string.IsNullOrEmpty(schoolyear)) { exp = exp.And(e => e.SchoolyearName.Contains(schoolyear.Trim())); } if (!string.IsNullOrEmpty(standardName)) { exp = exp.And(e => e.StandardName.Contains(standardName.Trim())); } var list = StudentsDAL.GetStudentList().Where(exp).OrderByDescending(r => r.CreateTime).ToGridResultSet(pageIndex, pageSize); return list; } } }