zoukankan      html  css  js  c++  java
  • 递归方法

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

    }
    }

  • 相关阅读:
    PHP之目录遍历
    PHP之验证码
    PHP之验证码
    PHP之异常处理模式
    PHP之pdo的预处理模式
    PHP之PDO
    PHP之cookie和session
    PHP之MVC
    单例模式
    ThreadLocal
  • 原文地址:https://www.cnblogs.com/chengjun/p/5274726.html
Copyright © 2011-2022 走看看