public static string GetUnitParentSpecailUnitCode(string unitCode, string targetUnitType, ref string targetUnitName, ref string targetUnitFullCode) { string text7; try { string text = ""; string text2 = unitCode; EntityData allUnit = OBSDAO.GetAllUnit(); while (text2 != "") { DataRow[] rowArray = allUnit.CurrentTable.Select(string.Format("UnitCode='{0}'", text2)); if (rowArray.Length > 0) { string text3 = rowArray[0]["UnitType"].ToString(); string text4 = rowArray[0]["ParentUnitCode"].ToString(); string text5 = rowArray[0]["UnitName"].ToString(); string text6 = rowArray[0]["FullCode"].ToString(); if (text3 == targetUnitType) { text = text2; targetUnitName = text5; targetUnitFullCode = text6; break; } text2 = text4; } else { text2 = ""; } } allUnit.Dispose(); text7 = text; } catch (Exception exception) { throw exception; } return(text7); }