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);
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int assetId = GetRequiredQueryStringParameter("AssetId", "../Assets/AssetList.aspx");

                // Get the asset.  No need to check permissions
                // as the security module will have already checked it
                Asset asset = GetAsset(assetId);

                if (asset.IsNull)
                {
                    Response.Redirect("../Assets/AssetList.aspx", false);
                    return;
                }

                // Setup the audit trail link
                SiteUtils.SetHyperLink(CurrentUser, "Reports.AssetAuditTrail", string.Format("?AssetId={0}&Source=AssetStats", asset.AssetId), ViewAuditTrailHyperlink);

                // Update popularity rank
                AssetReportMapper.Instance.UpdateAssetPopularityRank(assetId);

                // Populate asset preview with this asset
                AssetPreview1.Asset = asset;

                // Populate asset info
                AssetReferenceLabel.Text        = asset.AssetId.ToString();
                AssetTypeLabel.Text             = asset.AssetType.Name;
                TitleLabel.Text                 = asset.Title;
                BrandLabel.Text                 = asset.Brand.Name;
                RestrictedDownloadLabel.Text    = EntitySecurityManager.IsAssetRestricted(CurrentUser, asset) ? "Yes" : "No";
                UsageRestrictionsLabel.Text     = asset.UsageRestrictions;
                UploadUserHyperLink.Text        = asset.UploadedByUserName;
                UploadUserHyperLink.NavigateUrl = "~/Admin/Users/UserForm.aspx?UserId=" + asset.UploadedByUserId;
                DateUploadedLabel.Text          = asset.UploadDate.ToString(Global.DateFormat);
                DatePublishedLabel.Text         = asset.PublishDate.ToString(Global.DateFormat);
                DateLastEditedLabel.Text        = asset.LastUpdate.ToString(Global.DateFormat);

                // Ensure empty cells have at least non-breaking space
                SiteUtils.PopulateBlankControl(TitleLabel);
                SiteUtils.PopulateBlankControl(UsageRestrictionsLabel);

                // Get total number of search hits
                AuditAssetSearchResultFinder finder1 = new AuditAssetSearchResultFinder();
                finder1.AssetId = asset.AssetId.GetValueOrDefault();
                TotalNumberOfSearchHitsLabel.Text = AuditAssetSearchResult.GetCount(finder1).ToString();

                // Get total number of views
                AuditAssetHistoryFinder finder2 = new AuditAssetHistoryFinder();
                finder2.AssetId              = asset.AssetId.GetValueOrDefault();
                finder2.AuditAssetAction     = AuditAssetAction.ViewedAssetDetail;
                TotalNumberOfViewsLabel.Text = AuditAssetHistory.GetCount(finder2).ToString();

                // Get total number of added to lightbox
                AuditAssetHistoryFinder finder3 = new AuditAssetHistoryFinder();
                finder3.AssetId                      = asset.AssetId.GetValueOrDefault();
                finder3.AuditAssetAction             = AuditAssetAction.AddedToLightbox;
                TotalNumberAddedToLightboxLabel.Text = AuditAssetHistory.GetCount(finder3).ToString();

                // Get total number of added to cart
                AuditAssetHistoryFinder finder4 = new AuditAssetHistoryFinder();
                finder4.AssetId                  = asset.AssetId.GetValueOrDefault();
                finder4.AuditAssetAction         = AuditAssetAction.AddedToCart;
                TotalNumberAddedToCartLabel.Text = AuditAssetHistory.GetCount(finder4).ToString();

                // Get total number of order requests
                OrderItemFinder finder5 = new OrderItemFinder();
                finder5.AssetId = asset.AssetId.GetValueOrDefault();
                TotalNumberOfOrderRequestsLabel.Text = OrderItem.GetCount(finder5).ToString();

                // Get total number of downloads
                AuditAssetHistoryFinder finder6 = new AuditAssetHistoryFinder();
                finder6.AssetId                  = asset.AssetId.GetValueOrDefault();
                finder6.AuditAssetAction         = AuditAssetAction.DownloadedAssetFile;
                TotalNumberOfDownloadsLabel.Text = AuditAssetHistory.GetCount(finder6).ToString();

                // Get total assets
                AssetFinder finder7    = new AssetFinder();
                int         assetCount = Asset.GetCount(finder7);

                // Display popularity based on downloads
                PopularityBasedOnDownloadsLabel.Text = string.Format("{0} / {1} assets", asset.PopularityRank, assetCount);

                // Open the panel specified in the querystring, or default to activity summary
                string panel = WebUtils.GetRequestParam("panel", Panels.ActivitySummary.ToString());
                TogglePanel(panel);
            }
        }