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); }
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); } }
public static CreateOrderRole ToCreateOrderRole(this OrderRoleState state) { return(state.ToCreateOrderRole <CreateOrderRole>()); }
public static MergePatchOrderRole ToMergePatchOrderRole(this OrderRoleState state) { return(state.ToMergePatchOrderRole <MergePatchOrderRole>()); }
public static RemoveOrderRole ToRemoveOrderRole(this OrderRoleState state) { return(state.ToRemoveOrderRole <RemoveOrderRole>()); }
public static IOrderRoleCommand ToCreateOrMergePatchOrderRole(this OrderRoleState state) { return(state.ToCreateOrMergePatchOrderRole <CreateOrderRole, MergePatchOrderRole>()); }