예제 #1
0
 public virtual void Save()
 {
     foreach (IOrderRoleState s in this.LoadedOrderRoleStates)
     {
         OrderRoleStateDao.Save(s);
     }
     foreach (IOrderRoleState s in this._removedOrderRoleStates.Values)
     {
         OrderRoleStateDao.Delete(s);
     }
 }
예제 #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);
            }
        }