Exemplo n.º 1
0
        /// <summary>
        /// Saves the cast into the database
        /// </summary>
        public RecProductionCast GetCast()
        {
            // If there is a cast object with the same date (Year, Month, Day), shift then use it
            // otherwise create a new one
            var cast = this.FindCast( -1 );
            var svc = new ProjectManager();
            var pcd = svc.LoadProductionCast( this.bedFilter, cast );
            RecProductionCast newCast = null;
            if( pcd != null && pcd.Count > 0 )
            {
                newCast = pcd[0]; // Use the first one
            }
            if( newCast == null )
            {
                newCast = svc.InsertProductionCast( cast );
            }
            if( newCast == null )
            {
                throw new Exception( "Cannot create new cast object!" );
            }
            cast.CastId = newCast.CastId;

            return cast;
        }