示例#1
0
        public virtual IPicklistRoleState ToPicklistRoleState()
        {
            var state = new PicklistRoleState(true);

            state.PartyRoleId = this.PartyRoleId;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.PicklistId         = this.PicklistId;
            state.CreatedByUserLogin = this.CreatedByUserLogin;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.LastModifiedByUserLogin = this.LastModifiedByUserLogin;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
示例#2
0
        public virtual IPicklistRoleState Get(PartyRoleId partyRoleId, bool forCreation, bool nullAllowed)
        {
            PicklistRoleId globalId = new PicklistRoleId(_picklistState.PicklistId, partyRoleId);

            if (_loadedPicklistRoleStates.ContainsKey(globalId))
            {
                var state = _loadedPicklistRoleStates[globalId];
                if (this._picklistState != null && this._picklistState.ReadOnly == false)
                {
                    ((IPicklistRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new PicklistRoleState(ForReapplying);
                state.PicklistRoleId = globalId;
                _loadedPicklistRoleStates.Add(globalId, state);
                if (this._picklistState != null && this._picklistState.ReadOnly == false)
                {
                    ((IPicklistRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = PicklistRoleStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedPicklistRoleStates.Add(globalId, state);
                }
                if (this._picklistState != null && this._picklistState.ReadOnly == false)
                {
                    ((IPicklistRoleState)state).ReadOnly = false;
                }
                return(state);
            }
        }
示例#3
0
 public static CreatePicklistRole ToCreatePicklistRole(this PicklistRoleState state)
 {
     return(state.ToCreatePicklistRole <CreatePicklistRole>());
 }
示例#4
0
 public static MergePatchPicklistRole ToMergePatchPicklistRole(this PicklistRoleState state)
 {
     return(state.ToMergePatchPicklistRole <MergePatchPicklistRole>());
 }
示例#5
0
 public static RemovePicklistRole ToRemovePicklistRole(this PicklistRoleState state)
 {
     return(state.ToRemovePicklistRole <RemovePicklistRole>());
 }
示例#6
0
 public static IPicklistRoleCommand ToCreateOrMergePatchPicklistRole(this PicklistRoleState state)
 {
     return(state.ToCreateOrMergePatchPicklistRole <CreatePicklistRole, MergePatchPicklistRole>());
 }