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;
namespace EMIS.DataLogic.Common.TeachingMaterial
{
public class PublishDAL
{
public PublishRepository PublishRepository { get; set; }
///
/// 获取出版单位信息列表
///
///
///
public IQueryable GetPulishGridView(Expression> exp)
{
var view = PublishRepository.GetList(exp).Select(x => new PublisherView
{
PublishID = x.PublishID,
Email = x.Email,
Address = x.Address,
BandCard = x.BandCard,
BandName = x.BandName,
ContectUser = x.ContectUser,
Ein = x.Ein,
Desc = x.Desc,
Fax = x.Fax,
IsPrint = x.IsPrint.Value,
IsPrintName = x.IsPrint.Value == true ? "是" : "否",
IsPulish = x.IsPulish.Value,
IsPulishName = x.IsPulish.Value ==true ? "是" : "否",
IsSupplier = x.IsSupplier.Value,
IsSupplierName = x.IsSupplier.Value == true ? "是" : "否",
Mobile = x.Mobile,
Phone = x.Phone,
UnitCode = x.UnitCode,
UnitName = x.UnitName,
UnitShortName = x.UnitShortName
});
return view;
}
///
/// 获取出版单位单位
///
///
public PublisherView GetSinglePublish(Guid publishID)
{
var publish = PublishRepository.GetSingle(x => x.PublishID == publishID);
var publishView = new PublisherView()
{
PublishID = publish.PublishID,
Ein = publish.Ein,
Desc = publish.Desc,
Phone = publish.Phone,
Mobile = publish.Mobile,
UnitName = publish.UnitName,
UnitCode = publish.UnitCode,
UnitShortName = publish.UnitShortName,
IsPrint = publish.IsPrint.GetValueOrDefault(),
IsPulish = publish.IsPulish.GetValueOrDefault(),
IsSupplier = publish.IsSupplier.GetValueOrDefault(),
Address = publish.Address,
BandCard = publish.BandCard,
BandName = publish.BandName,
ContectUser = publish.ContectUser,
Email = publish.Email,
Fax = publish.Fax
};
return publishView;
}
}
}