Пример #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>());
 }