private string GetFilterCategory(int categoryID) { if (dicCateFilter.ContainsKey(categoryID)) { return(dicCateFilter[categoryID]); } else { //codeContains = String.Format(@"""c{0}""", objCat.ID.ToString("D3")); String r = String.Format("c{0}", categoryID.ToString("D3")); DBPhanSP.ListClassificationDataTable dt = new DBPhanSP.ListClassificationDataTable(); DBPhanSPTableAdapters.ListClassificationTableAdapter adt = new DBPhanSPTableAdapters.ListClassificationTableAdapter(); adt.Connection.ConnectionString = Server.ConnectionString; adt.FillBy_SelectOne(dt, categoryID); if (dt.Rows.Count > 0) { int idParent = Common.Obj2Int(dt.Rows[0]["ParentID"]); if (idParent != 0) { r += " " + GetFilterCategory(idParent); } } dt.Dispose(); adt.Dispose(); dicCateFilter[categoryID] = r; return(r); } }
private string GetFilterCategory(int categoryID) { if (dicCateFilter.ContainsKey(categoryID)) { return(dicCateFilter[categoryID]); } else { //codeContains = String.Format(@"""c{0}""", objCat.ID.ToString("D3")); String r = string.Empty; if (categoryID < 10) { r = "0" + categoryID.ToString(); } else { r = categoryID.ToString(); } DBPhanSP.ListClassificationDataTable dt = new DBPhanSP.ListClassificationDataTable(); QT.Users.DBPhanSPTableAdapters.ListClassificationTableAdapter adt = new QT.Users.DBPhanSPTableAdapters.ListClassificationTableAdapter(); adt.Connection.ConnectionString = QT.Entities.Server.ConnectionString; adt.FillBy_SelectOne(dt, categoryID); if (dt.Rows.Count > 0 && i < 3) { int idParent = QT.Entities.Common.Obj2Int(dt.Rows[0]["ParentID"]); if (idParent != 0) { r = GetFilterCategory(idParent) + "/" + r; } } dt.Dispose(); adt.Dispose(); dicCateFilter[categoryID] = r; return(r); } }