Ejemplo n.º 1
0
        /// <summary>Deletes a Digital Libary file with the specified id</summary>
        /// <param name="fileId">The id of the file to delete</param>
        /// <param name="fileExtension">The extension of the file to delete</param>
        public static void DeleteDigitalLibraryFile(int fileId, string fileExtension)
        {
            string path = string.Format("{0}{1}/{2}.{3}", DigitalLibraryImaging.ImageFilePath, GetDigitalLibraryFileFolder(fileId), fileId, fileExtension);

            WebCommon.DeleteFile(HttpContext.Current.Server.MapPath(path));
            //if this is an image, delete the corresponding thumbnail as well
            if (fileExtension.ToUpper() == "JPG")
            {
                string thumbPath = string.Format("{0}{1}/{2}_t.JPG", DigitalLibraryImaging.ThumbnailImageFilePath, GetDigitalLibraryFileFolder(fileId), fileId);
                WebCommon.DeleteFile(HttpContext.Current.Server.MapPath(thumbPath));
            }
        }