using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMISOnline.Entities; using System.Linq.Expressions; using EMISOnline.DataLogic.Educational; using Bowin.Common.Linq.Entity; using EMISOnline.ViewModel.Educational; using Bowin.Common.Linq; namespace EMISOnline.CommonLogic.EducationalServices { public class FacultymajorServices : BaseServices, IFacultymajorServices { public FacultymajorDAL FacultymajorDAL { get; set; } public IGridResultSet GetFacultymajorList(int pageIndex, int pageSize, string collegeName, string standardName, int? educationID, int? learningformID) { Expression> exp = (e => true); if (!string.IsNullOrEmpty(collegeName)) { exp = exp.And(e => e.CollegeName.Contains(collegeName.Trim())); } if (!string.IsNullOrEmpty(standardName)) { exp = exp.And(e => e.StandardName.Contains(standardName.Trim())); } if (educationID.HasValue && educationID > 0) { exp = exp.And(e => e.EducationID == educationID); } if (learningformID.HasValue && learningformID > 0) { exp = exp.And(e => e.LearningformID == learningformID); } var list = FacultymajorDAL.GetFacultymajorList().Where(exp).OrderBy(x => x.CollegeCode.Length).ThenBy(x => x.CollegeCode) .ThenBy(x => x.StandardID).ThenBy(x => x.Code).ToGridResultSet(pageIndex, pageSize); return list; } } }