Exemplo n.º 1
0
		public Contract_AnimeEpisode ToContract(ISession session, bool getFileCount, int userID, AnimeSeries_User seruser)
		{
			Contract_AnimeEpisode contract = new Contract_AnimeEpisode();
			contract.AniDB_EpisodeID = this.AniDB_EpisodeID;
			contract.AnimeEpisodeID = this.AnimeEpisodeID;
			contract.AnimeSeriesID = this.AnimeSeriesID;
			contract.DateTimeUpdated = this.DateTimeUpdated;

			AnimeEpisode_User epuser = this.GetUserRecord(session, userID);

			if (epuser == null)
			{
				contract.IsWatched = 0;
				contract.PlayedCount = 0;
				contract.StoppedCount = 0;
				contract.WatchedCount = 0;
				contract.WatchedDate = null;
			}
			else
			{
				contract.IsWatched = epuser.WatchedCount > 0 ? 1 : 0;
				contract.PlayedCount = epuser.PlayedCount;
				contract.StoppedCount = epuser.StoppedCount;
				contract.WatchedCount = epuser.WatchedCount;
				contract.WatchedDate = epuser.WatchedDate;
			}

			if (seruser == null)
				contract.UnwatchedEpCountSeries = 0;
			else
				contract.UnwatchedEpCountSeries = seruser.UnwatchedEpisodeCount;

			AniDB_Episode aniEp = this.AniDB_Episode;
			contract.AniDB_AirDate = aniEp.AirDateAsDate;
			contract.AniDB_EnglishName = aniEp.EnglishName;
			contract.AniDB_LengthSeconds = aniEp.LengthSeconds;
			contract.AniDB_Rating = aniEp.Rating;
			contract.AniDB_RomajiName = aniEp.RomajiName;
			contract.AniDB_Votes = aniEp.Votes;

			contract.EpisodeNumber = aniEp.EpisodeNumber;
			contract.EpisodeNameRomaji = aniEp.RomajiName;
			contract.EpisodeNameEnglish = aniEp.EnglishName;
			contract.EpisodeType = aniEp.EpisodeType;


			// find the number of files we actually have for this episode
			if (getFileCount)
				contract.LocalFileCount = this.GetVideoLocals(session).Count;

			contract.ReleaseGroups = new List<Contract_AniDBReleaseGroup>();



			return contract;
		}
Exemplo n.º 2
0
		public Contract_AnimeEpisode ToContractOld(AniDB_Episode aniEp)
		{
			Contract_AnimeEpisode contract = new Contract_AnimeEpisode();
			contract.AniDB_EpisodeID = this.AniDB_EpisodeID;
			contract.AnimeEpisodeID = this.AnimeEpisodeID;
			contract.AnimeSeriesID = this.AnimeSeriesID;
			contract.DateTimeUpdated = this.DateTimeUpdated;
			//contract.IsWatched = this.IsWatched;
			//contract.PlayedCount = this.PlayedCount;
			//contract.StoppedCount = this.StoppedCount;
			//contract.WatchedCount = this.WatchedCount;
			//contract.WatchedDate = this.WatchedDate;



			contract.AniDB_AirDate = aniEp.AirDateAsDate;
			contract.AniDB_EnglishName = aniEp.EnglishName;
			contract.AniDB_LengthSeconds = aniEp.LengthSeconds;
			contract.AniDB_Rating = aniEp.Rating;
			contract.AniDB_RomajiName = aniEp.RomajiName;
			contract.AniDB_Votes = aniEp.Votes;

			contract.EpisodeNumber = aniEp.EpisodeNumber;
			contract.EpisodeNameRomaji = aniEp.RomajiName;
			contract.EpisodeNameEnglish = aniEp.EnglishName;
			contract.EpisodeType = aniEp.EpisodeType;


			// find the number of files we actually have for this episode
			contract.LocalFileCount = GetVideoLocals().Count;

			contract.ReleaseGroups = new List<Contract_AniDBReleaseGroup>();



			return contract;
		}
 public void CollectContractMemory()
 {
     _contract = null;
 }