Esempio n. 1
0
        private DataTable GetDataTable()
        {
            int top         = TopRecordsDropDownList1.SelectedId;
            int assetTypeId = AssetTypeDropDownList1.SelectedId;
            int brandId     = BrandDropDownList.SelectedId;

            TimeFrame timeframe = EnumUtils.GetEnumFromValue <TimeFrame>(TimeFrameDropDownList1.SelectedId);
            DateRange dateRange = SiteUtils.GetDateRangeFromTimeFrame(timeframe);

            DataTable dt = AssetReportMapper.Instance.GetPopularAssetList(top, assetTypeId, brandId, dateRange);

            dt.DefaultView.Sort = AssetRepeater.GetSortExpressions()[0].ToString();

            return(dt);
        }
        protected override AssetFinder GetFinderFromForm()
        {
            AuditAssetHistoryFinder finder = new AuditAssetHistoryFinder();

            if (UploadedCheckBox.Checked)
            {
                finder.IncludeActionsList.Add(AuditAssetAction.UploadedAsset);
            }

            if (DownloadedCheckBox.Checked)
            {
                finder.IncludeActionsList.Add(AuditAssetAction.DownloadedAssetFile);
            }

            if (OrderRequestsCheckBox.Checked)
            {
                finder.IncludeActionsList.Add(AuditAssetAction.Ordered);
            }

            if (ViewsCheckBox.Checked)
            {
                finder.IncludeActionsList.Add(AuditAssetAction.ViewedAssetDetail);
            }

            if (SearcHitsCheckBox.Checked)
            {
                finder.IncludeActionsList.Add(AuditAssetAction.ReturnedInSearch);
            }

            if (CartCheckBox.Checked)
            {
                finder.IncludeActionsList.Add(AuditAssetAction.AddedToCart);
            }

            if (LightboxCheckBox.Checked)
            {
                finder.IncludeActionsList.Add(AuditAssetAction.AddedToLightbox);
            }

            finder.BrandId = BrandDropDownList.SelectedId;

            TimeFrame timeframe = EnumUtils.GetEnumFromValue <TimeFrame>(TimeFrameDropDownList1.SelectedId);
            DateRange dateRange = SiteUtils.GetDateRangeFromTimeFrame(timeframe);

            finder.StartDate = dateRange.StartDate;
            finder.EndDate   = dateRange.EndDate;

            // Initialise the asset finder
            AssetFinder assetFinder = new AssetFinder();

            assetFinder.SortExpressions.AddRange(AssetRepeater.GetSortExpressions());

            // Give the asset finder, so it only finds assets in the
            // asset audit history matching the specified criteria
            // Caution: If the AuditAssetHistoryFinder is using any values
            // causing the constructed SQL query to use the parameter list
            // (eg. by setting @properties), this will fail.
            assetFinder.AuditAssetHistoryFinder = finder;

            return(assetFinder);
        }