123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.TeachingMaterial;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using EMIS.ViewModel.Students;
- using Bowin.Common.Linq;
- using EMIS.DataLogic.Common.Studentsetting;
- using EMIS.DataLogic.Common.Students;
- namespace EMIS.DataLogic.Common.TeachingMaterial
- {
- public class StudentDistributeDAL
- {
- #region --0.0 定义--
- public StudentDistributeRepository StudentDistributeRepository { get; set; }
- public TeachingMaterialPoolRepository TeachingMaterialPoolRepository { get; set; }
- public SchoolyearRepository SchoolyearRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public CoursematerialRepository CoursematerialRepository { get; set; }
- public SpecialtyPlanRepository SpecialtyPlanRepository { get; set; }
- public CollegeRepository CollegeRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public GrademajorRepository GrademajorRepository { get; set; }
- public FacultymajorRepository FacultymajorRepository { get; set; }
- public SpecialtyCourseRepository SpecialtyCourseRepository { get; set; }
- public ClassmajorRepository ClassmajorRepository { get; set; }
- public PublishRepository PublishRepository { get; set; }
- public TeachingMateriaInventoryRepository TeachingMateriaInventoryRepository { get; set; }
- public StudentRepository StudentRepository { get; set; }
- public RecruitstudentsRepository RecruitstudentsRepository { get; set; }
- public StudentProfileRepository StudentProfileRepository { get; set; }
- public StudentsOrderRepository StudentsOrderRepository { get; set; }
- public StaffRepository StaffRepository { get; set; }
- public InSchoolSettingRepository inSchoolSettingRepository { get; set; }
- #endregion
- /// <summary>
- /// 获取学生发放信息列表
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<StudentDistributeView> GetStudentDistributeGridView(Expression<Func<ET_StudentDistribute, bool>> exporder)
- {
- var teaquery = from tmi in TeachingMateriaInventoryRepository.Entities
- group tmi by tmi.TeachingMaterialPoolID
- into t
- select new InventoryView
- {
- TeachingMaterialPoolID = t.Key,
- PresentInventory = t.Sum(x => x.PresentInventory),
- };
- var inSchoolStatusIDList = inSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();//获取选中的在校设定状态、
- var view = (from so in StudentDistributeRepository.GetList(exporder)
- join u in UserRepository.Entities on so.CreateUserID equals u.UserID
- join tmp in TeachingMaterialPoolRepository.Entities on so.TeachingMaterialPoolID equals tmp.TeachingMaterialPoolID into ttmp
- from ctmp in ttmp.DefaultIfEmpty()
- join kc in teaquery on so.TeachingMaterialPoolID equals kc.TeachingMaterialPoolID into kctmp
- from kcmp in kctmp.DefaultIfEmpty()
- join fdi in DictionaryItemRepository.Entities on new { so.EM_SpecialtyPlan.CF_Grademajor.CF_Facultymajor.StandardID, DictionaryCode = typeof(CF_Standard).Name }
- equals new { StandardID = fdi.Value, fdi.DictionaryCode } into tfdi
- from cfdi in tfdi.DefaultIfEmpty()
- join sct in DictionaryItemRepository.Entities on new { so.EM_SpecialtyPlan.CourseCategoryID, DictionaryCode =typeof(CF_CourseCategory).Name }
- equals new { CourseCategoryID = sct.Value, sct.DictionaryCode } into tsct
- from csct in tsct.DefaultIfEmpty()
- join sctt in DictionaryItemRepository.Entities on new { so.EM_SpecialtyPlan.CourseTypeID, DictionaryCode = typeof(CF_CourseType).Name }
- equals new { CourseTypeID = sctt.Value, sctt.DictionaryCode } into tsctt
- from csctt in tsctt.DefaultIfEmpty()
- join scq in DictionaryItemRepository.Entities on new { so.EM_SpecialtyPlan.CourseQualityID, DictionaryCode = typeof(CF_CourseQuality).Name }
- equals new { CourseQualityID = scq.Value, scq.DictionaryCode } into tscq
- from cscq in tscq.DefaultIfEmpty()
- join sdord in StudentsOrderRepository.Entities on new { SpecialtyPlanID = (Guid)so.SpecialtyPlanID, so.TeachingMaterialPoolID }
- equals new { SpecialtyPlanID = sdord.SpecialtyPlanID, sdord.TeachingMaterialPoolID }
- into tsdord
- from ctsdord in tsdord.DefaultIfEmpty()
- select new StudentDistributeView
- {
- GrademajorID = so.EM_SpecialtyPlan.CF_Grademajor.GrademajorID,
- StudentDistributeID = so.StudentDistributeID,
- SchoolyearID = so.EM_SpecialtyPlan.SchoolyearID,
- SchoolyearCode = so.EM_SpecialtyPlan.CF_Schoolyear.Code,
- TeachingMaterialPoolID = ctmp.TeachingMaterialPoolID,
- CollegeID = so.EM_SpecialtyPlan.CF_Grademajor.CF_Facultymajor.CF_College.CollegeID,
- CollegeName = so.EM_SpecialtyPlan.CF_Grademajor.CF_Facultymajor.CF_College.Name,
- CollegeNo = so.EM_SpecialtyPlan.CF_Grademajor.CF_Facultymajor.CF_College.No,
- GradeSpecialtyCode = so.EM_SpecialtyPlan.CF_Grademajor.Code,
- GradeSpecialtyName = so.EM_SpecialtyPlan.CF_Grademajor.Name,
- GrademajorCode = so.EM_SpecialtyPlan.CF_Grademajor.Code,
- GrademajorName = so.EM_SpecialtyPlan.CF_Grademajor.Name,
- Years = so.EM_SpecialtyPlan.CF_Grademajor.GradeID,
- GradeID = so.EM_SpecialtyPlan.CF_Grademajor.GradeID,
- StandardName = cfdi.Name,
- StudentQty = so.EM_SpecialtyPlan.CF_Grademajor.CF_Classmajor.Sum(w => w.CF_Student.Where(q => inSchoolStatusIDList.Contains(q.InSchoolStatusID)).Count()),
- OrderQty = ctsdord.OrderQty,
- CourseCode = so.EM_SpecialtyPlan.EM_Coursematerial.CourseCode,
- CourseName = so.EM_SpecialtyPlan.EM_Coursematerial.CourseName,
- CourseCategoryID = so.EM_SpecialtyPlan.CourseCategoryID,
- CourseCategoryName = csct.Name,
- // Years = sy.Years,
- CourseTypeID = so.EM_SpecialtyPlan.CourseTypeID,
- CourseTypeName = csctt.Name,
- CourseQualityID = so.EM_SpecialtyPlan.CourseQualityID,
- CourseQualityName = cscq.Name,
- CampusID = so.EM_SpecialtyPlan.CF_Grademajor.CF_Facultymajor.CF_College.CF_Campus.CampusID,
- StandardID = so.EM_SpecialtyPlan.CF_Grademajor.CF_Facultymajor.StandardID,
- SpecialtyValue = so.EM_SpecialtyPlan.CF_Grademajor.CF_Facultymajor.StandardID,
- CoursematerialID = so.EM_SpecialtyPlan.EM_Coursematerial.CoursematerialID,
- IsDistribute = (int)so.RecordStatus,
- IsDistributeName = so.RecordStatus == (int)CF_YesOrNoStatus.Yes ? "是" : "否",
- TeachingMaterialCode = ctmp.TeachingMaterialCode,
- TeachingMaterialName = ctmp.TeachingMaterialName,
- CreateTime = so.CreateTime,
- CreateUserName = u.Name,
- //Discount = kcmp.Discount == null ? 0 : (kcmp.Discount ?? 1) / (ctmp.Price ?? 1),
- //DiscountPrice = kcmp.Discount ?? 0,
- PresentInventory = kcmp.PresentInventory ?? 0,
- Price = ctmp.Price??0,
- RemainingQty = so.ET_StudentDistribute_CF_Student.Where(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID)).Count(),//获取未发放表学生数
- DistributeQty = so.DistributeQty - so.ET_StudentDistribute_CF_Student.Where(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID)).Count(),
- //DistributeQty = so.EM_SpecialtyPlan.CF_Grademajor.CF_Classmajor.Sum(w => w.CF_Student.Where(q => inSchoolStatusIDList.Contains(q.InSchoolStatusID)).Count()) - so.CF_Student.Where(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID)).Count(),
- ISBN = ctmp.ISBN,
- PublishTime = ctmp.PublishTime,//版本时间
- Author = ctmp.Author,
- PublishName = ctmp.CF_Publish.UnitName,
- TeachingMaterialTypeID = ctmp.TeachingMaterialTypeID ?? -1
- });
- return view;
- }
- public IQueryable<StudentDistributeView> GetAllUsableStudentDistribute()
- {
- var query = from sd in StudentDistributeRepository.GetList(x => x.RecordStatus == (int)SYS_STATUS.USABLE)
- select new StudentDistributeView
- {
- StudentDistributeID = sd.StudentDistributeID,
- SpecialtyPlanID = (Guid)sd.SpecialtyPlanID,
- };
- return query;
- }
- public IList<StudentOrderPrePlanView> GetStudentDistributeIDsBySpecialtyPlan(Guid schoolyearID)
- {
- var planList = (from sd in StudentDistributeRepository.Entities.Where(x => x.RecordStatus == (int)CF_YesOrNoStatus.No && x.TeachingMaterialPoolID == null)
- join sy in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == schoolyearID) on sd.EM_SpecialtyPlan.SchoolyearID equals sy.SchoolyearID
- select new StudentOrderPrePlanView
- {
- SpecialtyPlanID = (Guid)sd.SpecialtyPlanID
- }).ToList();
- //var planList = (from sp in SpecialtyPlanRepository.Entities.Where(x => x.IsNeedMaterial == true)
- // join sy in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == schoolyearID) on sp.SchoolyearID equals sy.SchoolyearID
- // join so in StudentDistributeRepository.Entities.Where(x => x.RecordStatus == (int)CF_YesOrNoStatus.No) on sp.SpecialtyPlanID equals so.SpecialtyPlanID into tso
- // from cso in tso.DefaultIfEmpty()
- // select new StudentOrderPrePlanView
- // {
- // SpecialtyPlanID = sp.SpecialtyPlanID
- // }).ToList();
- return planList;
- }
- /// <summary>
- /// 获取专业计划对应的需要征订的信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<StudentDistributePrePlanView> GetStudentDistributeRepositoryBySpecialtyPlan(Guid schoolyearID)
- {
- var inSchoolStatusIDList = inSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();//获取选中的在校设定状态、
- //TODO:增加生成学生发放数据时、以院系所为限制条件生成对应院系数据。
- //var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- Expression<Func<EM_SpecialtyPlan, bool>> exp = x => x.IsNeedMaterial == true;
- var planList = (from sp in SpecialtyPlanRepository.GetList(exp)
- join sy in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == schoolyearID) on sp.SchoolyearID equals sy.SchoolyearID
- join gj in GrademajorRepository.Entities on sp.GrademajorID equals gj.GrademajorID
- join cj in ClassmajorRepository.Entities on gj.GrademajorID equals cj.GrademajorID into tcj
- from ccj in tcj.DefaultIfEmpty()
- from ctlpv in sp.EM_Coursematerial.CF_TeachingMaterialPool.DefaultIfEmpty()
- join so in StudentDistributeRepository.Entities on sp.SpecialtyPlanID equals so.SpecialtyPlanID into tso
- from cso in tso.DefaultIfEmpty()
- where cso == null
- group new { sp, ccj, ctlpv }
- // group new { sp, sd = ccj.CF_Student, ctlpv }
- by new { sp.SpecialtyPlanID, ctlpv.TeachingMaterialPoolID, sp.CF_Grademajor.CF_Facultymajor.CollegeID } into g
- select new StudentDistributePrePlanView
- {
- SpecialtyPlanID = g.Key.SpecialtyPlanID,
- OrderQty = g.Sum(x => x.ccj.CF_Student.Where(e => inSchoolStatusIDList.Contains(e.InSchoolStatusID)).Count()),//只获取在校学生
- CollegeID = g.Key.CollegeID,
- TeachingMaterialPoolID = g.Key.TeachingMaterialPoolID
- });
- var ss = planList;
- //以学生征订提交数据为基准 (废弃)
- //var planList = (from sp in SpecialtyPlanRepository.Entities.Where(x => x.IsNeedMaterial == true)
- // join sy in SchoolyearRepository.Entities.Where(x => x.SchoolyearID == schoolyearID) on sp.SchoolyearID equals sy.SchoolyearID
- // join sd in StudentsOrderRepository.Entities.Where(x => x.IsOrdered == true) on sp.SpecialtyPlanID equals sd.SpecialtyPlanID
- // join gj in GrademajorRepository.Entities on sp.GrademajorID equals gj.GrademajorID
- // join sc in SpecialtyCourseRepository.Entities on sp.SpecialtyCourseID equals sc.SpecialtyCourseID
- // join cj in ClassmajorRepository.Entities on gj.GrademajorID equals cj.GrademajorID into tcj
- // from ccj in tcj.DefaultIfEmpty()
- // group new { sd, ccj }
- // by new { sd.SpecialtyPlanID, sd.TeachingMaterialPoolID } into g
- // select new StudentDistributePrePlanView
- // {
- // SpecialtyPlanID = g.Key.SpecialtyPlanID,
- // OrderQty = g.Sum(x => x.ccj.ClassNum ?? 0),
- // TeachingMaterialPoolID = (Guid)g.Key.TeachingMaterialPoolID
- // });
- return planList;
- }
- /// <summary>
- /// 根据征订ID获取发放数据
- /// </summary>
- /// <param name="studentsOrderIDs"></param>
- /// <returns></returns>
- public IList<ET_StudentDistribute> GetStudentDistributeListByStudentDistributeIDs(List<Guid> studentDistributeIDs)
- {
- return StudentDistributeRepository.GetList(x => studentDistributeIDs.Contains(x.StudentDistributeID)).ToList();
- }
- /// <summary>
- /// 获取当前学年学期所有未发学生信息
- /// </summary>
- /// <param name="filter"></param>
- /// <returns></returns>
- public IList<StudentDistribute_UserView> GetStudentQueryable(Expression<Func<ET_StudentDistribute, bool>> filter)
- {
- var query = from a in StudentDistributeRepository.GetList(filter)
- from c in a.ET_StudentDistribute_CF_Student.Where(x => x.InSchoolStatusID == 1)
- join sp in SpecialtyPlanRepository.Entities on a.SpecialtyPlanID equals sp.SpecialtyPlanID
- join cos in CoursematerialRepository.Entities on sp.CoursematerialID equals cos.CoursematerialID
- join recruitStudent in RecruitstudentsRepository.Entities on c.UserID equals recruitStudent.UserID
- join u in UserRepository.Entities on a.CreateUserID equals u.UserID
- from b in c.EM_StudentReport.AsQueryable().Where(w => w.CF_Schoolyear.IsCurrent == true).DefaultIfEmpty() //当前学年学期的报到情况
- select new StudentDistribute_UserView
- {
- UserID = c.UserID,
- LoginID = c.Sys_User.LoginID,
- Name = c.Sys_User.Name,
- TeachingMaterialCode = a.CF_TeachingMaterialPool.TeachingMaterialCode,
- TeachingMaterialName = a.CF_TeachingMaterialPool.TeachingMaterialName,
- Remark = a.Remark,
- CreateTime = (DateTime)a.CreateTime,
- CreateUserName = u.Name,
- CourseName = cos.CourseName,
- CourseCode = cos.CourseCode
- };
- return query.ToList();
- }
- public StudentDistributeView GetSingleStudentDistribute(Expression<Func<ET_StudentDistribute, bool>> filter)
- {
- var view = from a in StudentDistributeRepository.GetList(filter)
- select new StudentDistributeView
- {
- IsDistribute = (int)a.RecordStatus,
- StudentDistributeID = a.StudentDistributeID
- };
- return view.FirstOrDefault();
- }
- /// <summary>
- /// 获取当前学年学期所有学生信息
- /// </summary>
- /// <param name="filter"></param>
- /// <returns></returns>
- public IQueryable<StudentDistribute_UserView> GetStudentQueryable_User(Expression<Func<ET_StudentDistribute, bool>> filter)
- {
- var query = from so in StudentDistributeRepository.Entities.Where(filter)
- join sp in SpecialtyPlanRepository.Entities on so.SpecialtyPlanID equals sp.SpecialtyPlanID
- join sy in SchoolyearRepository.Entities on sp.SchoolyearID equals sy.SchoolyearID
- join gj in GrademajorRepository.Entities on sp.GrademajorID equals gj.GrademajorID
- join fj in FacultymajorRepository.Entities on gj.FacultymajorID equals fj.FacultymajorID
- join co in CollegeRepository.Entities on fj.CollegeID equals co.CollegeID
- join cos in CoursematerialRepository.Entities on sp.CoursematerialID equals cos.CoursematerialID
- join u in UserRepository.Entities on so.CreateUserID equals u.UserID
- join tmp in TeachingMaterialPoolRepository.Entities on so.TeachingMaterialPoolID equals tmp.TeachingMaterialPoolID into ttmp
- from ctmp in ttmp.DefaultIfEmpty()
- from bj in gj.CF_Classmajor
- from sd in bj.CF_Student.Where(x => x.InSchoolStatusID == 1)
- select new StudentDistribute_UserView
- {
- UserID = sd.UserID,
- LoginID = sd.Sys_User.LoginID,
- Name = sd.Sys_User.Name,
- Sex = sd.SexID,
- ClassMajorName = sd.CF_Classmajor.Name,
- InSchoolStatusID = sd.InSchoolStatusID,
- StudentStatus = sd.StudentStatus,
- TeachingMaterialCode = ctmp.TeachingMaterialCode,
- TeachingMaterialName = ctmp.TeachingMaterialName,
- Remark = so.Remark,
- CreateTime = (DateTime)so.CreateTime,
- CreateUserName = u.Name,
- CourseName = cos.CourseName,
- CourseCode = cos.CourseCode
- };
- return query;
- }
- /// <summary>
- /// 获取已发放学生
- /// </summary>
- /// <param name="filter"></param>
- /// <returns></returns>
- public IQueryable<StudentDistributeView> GetStudentQueryableByStudentDistributeID(Expression<Func<ET_StudentDistribute, bool>> filter)
- {
- var inSchoolStatusIDList = inSchoolSettingRepository.GetList(x => x.IsSelected == true).Select(w => w.InSchoolStatusID).ToList();//获取选中的在校设定状态、
- //1.0 获取未发学生
- var userIdlist = (from a in StudentDistributeRepository.Entities.Where(filter)
- from sd in a.ET_StudentDistribute_CF_Student
- //.Where(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID))
- select new StudentDistributeView
- {
- RecipientUserID = sd.UserID
- }).ToList();
- List<Guid> userList = new List<Guid>();
- if (userIdlist.Count > 0)
- {
- foreach (var Id in userIdlist)
- {
- userList.Add(Id.RecipientUserID);
- }
- }
- //2.0 获取发放学生
- var query = from a in StudentDistributeRepository.Entities.Where(filter)
- join tmp in TeachingMaterialPoolRepository.Entities on a.TeachingMaterialPoolID equals tmp.TeachingMaterialPoolID into ttmp
- from ctmp in ttmp.DefaultIfEmpty()
- // from sdnt in a.CF_Student //未发学生
- join u in UserRepository.Entities on a.ModifyUserID equals u.UserID into tu
- from ctu in tu.DefaultIfEmpty()
- from spl in a.EM_SpecialtyPlan.CF_Grademajor.CF_Classmajor
- from cls in spl.CF_Student
- //.Where(x => inSchoolStatusIDList.Contains(x.InSchoolStatusID)) //班级对应的学生
- where cls != null
- join tp in TeachingMateriaInventoryRepository.Entities on ctmp.TeachingMaterialPoolID equals tp.TeachingMaterialPoolID into ttp
- from cttp in ttp.DefaultIfEmpty()
- select new StudentDistributeView
- {
- TeachingMaterialCode = ctmp.TeachingMaterialCode,
- TeachingMaterialName = ctmp.TeachingMaterialName,
- StudentDistributeNo = a.StudentDistributeNo,
- DistributeQty = 1,//a.DistributeQty == null ? 1 : a.DistributeQty,
- Price = ctmp.Price,
- Discount = cttp.Discount,
- DiscountPrice = cttp.DiscountPrice,
- TotalPrice = ctmp.Price, //ctmp.Price * a.DistributeQty,
- TotalDollar = cttp.DiscountPrice,
- StockOutUserName = ctu.Name,
- CreateTime = (DateTime)a.CreateTime,
- ModifyTime = (DateTime)a.ModifyTime,
- StudentNo = cls.Sys_User.LoginID,
- StudentName = cls.Sys_User.Name,
- RecipientUser = a.RecipientUser,
- RecipientUserID = cls.UserID,
- Remark = a.Remark
- };
- return query.Where(x => !userList.Contains(x.RecipientUserID)).Distinct();
- }
- public IQueryable<StudentDistributeGenerateView> GetStudentDistributeGenerateView(Expression<Func<ET_StudentsOrder, bool>> exp)
- {
- var query = from order in StudentsOrderRepository.GetList(exp)
- join plan in SpecialtyPlanRepository.Entities on order.SpecialtyPlanID equals plan.SpecialtyPlanID
- join grade in
- (
- from grade in GrademajorRepository.Entities
- join classmajor in ClassmajorRepository.Entities on grade.GrademajorID equals classmajor.GrademajorID
- join student in StudentRepository.Entities on classmajor.ClassmajorID equals student.ClassmajorID
- join inschool in inSchoolSettingRepository.Entities on student.InSchoolStatusID equals inschool.InSchoolStatusID
- where inschool.IsSelected == true
- group student by grade.GrademajorID into g
- select new { GrademajorID = g.Key, StudentCount = (int?)g.Count() }
- ) on plan.GrademajorID equals grade.GrademajorID
- join distribute in StudentDistributeRepository.Entities.Where(x => x.RecordStatus == (int)SYS_STATUS.UNUSABLE)
- on new { SpecialtyPlanID = order.SpecialtyPlanID, order.TeachingMaterialPoolID } equals new { SpecialtyPlanID = (Guid)distribute.SpecialtyPlanID, distribute.TeachingMaterialPoolID } into ddistribute
- from distribute in ddistribute.DefaultIfEmpty()
- join submited in StudentDistributeRepository.Entities.Where(x => x.RecordStatus == (int)SYS_STATUS.USABLE)
- on new { order.SpecialtyPlanID, order.TeachingMaterialPoolID } equals new { SpecialtyPlanID = (Guid)submited.SpecialtyPlanID, submited.TeachingMaterialPoolID } into dsubmited
- from submited in dsubmited.DefaultIfEmpty()
- where (grade.StudentCount ?? 0) > 0 && submited.StudentDistributeID == null
- select new StudentDistributeGenerateView
- {
- SpecialtyPlanID = order.SpecialtyPlanID,
- TeachingMaterialPoolID = order.TeachingMaterialPoolID,
- StudentCount = grade.StudentCount ?? 0,
- OldStudentDistributeID = distribute.StudentDistributeID
- };
- return query;
- }
- public IQueryable<InventoryView> GetInventory(Guid poolID)
- {
- var query = from tmi in TeachingMateriaInventoryRepository.GetList(x => x.TeachingMaterialPoolID == poolID && x.PresentInventory > 0)
- select new InventoryView
- {
- TeachingMaterialPoolID = tmi.TeachingMaterialPoolID,
- PresentInventory = tmi.PresentInventory,
- CreateTime = tmi.CreateTime,
- };
- return query;
- }
- }
- }
|