学习园地
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 学习园地
|
||||
/// </summary>
|
||||
public static class APIStudyZoneService
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取学习园地列表
|
||||
/// </summary>
|
||||
/// <param name="supId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.StudyZoneType> getStudyZoneTypeList(string supId)
|
||||
{
|
||||
using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_StudyZone
|
||||
orderby x.StudyZoneCode
|
||||
select new Model.StudyZoneType
|
||||
{
|
||||
StudyZoneId = x.StudyZoneId,
|
||||
StudyZoneCode = x.StudyZoneCode,
|
||||
StudyZoneName = x.StudyZoneName,
|
||||
SupStudyZoneId = x.SupStudyZoneId,
|
||||
IsEndLever = x.IsEndLever ?? true,
|
||||
}).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(supId))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.SupStudyZoneId == supId).ToList();
|
||||
}
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 获取学习园地教材列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取学习园地列表
|
||||
/// </summary>
|
||||
/// <param name="typeId"></param>
|
||||
/// <param name="itemName"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.StudyZoneItemItem> getStudyZoneItemList(string typeId, string itemName)
|
||||
{
|
||||
using (Model.CNPCDB db = new Model.CNPCDB(Funs.ConnString))
|
||||
{
|
||||
var getDataLists = (from x in db.Training_StudyZoneItem
|
||||
join y in db.Training_StudyZone on x.StudyZoneId equals y.StudyZoneId into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
orderby x.StudyZoneItemCode
|
||||
select new Model.StudyZoneItemItem
|
||||
{
|
||||
StudyZoneItemId = x.StudyZoneItemId,
|
||||
StudyZoneId = x.StudyZoneId,
|
||||
StudyZoneCode = y.StudyZoneCode,
|
||||
StudyZoneName = y.StudyZoneName,
|
||||
StudyZoneItemCode = x.StudyZoneItemCode,
|
||||
StudyZoneItemName = x.StudyZoneItemName,
|
||||
AttachUrl = db.AttachFile.FirstOrDefault(y => y.ToKeyId == x.StudyZoneItemId).AttachUrl.Replace("\\", "/"),
|
||||
//AttachUrl = x.AttachUrl.Replace('\\', '/'),
|
||||
}).ToList();
|
||||
if (!string.IsNullOrWhiteSpace(typeId))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.StudyZoneId == typeId).ToList();
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(itemName))
|
||||
{
|
||||
getDataLists = getDataLists.Where(x => x.StudyZoneItemName.Contains(itemName)).ToList();
|
||||
}
|
||||
return getDataLists;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user