using System; using System.Collections.Generic; using System.Linq; using System.Text; using Model; using BLL; namespace BLL { public static class APIUnitInfoService { /// /// 根据项目和单位类型获取分包单位 /// /// 施工号 /// 单位类型(1-业主,2-监理,3-总包,4-施工,5-质检,6-理化,7-热处理,8-检测) /// public static List 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; } } } } }