2024年终活动

DevExpress控件使用交流,DevExpress中国社区Dev联系电话 联系电话:023-68661681

DevExpress XAF v12.1.4 筛选业务对象最好的方法是什么?

来源:本站原创   发布时间:2012-06-28   浏览:2873次

问题描述:

在DevExpress XAF v12.1.4 SecurityStrategyComplex中为用户筛选业务对象最好的方法是什么?有例子可参考吗?

问题解答:

[C#]参考代码

using System;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Security.Strategy;
using DevExpress.ExpressApp.SystemModule;
using DevExpress.Xpo;

  namespace ManageUsersOnLogon.Module
  {
    public interface IProfile
    {
      SecuritySystemUser CreatedByNew
      {
        get;
      }
      DateTime CreatedOn
      {
        get;
      }
    }

    [ListViewFilter("Show My Profiles", "[CreatedByNew] = CurrentUserId()", true)]
     public partial class Profile : IProfile
     {
       public override void AfterConstruction()
       {
        base.AfterConstruction();
        _CreatedByNew = Session.GetObjectByKey<SecuritySystemUser>(SecuritySystem.CurrentUserId);
        _CreatedOn = DateTime.Now;
      }
      [Persistent("CreatedByNew")]
      private SecuritySystemUser _CreatedByNew;
      [PersistentAlias("_CreatedByNew")]
      public SecuritySystemUser CreatedByNew
      {
        get
        {
          return _CreatedByNew;
        }
        internal set
        {
          _CreatedByNew = value;
        }
      }

      [Persistent("CreatedOn")]
      private DateTime _CreatedOn;
      [PersistentAlias("_CreatedOn")]
      public DateTime CreatedOn
      {
        get
        {
          return _CreatedOn;
        }
        internal set
        {
          _CreatedOn = value;
        }
      }

      #region IProfileOwner Members
      SecuritySystemUser IProfile.CreatedByNew
      {
        get
        {
          return CreatedByNew;
        }
      }
      DateTime IProfile.CreatedOn
      {
        get
        {
          return CreatedOn;
        }
      }
      #endregion
    }
  }

技术:.NET

操作系统:Windows Vista

IDE:Microsoft Visual Studio 2010

本站文章除注明转载外,均为本站原创或翻译
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/241.html
扫码咨询
电话咨询
023-68661681
返回
顶部