コード例 #1
0
        public static bool IsValidForShow(int type, int id)
        {
            bool                   result       = false;
            EntityData             data         = new EntityData();
            MenuFilterSection      menuFilter   = MenuFilterSection.GetConfig();
            List <GroupMenuFilter> groupFilters = menuFilter.GetGroupMenuFilters();

            if (groupFilters.FirstOrDefault(y => y.TargetType == type) != null)
            {
                GroupMenuFilter filter = groupFilters.FirstOrDefault(y => y.TargetType == type);

                EntityDTO dto = data.GetOneEntity(id);

                if (dto != null)
                {
                    dto.ExtractProperties();
                    string category = dto.RenderHTML(filter.PropertyName, RenderOption.None);
                    if (category == filter.PropertyValue)
                    {
                        result = true;
                    }
                }
            }
            else
            {
                result = true;
            }
            return(result);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public List <SearchResultDTO> SearchEntity(string filter)
        {
            List <SearchResultDTO> results = new List <SearchResultDTO>();

            MenuFilterSection menu = MenuFilterSection.GetConfig();
            List <string>     ids  = menu.GetItemsToBeRemove();

            string notin = string.Join(",", ids.ToArray());

            DbCommand cmd = db.GetSqlStringCommand(
                string.Format(GlobalStringResource.Data_SearchEntity, filter, notin)
                );

            IDataReader reader = db.ExecuteReader(cmd);

            while (reader.Read())
            {
                SearchResultDTO dto = new SearchResultDTO();
                dto.ID       = reader.GetInt32(0);
                dto.Name     = !reader.IsDBNull(1) ? reader.GetString(1) : string.Empty;
                dto.Type     = reader.GetInt16(2);
                dto.TypeName = TypesReader.DiagramTypes[dto.Type];

                string prop = string.Empty;

                if (!reader.IsDBNull(3) && !string.IsNullOrEmpty(reader.GetString(3)))
                {
                    prop = reader.GetString(3);
                }
                else
                {
                    prop = reader.GetString(4);
                }

                dto.Properties = prop; //string.Format("<div class=\"accordion\"><h3>Properties Match</h3><div>{0}</div><div>", prop);

                results.Add(dto);
            }

            reader.Close();
            reader.Dispose();

            return(results);
        }
コード例 #4
0
        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();
        }