Exemple #1
0
        public void Save(IMediaSource replaceAutoPadding, IUser currentUser)
        {
            ValidatePlayItems();
            if (_entity == null)
            {
                _entity = new PlaybillEntity();
            }

            var playItemEntities = ToEntities(_entity, this.PlayItemCollection, replaceAutoPadding);

            _entity.StartTime = playItemEntities[0].StartTime;
            _entity.Duration  = playItemEntities[playItemEntities.Count - 1].StopTime.Subtract(_entity.StartTime).TotalSeconds;

            var oldId       = _entity.Id;
            var oldEditorId = _entity.LastEditorId;

            try
            {
                PlayoutRepository.SavePlaybill(_entity, playItemEntities, currentUser);
            }
            catch (Exception ex)
            {
                _entity.Id           = oldId;
                _entity.LastEditorId = oldEditorId;
                throw;
            }
        }