public static void LogAssetAction(int assetId, User user, AuditAssetAction auditAssetAction, string notes)
        {
            AuditAssetHistory aah = AuditAssetHistory.New();

            aah.SessionId          = BusinessHelper.GetCurrentSessionId();
            aah.IpAddress          = BusinessHelper.GetCurrentIpAddress();
            aah.AuditAssetActionId = Convert.ToInt32(auditAssetAction);
            aah.UserId             = user.UserId.GetValueOrDefault();
            aah.AssetId            = assetId;
            aah.Notes = notes;
            aah.Date  = DateTime.Now;
            AuditAssetHistory.Update(aah);

            m_Logger.InfoFormat("LogAssetAction - Asset ID: {0}, User: {1}, Action: {2}, Notes: {3}", assetId, user.FullName, auditAssetAction, notes);
        }
Beispiel #2
0
 public override object GetDataSource()
 {
     return(AuditAssetHistory.GetAuditAssetActionList());
 }
Beispiel #3
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);
            }
        }