90 lines
2.9 KiB
C#
90 lines
2.9 KiB
C#
|
|
using Cowain.Preheat.Model.Models;
|
||
|
|
using Cowain.Preheat.Common.Enums;
|
||
|
|
using Cowain.Preheat.Model;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Data;
|
||
|
|
using System.Linq;
|
||
|
|
|
||
|
|
using Unity;
|
||
|
|
|
||
|
|
|
||
|
|
namespace Cowain.Preheat.BLL
|
||
|
|
{
|
||
|
|
public class StationDetailService : ServiceBase
|
||
|
|
{
|
||
|
|
public StationDetailService(IUnityContainer unityContainer) : base(unityContainer)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<TStationDetail> GeStationDetail()
|
||
|
|
{
|
||
|
|
using (var Context = new PreheatEntities())
|
||
|
|
{
|
||
|
|
return Context.Set<TStationDetail>().OrderBy(x => x.Id).ToList();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<ExStationDetailModel> GetExAll()
|
||
|
|
{
|
||
|
|
using (var Context = new PreheatEntities())
|
||
|
|
{
|
||
|
|
return (from a in Context.Set<TStation>()
|
||
|
|
join b in Context.Set<TStationDetail>() on a.Id equals b.StationId
|
||
|
|
select new ExStationDetailModel
|
||
|
|
{
|
||
|
|
StationId = a.Id,
|
||
|
|
Name = a.Name,
|
||
|
|
Desc = a.Desc,
|
||
|
|
Layers = a.Layers,
|
||
|
|
Columns = a.Columns,
|
||
|
|
Number = a.Number,
|
||
|
|
PosX = a.PosX,
|
||
|
|
PosY = a.PosY,
|
||
|
|
Type = a.Type,
|
||
|
|
LeftMargin = a.LeftMargin,
|
||
|
|
Enable = a.Enable,
|
||
|
|
|
||
|
|
Id = b.Id,
|
||
|
|
StationDetailName = b.Name,
|
||
|
|
Layer = b.Layer,
|
||
|
|
DetailNumber = b.Number,
|
||
|
|
Column = b.Column,
|
||
|
|
Remark = b.Remark,
|
||
|
|
StationDetailEnable = b.Enable,
|
||
|
|
DeviceId = b.DeviceId
|
||
|
|
}).ToList();
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<TStationDetail> GetStations(EStationType stationType)
|
||
|
|
{
|
||
|
|
using (var Context = new PreheatEntities())
|
||
|
|
{
|
||
|
|
return (from a in Context.Set<TStation>()
|
||
|
|
join b in Context.Set<TStationDetail>() on a.Id equals b.StationId
|
||
|
|
where a.Id == (int)stationType
|
||
|
|
select b).OrderBy(x=>x.Id).ToList();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public TStationDetail GetStationDetailByName(string name)
|
||
|
|
{
|
||
|
|
using (var Context = new PreheatEntities())
|
||
|
|
{
|
||
|
|
return Context.Set<TStationDetail>().Where(x => x.Name == name).ToList()[0];
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public TStationDetail GetStationDetailById(int id)
|
||
|
|
{
|
||
|
|
using (var Context = new PreheatEntities())
|
||
|
|
{
|
||
|
|
return Context.Set<TStationDetail>().Where(x => x.Id == id).FirstOrDefault();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|