public static string GetUrlForSearch(SavedUserAssetSearch searchInfo) { AssetFinder finder = searchInfo.AssetFinder; StringBuilder sb = new StringBuilder(); sb.Append("~/SearchRedirector.ashx?x=1"); AppendSearchValue(sb, CATEGORY_ID, searchInfo.CurrentCategoryId); AppendSearchValue(sb, GENERAL_KEYWORD, finder.GeneralKeyword.Replace("&", " ")); foreach (var ids in finder.MetadataIds) {//add all selected meta value ids for each meta under its //own param name foreach (var id in ids.Value) { AppendSearchValue(sb, "md" + ids.Key, id); } } AppendSearchValue(sb, BRAND_ID, finder.BrandId); AppendSearchValue(sb, ASSET_TYPE_ID, finder.AssetTypeId); AppendSearchValue(sb, ORIENTATION_ID, m_OrientationDictionary[finder.Orientation]); ComplexCriteria criteria = finder.GetSingleComplexCriteria(Asset.Columns.FileSize); if (criteria != null) { sb.AppendFormat("&{0}={1}&{2}={3}", FILESIZE_COMPARETYPE, m_CompareTypeDictionary[criteria.CompareType], FILESIZE, criteria.Value); } criteria = finder.GetSingleComplexCriteria(Asset.Columns.ProductionMonth, CompareType.MoreThan); if (criteria != null) { sb.AppendFormat("&{0}={1}", FROM_PRODUCTION_MONTH, criteria.Value); } criteria = finder.GetSingleComplexCriteria(Asset.Columns.ProductionYear, CompareType.MoreThan); if (criteria != null) { sb.AppendFormat("&{0}={1}", FROM_PRODUCTION_YEAR, criteria.Value); } criteria = finder.GetSingleComplexCriteria(Asset.Columns.ProductionMonth, CompareType.LessThan); if (criteria != null) { sb.AppendFormat("&{0}={1}", TO_PRODUCTION_MONTH, criteria.Value); } criteria = finder.GetSingleComplexCriteria(Asset.Columns.ProductionYear, CompareType.LessThan); if (criteria != null) { sb.AppendFormat("&{0}={1}", TO_PRODUCTION_YEAR, criteria.Value); } sb.AppendFormat("&{0}={1}", PAGE, searchInfo.Page); sb.AppendFormat("&{0}={1}", PAGE_SIZE, searchInfo.PageSize); return(sb.ToString()); }
public void LoadFilterFromStoredValues(AssetFinder finder) { // load lists and dropdowns foreach (MetadataInputWrapper input in TemporaryMetaControlsPlaceHolder.Controls) { var ids = finder.GetMetadataIds(input.GroupNumber); input.SetSelection(ids); } IncludeUnpublishedExpiredAssets.Checked = finder.IncludeUnpublishedExpiredAssets; //Select filesize ComplexCriteria fileSizeCriteria = finder.GetSingleComplexCriteria(Asset.Columns.FileSize); if (fileSizeCriteria != null) { //Convert the entered filesize from bytes to megabytes by dividing it up (1024/1024) FileSizeTextBox.Text = ConvertFileSizeToUserInput(Convert.ToInt64(fileSizeCriteria.Value)); ListItem fileSizeListItem = FileSizeDropDownList.Items.FindByValue(fileSizeCriteria.CompareType.ToString()); if (fileSizeListItem != null) { FileSizeDropDownList.SelectedIndex = -1; FileSizeTextBox.Attributes.Remove("disabled"); fileSizeListItem.Selected = true; } } //Select production date dropdowns FromDayDropDownList.SafeSelectValue(finder.FromProductionDay); FromMonthDropDownList.SafeSelectValue(finder.FromProductionMonth); FromYearDropDownList.SafeSelectValue(finder.FromProductionYear); ToDayDropDownList.SafeSelectValue(finder.ToProductionDay); ToMonthDropDownList.SafeSelectValue(finder.ToProductionMonth); ToYearDropDownList.SafeSelectValue(finder.ToProductionYear); //Select orientation ListItem li = OrientationDropDownList.Items.FindByValue(finder.Orientation.ToString().ToLower()); if (li != null) { OrientationDropDownList.SelectedIndex = -1; li.Selected = true; } }