示例#1
0
        public virtual IOrderRoleState ToOrderRoleState()
        {
            var state = new OrderRoleState(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.OrderId   = this.OrderId;
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
示例#2
0
        public virtual IOrderRoleState Get(PartyRoleId partyRoleId, bool forCreation, bool nullAllowed)
        {
            OrderRoleId globalId = new OrderRoleId(_orderState.OrderId, partyRoleId);

            if (_loadedOrderRoleStates.ContainsKey(globalId))
            {
                var state = _loadedOrderRoleStates[globalId];
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new OrderRoleState(ForReapplying);
                state.OrderRoleId = globalId;
                _loadedOrderRoleStates.Add(globalId, state);
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderRoleState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = OrderRoleStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedOrderRoleStates.Add(globalId, state);
                }
                if (this._orderState != null && this._orderState.ReadOnly == false)
                {
                    ((IOrderRoleState)state).ReadOnly = false;
                }
                return(state);
            }
        }
示例#3
0
 public static CreateOrderRole ToCreateOrderRole(this OrderRoleState state)
 {
     return(state.ToCreateOrderRole <CreateOrderRole>());
 }
示例#4
0
 public static MergePatchOrderRole ToMergePatchOrderRole(this OrderRoleState state)
 {
     return(state.ToMergePatchOrderRole <MergePatchOrderRole>());
 }
示例#5
0
 public static RemoveOrderRole ToRemoveOrderRole(this OrderRoleState state)
 {
     return(state.ToRemoveOrderRole <RemoveOrderRole>());
 }
示例#6
0
 public static IOrderRoleCommand ToCreateOrMergePatchOrderRole(this OrderRoleState state)
 {
     return(state.ToCreateOrMergePatchOrderRole <CreateOrderRole, MergePatchOrderRole>());
 }