public static void AddMetadata(int seriesId, string imdbId, string zap2ItId, string network, string contentRating, decimal rating, StatusEnum? status, DateTime? airTime, DateTime firstAired, int runtime, DateTime? lastUpdateTheTVDB) { var updateEntity = new SeriesEntity(); if (!string.IsNullOrEmpty(imdbId)) updateEntity.Imdbid = imdbId; if (!string.IsNullOrEmpty(zap2ItId)) updateEntity.Zap2ItId = zap2ItId; if (!string.IsNullOrEmpty(network)) updateEntity.Network = network; if (!string.IsNullOrEmpty(contentRating)) updateEntity.ContentRating = contentRating; if (rating > 0) updateEntity.Rating = rating; if (status.HasValue) updateEntity.StatusId = (int)status; if (airTime.HasValue) updateEntity.AirTimeUtc = airTime; if (firstAired != new DateTime()) updateEntity.FirstAiredUtc = firstAired; if (!string.IsNullOrEmpty(imdbId)) updateEntity.Imdbid = imdbId; if (runtime > 0) updateEntity.RuntimeMinutes = runtime; if (lastUpdateTheTVDB.HasValue) updateEntity.LastUpdateTheTvdbutc = lastUpdateTheTVDB; Database.UpdateEntitiesDirectly(updateEntity, new RelationPredicateBucket(SeriesFields.SeriesId == seriesId)); }
/// <summary> setups the sync logic for member _series</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncSeries(IEntityCore relatedEntity) { if(_series!=relatedEntity) { DesetupSyncSeries(true, true); _series = (SeriesEntity)relatedEntity; this.PerformSetupSyncRelatedEntity( _series, new PropertyChangedEventHandler( OnSeriesPropertyChanged ), "Series", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticSeasonRelations.SeriesEntityUsingSeriesIdStatic, true, new string[] { } ); } }
/// <summary> Removes the sync logic for member _series</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncSeries(bool signalRelatedEntity, bool resetFKFields) { this.PerformDesetupSyncRelatedEntity( _series, new PropertyChangedEventHandler( OnSeriesPropertyChanged ), "Series", TVJunkie.DatabaseAccessLayer.RelationClasses.StaticSeasonRelations.SeriesEntityUsingSeriesIdStatic, true, signalRelatedEntity, "Seasons", resetFKFields, new int[] { (int)SeasonFieldIndex.SeriesId } ); _series = null; }
protected SeasonEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _artworkToSeasons = (EntityCollection<ArtworkToSeasonEntity>)info.GetValue("_artworkToSeasons", typeof(EntityCollection<ArtworkToSeasonEntity>)); _episodes = (EntityCollection<EpisodeEntity>)info.GetValue("_episodes", typeof(EntityCollection<EpisodeEntity>)); _roleToSeasons = (EntityCollection<RoleToSeasonEntity>)info.GetValue("_roleToSeasons", typeof(EntityCollection<RoleToSeasonEntity>)); _series = (SeriesEntity)info.GetValue("_series", typeof(SeriesEntity)); if(_series!=null) { _series.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
protected ImportSeriesNameEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _importSeriesNameCandidates = (EntityCollection<ImportSeriesNameCandidateEntity>)info.GetValue("_importSeriesNameCandidates", typeof(EntityCollection<ImportSeriesNameCandidateEntity>)); _series = (SeriesEntity)info.GetValue("_series", typeof(SeriesEntity)); if(_series!=null) { _series.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
protected GenreToSeriesEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if(SerializationHelper.Optimization != SerializationOptimization.Fast) { _genre = (GenreEntity)info.GetValue("_genre", typeof(GenreEntity)); if(_genre!=null) { _genre.AfterSave+=new EventHandler(OnEntityAfterSave); } _series = (SeriesEntity)info.GetValue("_series", typeof(SeriesEntity)); if(_series!=null) { _series.AfterSave+=new EventHandler(OnEntityAfterSave); } this.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }