ZHJA_HJGL/HJGL_ZH/BLL/API/APIUnitInfoService.cs

42 lines
1.5 KiB
C#
Raw Normal View History

2024-05-08 17:17:11 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using BLL;
namespace BLL
{
public static class APIUnitInfoService
{
/// <summary>
/// 根据项目和单位类型获取分包单位
/// </summary>
/// <param name="projectCode">施工号</param>
/// <param name="unitType">单位类型1-业主2-监理3-总包4-施工5-质检6-理化7-热处理8-检测)</param>
/// <returns></returns>
public static List<Model.UnitInfoItem> getUnitByProjectIdUnitType(string projectCode, string unitType)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var p = db.Base_Project.FirstOrDefault(z => z.ProjectCode == projectCode);
if (p != null)
{
var getData = from x in Funs.DB.Base_Unit
join y in Funs.DB.Project_Unit on x.UnitId equals y.UnitId
where y.ProjectId == p.ProjectId && y.UnitType.Contains(unitType)
orderby x.UnitCode
select new Model.UnitInfoItem
{ UnitId = x.UnitId, UnitCode = x.UnitCode, UnitName = x.UnitName };
return getData.ToList();
}
else
{
return null;
}
}
}
}
}