C# Class PAWA.Classes.Tools

Afficher le fichier Open project: jarradm/PAWA

Private Properties

Свойство Type Description
HexByteArrayToHexString string

Méthodes publiques

Méthode Description
CreateFilename ( int userid, string filename ) : string
CreateTagCloudOverlayContents ( List tags ) : string
GetFilesFromFolder ( int folderID, int userId ) : IEnumerable
GetTop100Tags ( IPAWAContext dbContext ) : List

Gets the 100 most used tags from the database.

GetUsers ( ) : IEnumerable

Gets all users

ImageResize ( Image imgFile, Size newSize ) : Image

Take in image, create a new bitmap, bitmap size = newsize Render and clean image Apply image to bitmap Return the thumbnail

PhotoValidation ( System.Web.HttpPostedFileBase image ) : System.Boolean

Confirms that the file uploaded is not null and is a image of the required type.

TagUsedCountIncrease ( string tagName ) : void

Increase the selected tags usedcount in the database by 1 everytime this method is called

changeFolderName ( int userID, int folderID, string newFolderName ) : bool
checkExtension ( string file ) : System.Drawing.Imaging.ImageFormat

Checks the extension of the image and returns the correct format for saving

checkIfTagExists ( string TagArr ) : List

Will used the passed array to compare against the DB, if the tag doesnt exist it will create it. returning all of the images tags IDs in a List(int)

convertTagsToString ( List TagIDs ) : string

Combines all the tagIDs from a List into a string for AlbumView Display

createTag ( string name, string type ) : void

Used to insert tags into the DB

deselectFile ( int id ) : void

removes a file from the list of files set totalcount - 1

findInfinateParentLoop ( Folder testFolderIn ) : int
getFiles ( int userID ) : IList
getFolder ( int userID, int folderID ) : Folder

Returns the specific Folder, given the Folder ID and the User ID.

getFolder ( int userID, string folderID ) : Folder

The overloaded Get folder method.

getFolders ( int userID ) : IList

Returns all of the users owned folders in a List(folders)

getTag ( int id ) : Tags
getTagID ( string tag ) : int

Used to get the tags id via passed tag name

getUserByID ( int id ) : User

Gets the Users object via passed ID

insertImageToDB ( int Height, int Width, int FileSize, string FileName, string Tags, string Description, int FolderID ) : void

Uses all passed parimeters to create a new db image object, then pushes it into the db and saves

isSubfolder ( Folder subfolder, Folder parentFolder ) : int

Returns 1 if the subfolder is within the directory tree of the parent folder. Returns 0 if root folder . If the subfolder is in a nonconventional loop(root folder is missing), the return is -1.

moveFolder ( int userID, string folderToMoveID, int destinationFolderID ) : bool
moveFolder ( int userID, string folderToMoveID, string destinationFolderID ) : bool
selectFile ( int id ) : List

SelectFile(int) adds a file from the list of files set totalcount + 1

seperateTags ( string s ) : string[]

Seperate the string via ',' Replace , with space cut up string via spaces and store into array. return array.

Private Methods

Méthode Description
HexByteArrayToHexString ( byte hexValues, string fileExtension ) : string

Converts a hexadecimal byte array into a filename string representing the hexadecimal bytes.

Method Details

CreateFilename() public méthode

public CreateFilename ( int userid, string filename ) : string
userid int
filename string
Résultat string

CreateTagCloudOverlayContents() public static méthode

public static CreateTagCloudOverlayContents ( List tags ) : string
tags List
Résultat string

GetFilesFromFolder() public méthode

public GetFilesFromFolder ( int folderID, int userId ) : IEnumerable
folderID int
userId int
Résultat IEnumerable

GetTop100Tags() public static méthode

Gets the 100 most used tags from the database.
public static GetTop100Tags ( IPAWAContext dbContext ) : List
dbContext IPAWAContext
Résultat List

GetUsers() public méthode

Gets all users
public GetUsers ( ) : IEnumerable
Résultat IEnumerable

ImageResize() public méthode

Take in image, create a new bitmap, bitmap size = newsize Render and clean image Apply image to bitmap Return the thumbnail
public ImageResize ( Image imgFile, Size newSize ) : Image
imgFile Image
newSize System.Drawing.Size
Résultat Image

PhotoValidation() public méthode

