C# Class EnterpriseWebLibrary.EnterpriseWebFramework.Controls.BlobFileOps

Contains methods for working with BLOB files.
Exibir arquivo Open project: enduracode/enterprise-web-library Class Usage Examples

Private Properties

Property Type Description
GetContentTypeForPostedFile string
GetThumbnailControl System.Web.UI.Control
Init void
OrderByName IEnumerable
OrderByUploadedDateDescending IEnumerable

Public Methods

Method Description
CopyFileCollection ( int fileCollectionId ) : int

Copies the specified file collection and returns the ID of the copy.

GetFileLink ( int fileCollectionId, string labelOverride = null, string textIfNoFile = "" ) : Control

Returns a link to download a file with the given file collection ID. If no file is associated with the given file collection ID, returns a literal control with textIfNoFile text. The file name is used as the label unless labelOverride is specified. SystemBlobFileManagementProvider must be implemented.

GetFileLinkFromFileId ( int fileId, string labelOverride = null, string textIfNoFile = "" ) : Control

Returns a link to download a file with the given file ID. If no file is associated with the given file collection ID, returns a literal control with textIfNoFile text. The file name is used as the label unless labelOverride is specified. SystemBlobFileManagementProvider must be implemented.

GetFirstFileFromCollection ( int fileCollectionId ) : EnterpriseWebLibrary.EnterpriseWebFramework.Controls.BlobFile

Returns the first file in the specified file collection, or null if the collection is empty.

GetWidthAndHeightImageValidationMethod ( string subject, int width, int height ) : System.Drawing.Image>.Action

Provides a height/width image validation method without you having to create a custom validation method.

IsValidPdfFile ( Stream sourceStream ) : bool

Returns true if the file is a valid PDF file. Caller is responsible for opening and cleaning up the stream. You should check other meta information about the file (such as the extension) before calling this expensive method.

IsValidPdfFile ( byte contents ) : bool

Returns true if the file is a valid PDF file. You should check other meta information about the file (such as the extension) before calling this expensive method.

IsValidPdfFile ( int fileId ) : bool

SystemBlobFileManagementProvider must be implemented. You should check other meta information about the file (such as the extension) before calling this expensive method.

ValidateUploadedFile ( Validator validator, EwfFileUpload uploadedFile, string acceptableFileExtensions, System.Drawing.Image>.Action performAdditionalImageValidation, bool mustBeRenderableImage ) : void

Uploaded file cannot be null. But if uploadedFile.HasFile is false, this will be a no-op. Pass null for acceptableFileExtensions if there is no restriction on file extension. PerformAdditionalImageValidation cannot be null but may be an empty delegate.

Private Methods

Method Description
GetContentTypeForPostedFile ( EnterpriseWebLibrary.IO.RsFile file ) : string

Returns the content type of the given HttpPostedFile.

GetThumbnailControl ( EnterpriseWebLibrary.EnterpriseWebFramework.Controls.BlobFile file, ResourceInfo>.Func thumbnailResourceInfoCreator ) : Control

Returns null if the file is null, the file is not an image, or there is no thumbnail resource info creator.

Init ( ) : void
OrderByName ( this rows ) : IEnumerable
OrderByUploadedDateDescending ( this rows ) : IEnumerable

Method Details

CopyFileCollection() public static method

Copies the specified file collection and returns the ID of the copy.
public static CopyFileCollection ( int fileCollectionId ) : int
fileCollectionId int
return int

GetFileLink() public static method

Returns a link to download a file with the given file collection ID. If no file is associated with the given file collection ID, returns a literal control with textIfNoFile text. The file name is used as the label unless labelOverride is specified. SystemBlobFileManagementProvider must be implemented.
public static GetFileLink ( int fileCollectionId, string labelOverride = null, string textIfNoFile = "" ) : Control
fileCollectionId int
labelOverride string
textIfNoFile string
return System.Web.UI.Control

GetFileLinkFromFileId() public static method

Returns a link to download a file with the given file ID. If no file is associated with the given file collection ID, returns a literal control with textIfNoFile text. The file name is used as the label unless labelOverride is specified. SystemBlobFileManagementProvider must be implemented.
public static GetFileLinkFromFileId ( int fileId, string labelOverride = null, string textIfNoFile = "" ) : Control
fileId int
labelOverride string
textIfNoFile string
return System.Web.UI.Control

GetFirstFileFromCollection() public static method

Returns the first file in the specified file collection, or null if the collection is empty.
public static GetFirstFileFromCollection ( int fileCollectionId ) : EnterpriseWebLibrary.EnterpriseWebFramework.Controls.BlobFile
fileCollectionId int
return EnterpriseWebLibrary.EnterpriseWebFramework.Controls.BlobFile

GetWidthAndHeightImageValidationMethod() public static method

Provides a height/width image validation method without you having to create a custom validation method.
public static GetWidthAndHeightImageValidationMethod ( string subject, int width, int height ) : System.Drawing.Image>.Action
subject string
width int
height int
return System.Drawing.Image>.Action

IsValidPdfFile() public static method

Returns true if the file is a valid PDF file. Caller is responsible for opening and cleaning up the stream. You should check other meta information about the file (such as the extension) before calling this expensive method.
public static IsValidPdfFile ( Stream sourceStream ) : bool
sourceStream Stream
return bool

IsValidPdfFile() public static method

Returns true if the file is a valid PDF file. You should check other meta information about the file (such as the extension) before calling this expensive method.
public static IsValidPdfFile ( byte contents ) : bool
contents byte
return bool

IsValidPdfFile() public static method

SystemBlobFileManagementProvider must be implemented. You should check other meta information about the file (such as the extension) before calling this expensive method.
public static IsValidPdfFile ( int fileId ) : bool
fileId int
return bool

ValidateUploadedFile() public static method

Uploaded file cannot be null. But if uploadedFile.HasFile is false, this will be a no-op. Pass null for acceptableFileExtensions if there is no restriction on file extension. PerformAdditionalImageValidation cannot be null but may be an empty delegate.
public static ValidateUploadedFile ( Validator validator, EwfFileUpload uploadedFile, string acceptableFileExtensions, System.Drawing.Image>.Action performAdditionalImageValidation, bool mustBeRenderableImage ) : void
validator Validator
uploadedFile EwfFileUpload
acceptableFileExtensions string
performAdditionalImageValidation System.Drawing.Image>.Action
mustBeRenderableImage bool
return void