public CatalogItem[] GetFoldersByParentItemID(long id)
        {
            CatalogItemType folderType = CatalogItemType_GetByTypeCode("FLD");

            var rows = from row in CatalogItems
                       where (row.ItemTypeID == folderType.TypeID && row.ParentItemID == id)
                       select row;

            return(GetItemArray(rows.ToArray()));
        }
        public CatalogItem[] FindItems(CatalogItem parent, string typeCode, string namePattern, string descPattern, bool searchSubfolders)
        {
            CatalogItemType type         = CatalogItemType_GetByTypeCode(typeCode);
            string          parentPath   = null;
            long            parentItemId = -1;

            if (parent != null)
            {
                if (searchSubfolders)
                {
                    parentPath = parent.OrigItemPath.TrimEnd("/\\".ToCharArray());
                }
                else
                {
                    parentItemId = parent.ItemID;
                }
            }

            var rows = from row in CatalogItems
                       where
                       (
                (type == null || type.TypeID == row.ItemTypeID) &&

                (string.IsNullOrEmpty(parentPath) || (row.OrigItemPath.ToLowerInvariant().StartsWith(parentPath.ToLowerInvariant()))) &&

                (parentItemId < 0 || row.ParentItemID == parentItemId) &&

                (string.IsNullOrEmpty(namePattern) || row.Name.ToLowerInvariant().Contains(namePattern.ToLowerInvariant())) &&

                (string.IsNullOrEmpty(descPattern) || row.Description.ToLowerInvariant().Contains(descPattern.ToLowerInvariant()))

                       )
                       select row;

            return(GetItemArray(rows.ToArray()));
        }
Example #3
0
        public override bool Equals(object obj)
        {
            CatalogItemType comperand = obj as CatalogItemType;

            return(comperand != null && TypeID == comperand.TypeID);
        }