public void BuildNavigation() { List <SAMenuItemDTO> arrangedMenuItems = new List <SAMenuItemDTO>(); //Remove the ff lines to disable caching if (CacheHelper.GetFromCacheWithCheck <List <SAMenuItemDTO> >("arrangedMenuItems") != null && CacheHelper.GetFromCacheWithCheck <List <SAMenuItemDTO> >("arrangedMenuItems").Count > 0) { arrangedMenuItems = CacheHelper.GetFromCacheWithCheck <List <SAMenuItemDTO> >("arrangedMenuItems"); this.view.BindNavigationMenu(arrangedMenuItems); return; } //Remove the ff lines to disable caching NavigationData data = new NavigationData(); MenuFilterSection menu = MenuFilterSection.GetConfig(); List <string> ids = menu.GetItemsToBeRemove(); string filter = string.Join(",", ids.ToArray()); MenuOrderSection menuOrder = MenuOrderSection.GetConfig(); List <SAMenuItemDTO> menuItems = data.GetAllUsedDiagrams(filter); if (menuOrder.MenuOrders.Count > 0) { foreach (MenuOrder item in menuOrder.MenuOrders) { SAMenuItemDTO order = menuItems.FirstOrDefault(c => c.ID == item.Id); if (order != null) { arrangedMenuItems.Insert(item.Order, order); } } if (menuItems.Count > menuOrder.MenuOrders.Count) { foreach (MenuOrder item in menuOrder.MenuOrders) { var order = menuItems.FirstOrDefault(c => c.ID == item.Id); if (order != null) { menuItems.Remove(order); } } arrangedMenuItems.AddRange(menuItems); } } else { arrangedMenuItems = menuItems.OrderBy(diag => diag.Text).ToList(); } //Remove the ff lines to disable caching CacheHelper.AddToCacheWithCheck("arrangedMenuItems", arrangedMenuItems); //Remove the ff lines to disable caching this.view.BindNavigationMenu(arrangedMenuItems); }
static void Main(string[] args) { NavigationData data = new NavigationData(); MenuFilterSection menu = MenuFilterSection.GetConfig(); List <string> ids = menu.GetItemsToBeRemove(); string filter = string.Join(",", ids.ToArray()); MenuOrderSection menuOrder = MenuOrderSection.GetConfig(); List <SAMenuItemDTO> menuItems = data.GetAllUsedDiagrams(filter); List <string> errorUrls = new List <string>(); foreach (var item in menuItems) { foreach (var item2 in item.ChildItems) { InternetExplorerDriver driver = new InternetExplorerDriver(); string url = string.Format("http://wpsa1/tobe_ea/Default.aspx?id={0}", item2.Key); driver.Url = url; var sc = driver.GetScreenshot(); sc.SaveAsFile(item2.Key.ToString() + ".jpg", ImageFormat.Jpeg); //Thread.Sleep(100000); var x = driver.FindElementById("reportId"); if (x == null) { errorUrls.Add(url); } driver.Quit(); } } File.WriteAllLines(@"BrokenPages.txt", errorUrls.ToArray()); Console.ReadLine(); }