Confirms that the file uploaded is not null and is a image of the required type.
public PhotoValidation ( System.Web.HttpPostedFileBase image ) : System.Boolean
image System.Web.HttpPostedFileBase
Résultat System.Boolean

TagUsedCountIncrease() public méthode

Increase the selected tags usedcount in the database by 1 everytime this method is called
public TagUsedCountIncrease ( string tagName ) : void
tagName string
Résultat void

changeFolderName() public méthode

public changeFolderName ( int userID, int folderID, string newFolderName ) : bool
userID int
folderID int
newFolderName string
Résultat bool

checkExtension() public méthode

Checks the extension of the image and returns the correct format for saving
public checkExtension ( string file ) : System.Drawing.Imaging.ImageFormat
file string
Résultat System.Drawing.Imaging.ImageFormat

checkIfTagExists() public méthode

Will used the passed array to compare against the DB, if the tag doesnt exist it will create it. returning all of the images tags IDs in a List(int)
public checkIfTagExists ( string TagArr ) : List
TagArr string
Résultat List

convertTagsToString() public méthode

Combines all the tagIDs from a List into a string for AlbumView Display
public convertTagsToString ( List TagIDs ) : string
TagIDs List
Résultat string

createTag() public méthode

Used to insert tags into the DB
public createTag ( string name, string type ) : void
name string
type string
Résultat void

deselectFile() public méthode

removes a file from the list of files set totalcount - 1
public deselectFile ( int id ) : void
id int
Résultat void

findInfinateParentLoop() public méthode

public findInfinateParentLoop ( Folder testFolderIn ) : int
testFolderIn PAWA.Models.Folder
Résultat int

getFiles() public méthode

public getFiles ( int userID ) : IList
userID int
Résultat IList

getFolder() public méthode

Returns the specific Folder, given the Folder ID and the User ID.
public getFolder ( int userID, int folderID ) : Folder
userID int ID of the user to witch the folder pertains.
folderID int ID of the folder that is being fetched.
Résultat PAWA.Models.Folder

getFolder() public méthode

The overloaded Get folder method.
public getFolder ( int userID, string folderID ) : Folder
userID int ID of the user to witch the folder pertains.
folderID string ID of the folder that is being fetched.
Résultat PAWA.Models.Folder

getFolders() public méthode

Returns all of the users owned folders in a List(folders)
public getFolders ( int userID ) : IList
userID int
Résultat IList

getTag() public méthode

public getTag ( int id ) : Tags
id int
Résultat PAWA.Models.Tags

getTagID() public méthode

Used to get the tags id via passed tag name
public getTagID ( string tag ) : int
tag string
Résultat int

getUserByID() public méthode

Gets the Users object via passed ID
public getUserByID ( int id ) : User
id int
Résultat PAWA.Models.User

insertImageToDB() public méthode

Uses all passed parimeters to create a new db image object, then pushes it into the db and saves
public insertImageToDB ( int Height, int Width, int FileSize, string FileName, string Tags, string Description, int FolderID ) : void
Height int
Width int
FileSize int
FileName string
Tags string
Description string
FolderID int
Résultat void

isSubfolder() public méthode

Returns 1 if the subfolder is within the directory tree of the parent folder. Returns 0 if root folder . If the subfolder is in a nonconventional loop(root folder is missing), the return is -1.
public isSubfolder ( Folder subfolder, Folder parentFolder ) : int
subfolder PAWA.Models.Folder Folder that is presumed to be a child of the parent folder
parentFolder PAWA.Models.Folder folder that is persumed to contain the sub folder
Résultat int

moveFolder() public méthode

public moveFolder ( int userID, string folderToMoveID, int destinationFolderID ) : bool
userID int
folderToMoveID string
destinationFolderID int
Résultat bool

moveFolder() public méthode

public moveFolder ( int userID, string folderToMoveID, string destinationFolderID ) : bool
userID int
folderToMoveID string
destinationFolderID string
Résultat bool

selectFile() public méthode

SelectFile(int) adds a file from the list of files set totalcount + 1
public selectFile ( int id ) : List
id int
Résultat List

seperateTags() public méthode

Seperate the string via ',' Replace , with space cut up string via spaces and store into array. return array.
public seperateTags ( string s ) : string[]
s string
Résultat string[]