Esempio n. 1
0
        public void OnPostInsert(PostInsertEvent @event)
        {
            var seat = default(Seat);

            if (@event.TryCatchEntity(ref seat))
            {
                if (_seatBoxRepository == null)
                {
                    _seatBoxRepository = ServiceLocator.Current.GetInstance <ISeatBoxRepository>();
                }

                _seatBoxRepository.MakePersistent(new SeatBox(seat));
            }
        }
Esempio n. 2
0
        public void SaveAsNew(Seat seat)
        {
            if (!seat.IsNew())
            {
                throw new Exception("Crearw new seat fail & entity is not a new object");
            }

            seat.InUse       = true;
            seat.IsActivated = true;
            seat.IsOpen      = true;
            var maxPriority = _seatRepository.GetMaxPriority(seat.Area);

            seat.Index = maxPriority == 0 ? 0 : maxPriority + 1;

            _seatRepository.MakePersistent(seat);
            _seatBoxRepository.MakePersistent(new SeatBox(seat));
        }