C# Class PAWA.Classes.Tools

Mostrar archivo Open project: jarradm/PAWA

Private Properties

Property Type Description
HexByteArrayToHexString string

Public Methods

Method 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

Method Description
HexByteArrayToHexString ( byte hexValues, string fileExtension ) : string

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

Method Details

CreateFilename() public method

public CreateFilename ( int userid, string filename ) : string
userid int
filename string
return string

CreateTagCloudOverlayContents() public static method

public static CreateTagCloudOverlayContents ( List tags ) : string
tags List
return string

GetFilesFromFolder() public method

public GetFilesFromFolder ( int folderID, int userId ) : IEnumerable
folderID int
userId int
return IEnumerable

GetTop100Tags() public static method

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

GetUsers() public method

Gets all users
public GetUsers ( ) : IEnumerable
return IEnumerable

ImageResize() public method

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
return Image

PhotoValidation() public method

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
return System.Boolean

TagUsedCountIncrease() public method

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

changeFolderName() public method

public changeFolderName ( int userID, int folderID, string newFolderName ) : bool
userID int
folderID int
newFolderName string
return bool

checkExtension() public method

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

checkIfTagExists() public method

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
return List

convertTagsToString() public method

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

createTag() public method

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

deselectFile() public method

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

findInfinateParentLoop() public method

public findInfinateParentLoop ( Folder testFolderIn ) : int
testFolderIn PAWA.Models.Folder
return int

getFiles() public method

public getFiles ( int userID ) : IList
userID int
return IList

getFolder() public method

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.
return PAWA.Models.Folder

getFolder() public method

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.
return PAWA.Models.Folder

getFolders() public method

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

getTag() public method

public getTag ( int id ) : Tags
id int
return PAWA.Models.Tags

getTagID() public method

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

getUserByID() public method

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

insertImageToDB() public method

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
return void

isSubfolder() public method

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
return int

moveFolder() public method

public moveFolder ( int userID, string folderToMoveID, int destinationFolderID ) : bool
userID int
folderToMoveID string
destinationFolderID int
return bool

moveFolder() public method

public moveFolder ( int userID, string folderToMoveID, string destinationFolderID ) : bool
userID int
folderToMoveID string
destinationFolderID string
return bool

selectFile() public method

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

seperateTags() public method

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
return string[]