zoukankan      html  css  js  c++  java
  • How to: Execute Custom Code when a Report is Persisted 如何:在报表持久化时执行自定义代码

    This topic describes how you can customize the ReportsStorage class. Assume you have a customized the ReportDataV2 class and added the ModifiedBy property that should return the name of the user who last edited the report layout. You need to update this property value each time a report layout is saved. For this purpose, customize the ReportsStorage and register your custom implementation. The steps below demonstrate how to do it.

    本主题介绍如何自定义报表存储类。假设您已自定义了 ReportDataV2 类,并添加了"修改者"属性,该属性应返回上次编辑报表布局的用户的名称。每次保存报表布局时,都需要更新此属性值。为此,请自定义报表存储并注册自定义实现。以下步骤演示如何执行此操作。

    Note 注意
    The approach described in this topic is not supported by the Mobile platform.
    移动平台不支持本主题中描述的方法。
    • Inherit the ReportsStorage class and override its ReportsStorage.SaveReport method.

    • 继承报表存储类并重写其报表存储.保存报表方法。

      using DevExpress.XtraReports.UI;
      using DevExpress.ExpressApp;
      using DevExpress.ExpressApp.ReportsV2;
      using DevExpress.ExpressApp.Security;
      // ...
      public class CustomReportsStorage : ReportsStorage {
          public override void SaveReport(IReportDataV2Writable reportData, XtraReport report) {
              if (reportData is MyReportDataV2) {
                  ISecurityUser currentUser = SecuritySystem.CurrentUser as ISecurityUser;
                  if (currentUser != null) {
                      ((MyReportDataV2)reportData).ModifiedBy = currentUser.UserName;
                  }
              }
              base.SaveReport(reportData, report);
          }
      }
    • Edit the Module.cs (Module.vb) file and override the ModuleBase.Setup method. In this method, assign an instance of the CustomReportsStorage to the static ReportDataProvider.ReportsStorage property.

    • 编辑Module.cs(模块.vb)文件并重写模块Base.安装程序方法。在此方法中,将自定义报表存储的实例分配给静态报表数据提供程序。报告存储属性。

      using DevExpress.ExpressApp.ReportsV2;
      // ...
      public override void Setup(XafApplication application) {
          ReportDataProvider.ReportsStorage = new CustomReportsStorage();
          base.Setup(application);
      }
  • 相关阅读:
    Android面试题目整理与解说(一)
    Linux 6.3下安装Oracle Enterprise Cloud Control 12c
    xcode5. 安装cocos2d-x 学习中。。。
    Bootstrap组件之输入框组
    洛谷P2852 [USACO06DEC]牛奶模式Milk Patterns
    洛谷P2870 [USACO07DEC]最佳牛线,黄金Best Cow Line, Gold
    洛谷P4051 [JSOI2007]字符加密
    洛谷P3809 【模板】后缀排序
    洛谷P2598 [ZJOI2009]狼和羊的故事
    洛谷P1345 [USACO5.4]奶牛的电信Telecowmunication
  • 原文地址:https://www.cnblogs.com/foreachlife/p/How-to-Execute-Custom-Code-when-a-Report-is-Persisted.html
Copyright © 2011-2022 走看看