無限子類,無限選單的演算法
阿新 • • 發佈:2019-01-28
//------------------------------------------------------------多層判斷開始 string lblClassNames="";//當前類名稱 string str=""; if(this.Request.QueryString["classID"]!="" && this.Request.QueryString["classID"]!=null) { parents=Convert.ToInt32(this.Request.QueryString["ClassID"]); this.classNameID=parents.ToString(); } else { this.classNameID="0"; parents=0; } int parent=parents; if(this.Request.QueryString["layer"]!="" && this.Request.QueryString["layer"]!=null) { int classID; string className=""; string sql=""; bool isGetClassName=true; Inc inc=new Inc(); layers=Convert.ToInt32(this.Request.QueryString["layer"]); for(int ii=layers;ii>0;ii--) { sql="select className from proClass where id="+parents.ToString(); className=inc.getItem(sql); classTop=""+className+""+classTop; sql="select id from proClass where id="+parents.ToString(); classID=Convert.ToInt32(inc.getItem(sql)); sql="select parent from proClass where id="+parents.ToString(); parents=Convert.ToInt32(inc.getItem(sql)); str="》"+className+""+str; if(isGetClassName) { lblClassNames=className; } } parents=parent; } else { layers=0; } classTop=str; //輸出頂端連結 //------------------------------------------多層判斷結束