private static string RecusionLinkMenu(CRM.Models.Menu obj, string link) { string result = string.Empty; if (obj.ParentId.HasValue) { CRM.Models.Menu objParent = new MenuDao().GetByID(obj.ParentId.Value, true); link = RecusionLinkMenu(objParent, link); link += FormatLink(obj); } else { link = link.Insert(0, FormatLink(obj)); } return link; }
public static String GetCurrentMenu(string orginalLink,bool isIndex) { string result = string.Empty; string[] array = orginalLink.Trim('/').Split('/'); for (int i = 0; i < array.Count(); i++) { CRM.Models.Menu objMenu = new MenuDao().GetByLink(orginalLink); if (objMenu == null) { int lastCharIndex = orginalLink.LastIndexOf('/'); orginalLink = orginalLink.Remove(lastCharIndex, orginalLink.Count() - lastCharIndex); } else { if (isIndex) objMenu.Link = string.Empty; string link = string.Empty; result = RecusionLinkMenu(objMenu, link); if (isIndex) { result = result.Trim().TrimEnd('»'); } break; } } return result; }