public void ShowBOM(IList<CBF.Model.BOM> boms, IList<CBF.Model.BOMDisplay> listBoms,int parentId)
{
foreach (var b in boms)
{
BOMDisplay bOMToBOMDisplay = BOMToBOMDisplay(b, listBoms,parentId);
listBoms.Add(bOMToBOMDisplay);
//ICriteria criteria = this._session.CreateCriteria(typeof(CBF.Model.BOM));
//criteria.Add(Expression.In("ParentId", new List<string>() { b.Id.ToString() }));
string strSQL = string.Format(@"if exists(select * from mes_bom where parentid ='{0}')
begin
select * from mes_bom where parentid ='{1}'
end
else if exists(select * from MES_BOM where ItemNO = '{2}' and ParentID = 0)
begin
select * from MES_BOM where ParentID in(select ID from MES_BOM where ItemNO = '{3}' and ParentID = 0)
end
else
select * from mes_bom where parentid ='{4}'
", b.Id, b.Id, b.ItemNO, b.ItemNO,b.Id);
IList<CBF.Model.BOM> iboms = _session.CreateSQLQuery(strSQL).AddEntity(typeof(BOM)).List<BOM>();
if (iboms.Count > 0)
{
ShowBOM(iboms, listBoms, bOMToBOMDisplay.IId);
}
}
}