Example #1
0
        public Contract_VideoLocalManualLink ToContractManualLink(int userID)
        {
            Contract_VideoLocalManualLink contract = new Contract_VideoLocalManualLink();

            contract.CRC32           = this.CRC32;
            contract.DateTimeUpdated = this.DateTimeUpdated;
            contract.FilePath        = this.FilePath;
            contract.FileSize        = this.FileSize;
            contract.Hash            = this.Hash;
            contract.HashSource      = this.HashSource;
            contract.ImportFolder    = this.ImportFolder.ToContract();
            contract.ImportFolderID  = this.ImportFolderID;
            contract.IsIgnored       = this.IsIgnored;
            contract.IsVariation     = this.IsVariation;
            contract.MD5             = this.MD5;
            contract.SHA1            = this.SHA1;
            contract.VideoLocalID    = this.VideoLocalID;

            VideoLocal_User userRecord = this.GetUserRecord(userID);

            if (userRecord == null)
            {
                contract.IsWatched   = 0;
                contract.WatchedDate = null;
            }
            else
            {
                contract.IsWatched   = 1;
                contract.WatchedDate = userRecord.WatchedDate;
            }

            return(contract);
        }
Example #2
0
        public Contract_VideoLocalManualLink ToContractManualLink(int userID)
        {
            Contract_VideoLocalManualLink contract = new Contract_VideoLocalManualLink();

            contract.CRC32           = this.CRC32;
            contract.DateTimeUpdated = this.DateTimeUpdated;
            contract.FileName        = this.FileName;
            contract.FileSize        = this.FileSize;
            contract.Hash            = this.Hash;
            contract.HashSource      = this.HashSource;
            contract.IsIgnored       = this.IsIgnored;
            contract.IsVariation     = this.IsVariation;
            contract.MD5             = this.MD5;
            contract.SHA1            = this.SHA1;
            contract.VideoLocalID    = this.VideoLocalID;
            contract.Places          = Places.Select(a => a.ToContract()).ToList();

            VideoLocal_User userRecord = this.GetUserRecord(userID);

            if (userRecord?.WatchedDate == null)
            {
                contract.IsWatched      = 0;
                contract.WatchedDate    = null;
                contract.ResumePosition = 0;
            }
            else
            {
                contract.IsWatched   = userRecord.WatchedDate.HasValue ? 1 : 0;
                contract.WatchedDate = userRecord.WatchedDate;
            }
            if (userRecord != null)
            {
                contract.ResumePosition = userRecord.ResumePosition;
            }
            return(contract);
        }