コード例 #1
0
        public void AddAdvancedSearchCriteria(ref AssetFinder finder)
        {
            // Don't add anything if filter search is disabled
            if (WebsiteBrandManager.GetBrand().HideFilterSearch)
            {
                return;
            }
            //-------------------------------------------------------------------
            // Metadata input selections
            //-------------------------------------------------------------------
            foreach (MetadataInputWrapper input in TemporaryMetaControlsPlaceHolder.Controls)
            {
                IEnumerable <int> metaIds;

                input.GetSelection(out metaIds);

                if (metaIds != null)
                {
                    finder.MetadataIds[input.GroupNumber] = metaIds.ToList();
                }
            }

            if (FileSizeDropDownList.SelectedValue != "any")
            {
                long parsedFileSize = ConvertUserInputToFileSize(FileSizeTextBox.Text);

                if (parsedFileSize > 0)
                {
                    CompareType compareType = GeneralUtils.ParseEnum(FileSizeDropDownList.SelectedValue, CompareType.Exact);
                    finder.AddComplexCriteria(Asset.Columns.FileSize, parsedFileSize, compareType);
                }
            }

            //-------------------------------------------------------------------
            // Production date criteria
            //-------------------------------------------------------------------
            finder.FromProductionDay   = FromDayDropDownList.SelectedId;
            finder.FromProductionMonth = FromMonthDropDownList.SelectedId;
            finder.FromProductionYear  = FromYearDropDownList.SelectedId;
            finder.ToProductionDay     = ToDayDropDownList.SelectedId;
            finder.ToProductionMonth   = ToMonthDropDownList.SelectedId;
            finder.ToProductionYear    = ToYearDropDownList.SelectedId;


            //-------------------------------------------------------------------
            // Asset type specific criteria
            //-------------------------------------------------------------------
            if (AssetTypeCache.Instance.GetById(finder.AssetTypeId).FileExtensionList.Select(extension => AssetTypeInfo.Get(extension)).Any(ati => ati.HasOrientation))
            {
                if (OrientationDropDownList.SelectedValue != "all")
                {
                    finder.Orientation = GeneralUtils.ParseEnum(OrientationDropDownList.SelectedValue, Data.Orientation.All);
                }
            }

            SetupHiddenAssetOptions(finder);
        }