ZHJA_HJGL/HJGL_ZH/BLL/API/APIUnitInfoService.cs

42 lines
1.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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;
}
}
}
}
}