12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.Entities;
- using EMIS.ViewModel.TeachingMaterial;
- using System.Linq.Expressions;
- namespace EMIS.DataLogic.Common.TeachingMaterial
- {
- public class LibraryDAL
- {
- public LibraryRepository LibraryRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public CampusRepository CampusRepository { get; set; }
- /// <summary>
- /// 获取出版单位信息列表
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<LibraryView> GetLibraryGridView(Expression<Func<CF_Library, bool>> exp)
- {
- var view = (from l in LibraryRepository.Entities.Where(exp)
- join c in CampusRepository.Entities on l.CampusID equals c.CampusID
- join u in UserRepository.Entities on l.CreateUserID equals u.UserID
- select new LibraryView
- {
- LibraryID = l.LibraryID,
- LibraryCode = l.LibraryCode,
- LibraryName = l.LibraryName,
- HeadPeople =l.HeadPeople,
- ContectTelNumber = l.ContectTelNumber,
- Desc = l.Desc,
- CampusCode = c.No,
- CampusName = c.Name,
- CampusID = l.CampusID,
- CreateTime = l.CreateTime,
- CreateUserName = u.Name
- });
- return view;
- }
- /// <summary>
- /// 获取出版单位单位
- /// </summary>
- /// <returns></returns>
- public LibraryView GetSingleLibrary(Guid libraryID)
- {
- var library = LibraryRepository.GetSingle(x => x.LibraryID == libraryID,
- (x => x.CF_Campus));
- var publishView = new LibraryView()
- {
- LibraryID = library.LibraryID,
- LibraryName = library.LibraryName,
- LibraryCode = library.LibraryCode,
- ContectTelNumber = library.ContectTelNumber,
- Desc = library.Desc,
- HeadPeople = library.HeadPeople,
- CampusID = library.CampusID,
- CampusCode = library.CF_Campus.No,
- CampusName = library.CF_Campus.Name
- };
- return publishView;
- }
-
- }
- }
|