/// <summary>
        /// Called when one of the watchers detected the creation of a file
        /// </summary>
        protected override void OnFileCreated(FileInfo file)
        {
            // A track was created
            if (IsTrack(file))
            {
                var track = new FileTrack(file);
                track.Save();
                _masterPlaylist.Add(track);
            }

            // A playlist was created
            else if (IsPlaylist(file))
            {
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// Called when one of the watchers detects a change in a file
        /// </summary>
        protected override void OnFileChanged(FileInfo file)
        {
            // A track was changed
            if (IsTrack(file))
            {
                var track = FileTrack.GetByPath(file.FullName);
                if (track != null)
                {
                    track.Update(file);
                    track.Save();
                    _masterPlaylist.Update(track);
                }
            }

            // A playlist was changed
            else if (IsPlaylist(file))
            {
                throw new NotImplementedException();
            }
        }
Exemple #3
0
        public void Update(FileTrack fileTrack)
        {
            var p = new DynamicParameters();

            p.Add("@id", fileTrack.FileId);
            p.Add("@fileTrackerId", fileTrack.FileTrackId);
            p.Add("@priority", fileTrack.Priority);
            p.Add("@businessPriority", fileTrack.BusinessPriority);
            p.Add("@fileName", fileTrack.FileName);
            p.Add("@salesforceId", fileTrack.SalesforceId);
            p.Add("@filePath", fileTrack.FilePath);
            p.Add("@statusId", fileTrack.StatusId);
            p.Add("@assignedId", fileTrack.AssigneeId);
            p.Add("@ack", fileTrack.AckDateTime);
            p.Add("@notes", fileTrack.Notes);
            p.Add("@exitCode", fileTrack.ExitCode);
            p.Add("@user", fileTrack.LastModified);

            using (var cn = new SqlConnection(_connStr))
                cn.Execute("prUpd_UpdateFile", p, commandType: CommandType.StoredProcedure);
        }
        /// <summary>
        /// Called when one of the watchers detects the deletion of a file
        /// </summary>
        protected override void OnFileDeleted(FileInfo file)
        {
            // A track was deleted
            if (IsTrack(file))
            {
                var track = FileTrack.GetByPath(file.FullName);
                if (track != null)
                {
                    track.Dispose();
                    foreach (var playlist in Medium.Containers.Cast <Playlist>())
                    {
                        playlist.Remove(track);
                    }
                }
            }

            // A playlist was deleted
            else if (IsPlaylist(file))
            {
                throw new NotImplementedException();
            }
        }
        /// <summary>
        /// Called when one of the watchers detects the renaming of a file
        /// </summary>
        protected override void OnFileRenamed(FileInfo file, RenamedEventArgs e)
        {
            // A track was renamed
            if (IsTrack(file))
            {
                var track = FileTrack.GetByPath(e.OldFullPath);
                if (track == null)
                {
                    this.OnFileCreated(file);
                }
                else
                {
                    this.OnFileChanged(file);
                }
            }

            // A playlist was renamed
            else if (IsPlaylist(file))
            {
                throw new NotImplementedException();
            }
        }
Exemple #6
0
        public IHttpActionResult Update([FromBody] FileTrack fileTrack)
        {
            try
            {
                var currUser = RequestContext.Principal.Identity.Name;

                if (string.IsNullOrEmpty(currUser))
                {
                    currUser = "******";
                }

                fileTrack.LastModified         = currUser;
                fileTrack.LastModifiedDateTime = DateTime.Now;

                _repo.Update(fileTrack);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }