1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Common.ProcurementPlan;
- using EMIS.ViewModel.TeachingMaterial;
- using Bowin.Common.Linq.Entity;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using Bowin.Common.Linq;
- using EMIS.CommonLogic.TeachingMaterial;
- namespace EMIS.CommonLogic.ProcurementPlan
- {
- public class PurchasingStatisticsServices : BaseServices, IPurchasingStatisticsServices
- {
- public PurchasingStatisticsDAL PurchasingStatisticsDAL { get; set; }
- public Lazy<ITeachersOrderServices> TeachersOrderServices { get; set; }
- public Bowin.Common.Linq.Entity.IGridResultSet<ViewModel.TeachingMaterial.PurchasingStatisticsView> GetPurchasingStatisticsViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? teachingMaterialPoolID, Guid? coursematerialID, Guid? publishID, int pageIndex, int pageSize)
- {
- var endStatusID = TeachersOrderServices.Value.GetCorrectEndStatus();
- Expression<Func<ET_TeachersOrder, bool>> exporder = (x => x.ApprovalStatus == endStatusID);
- Expression<Func<ET_StudentsOrder, bool>> stuExporder = (x => true);
- if (schoolyearID.HasValue)
- {
- exporder = exporder.And(x => x.SchoolyearID == schoolyearID);
- stuExporder = stuExporder.And(x => x.EM_SpecialtyPlan.SchoolyearID == schoolyearID);
- }
- if (teachingMaterialPoolID.HasValue)
- {
- exporder = exporder.And(x => x.TeachingMaterialPoolID == teachingMaterialPoolID);
- stuExporder = stuExporder.And(x => x.TeachingMaterialPoolID == teachingMaterialPoolID);
- }
- if (coursematerialID.HasValue)
- {
- exporder = exporder.And(x => x.CF_TeachingMaterialPool.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- stuExporder = stuExporder.And(x => x.CF_TeachingMaterialPool.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- }
- if (publishID.HasValue)
- {
- exporder = exporder.And(x => x.CF_TeachingMaterialPool.PublishID == publishID);
- stuExporder = stuExporder.And(x => x.CF_TeachingMaterialPool.PublishID == publishID);
- }
- var query = PurchasingStatisticsDAL.GetPurchasingStatisticsGridView(exporder, stuExporder);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
-
- return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.SchoolyearName).ToGridResultSet<PurchasingStatisticsView>(pageIndex, pageSize);
- return query.OrderBy(x => x.SchoolyearName).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<PurchasingStatisticsView>(pageIndex, pageSize);
- }
- public IList<ViewModel.TeachingMaterial.PurchasingStatisticsView> GetPurchasingStatisticsList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? teachingMaterialPoolID, Guid? coursematerialID, Guid? publishID)
- {
- var endStatusID = TeachersOrderServices.Value.GetCorrectEndStatus();
- Expression<Func<ET_TeachersOrder, bool>> exporder = (x => x.ApprovalStatus == endStatusID);
- Expression<Func<ET_StudentsOrder, bool>> stuExporder = (x => true);
- if (schoolyearID.HasValue)
- {
- exporder = exporder.And(x => x.SchoolyearID == schoolyearID);
- stuExporder = stuExporder.And(x => x.EM_SpecialtyPlan.SchoolyearID == schoolyearID);
- }
- if (teachingMaterialPoolID.HasValue)
- {
- exporder = exporder.And(x => x.TeachingMaterialPoolID == teachingMaterialPoolID);
- stuExporder = stuExporder.And(x => x.TeachingMaterialPoolID == teachingMaterialPoolID);
- }
- if (coursematerialID.HasValue)
- {
- exporder = exporder.And(x => x.CF_TeachingMaterialPool.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- stuExporder = stuExporder.And(x => x.CF_TeachingMaterialPool.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- }
- if (publishID.HasValue)
- {
- exporder = exporder.And(x => x.CF_TeachingMaterialPool.PublishID == publishID);
- stuExporder = stuExporder.And(x => x.CF_TeachingMaterialPool.PublishID == publishID);
- }
- var query = PurchasingStatisticsDAL.GetPurchasingStatisticsGridView(exporder, stuExporder);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- return query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.SchoolyearName).ToList();
- return query.OrderBy(x => x.SchoolyearName).ToList();
- }
- }
- }
|