C# Класс PAWA.Classes.Tools

Показать файл Открыть проект

Private Properties

Свойство Тип Описание
HexByteArrayToHexString string

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
HexByteArrayToHexString ( byte hexValues, string fileExtension ) : string

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

Описание методов

CreateFilename() публичный Метод

public CreateFilename ( int userid, string filename ) : string
userid int
filename string
Результат string

CreateTagCloudOverlayContents() публичный статический Метод

public static CreateTagCloudOverlayContents ( List tags ) : string
tags List
Результат string

GetFilesFromFolder() публичный Метод

public GetFilesFromFolder ( int folderID, int userId ) : IEnumerable
folderID int
userId int
Результат IEnumerable

GetTop100Tags() публичный статический Метод

Gets the 100 most used tags from the database.
public static GetTop100Tags ( IPAWAContext dbContext ) : List
dbContext IPAWAContext
Результат List

GetUsers() публичный Метод

Gets all users
public GetUsers ( ) : IEnumerable
Результат IEnumerable

ImageResize() публичный Метод

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
Результат Image

PhotoValidation() публичный Метод

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
Результат System.Boolean

TagUsedCountIncrease() публичный Метод

Increase the selected tags usedcount in the database by 1 everytime this method is called
public TagUsedCountIncrease ( string tagName ) : void
tagName string
Результат void

changeFolderName() публичный Метод

public changeFolderName ( int userID, int folderID, string newFolderName ) : bool
userID int
folderID int
newFolderName string
Результат bool

checkExtension() публичный Метод

Checks the extension of the image and returns the correct format for saving
public checkExtension ( string file ) : System.Drawing.Imaging.ImageFormat
file string
Результат System.Drawing.Imaging.ImageFormat

checkIfTagExists() публичный Метод

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
Результат List

convertTagsToString() публичный Метод

Combines all the tagIDs from a List into a string for AlbumView Display
public convertTagsToString ( List TagIDs ) : string
TagIDs List
Результат string

createTag() публичный Метод

Used to insert tags into the DB
public createTag ( string name, string type ) : void
name string
type string
Результат void

deselectFile() публичный Метод

removes a file from the list of files set totalcount - 1
public deselectFile ( int id ) : void
id int
Результат void

findInfinateParentLoop() публичный Метод

public findInfinateParentLoop ( Folder testFolderIn ) : int
testFolderIn PAWA.Models.Folder
Результат int

getFiles() публичный Метод

public getFiles ( int userID ) : IList
userID int
Результат IList

getFolder() публичный Метод

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.
Результат PAWA.Models.Folder

getFolder() публичный Метод

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.
Результат PAWA.Models.Folder

getFolders() публичный Метод

Returns all of the users owned folders in a List(folders)
public getFolders ( int userID ) : IList
userID int
Результат IList

getTag() публичный Метод

public getTag ( int id ) : Tags
id int
Результат PAWA.Models.Tags

getTagID() публичный Метод

Used to get the tags id via passed tag name
public getTagID ( string tag ) : int
tag string
Результат int

getUserByID() публичный Метод

Gets the Users object via passed ID
public getUserByID ( int id ) : User
id int
Результат PAWA.Models.User

insertImageToDB() публичный Метод

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
Результат void

isSubfolder() публичный Метод

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
Результат int

moveFolder() публичный Метод

public moveFolder ( int userID, string folderToMoveID, int destinationFolderID ) : bool
userID int
folderToMoveID string
destinationFolderID int
Результат bool

moveFolder() публичный Метод

public moveFolder ( int userID, string folderToMoveID, string destinationFolderID ) : bool
userID int
folderToMoveID string
destinationFolderID string
Результат bool

selectFile() публичный Метод

SelectFile(int) adds a file from the list of files set totalcount + 1
public selectFile ( int id ) : List
id int
Результат List

seperateTags() публичный Метод

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
Результат string[]