//Updates the values of exhibition item with matching ID public static void update(int exhibitionID, string name, string description, string type) { string sql; sql = "updateExhibition @exhibitionID =" + exhibitionID + ",@name='" + name + "',@type='" + type + "',@description="; sql = SqlComm.AddIfNotNull(sql, description); SqlComm.SqlExecute(sql); }
//Updates the values of media item with matching ID public static void update(int mediaID, int artistID, string youtubeURL, string name, string description) { string sql; sql = "updateMedia @mediaID =" + mediaID + ",@artistID=" + artistID + ",@youtubeURL="; sql = SqlComm.AddIfNotNull(sql, youtubeURL); sql = sql + ", @name='"+ name + "',@description="; sql = SqlComm.AddIfNotNull(sql, description); SqlComm.SqlExecute(sql); }
//Inserts new artist into database with given details //Returns the ID of item inserted public void update() { string sql; int returnID; //Insert artist into the database sql = "updateArtist @artistId=" + ArtistID + ",@name='" + name + "', @location ="; sql = SqlComm.AddIfNotNull(sql, location); sql = sql + ",@bio="; sql = SqlComm.AddIfNotNull(sql, bio); SqlComm.SqlReturn(sql); }
//Inserts a new exhibition into the database with given details //Returns the exhibitionID of the item public static int insert(string name, string description, int artistID, string type) { int returnID; string sql = "insertNewExhibition @name='" + name + "',@curatedBy = " + artistID + ",@description="; sql = SqlComm.AddIfNotNull(sql, description); sql = sql + ",@type = '" + type + "'"; //Don't know why I had to cast this as a decimal first but it was throwing an error when I tried casting to int directly Decimal returnValue = (Decimal)SqlComm.SqlReturn(sql); returnID = (int)returnValue; return(returnID); }
//Inserts media item into the database //Returns the id of item inserted public static int insert(int exhibitionID, int artistID, string youtubeURL, string filename, string name, string description) { string sql; int returnID; sql = "insertNewMedia @exhibition=" + exhibitionID + ",@artist=" + artistID + ",@youtubeURL="; sql = SqlComm.AddIfNotNull(sql, youtubeURL); sql = sql + ", @filename='"+ filename + "', @name='"+ name + "',@description="; sql = SqlComm.AddIfNotNull(sql, description); //Don't know why I had to cast this as a decimal first but it was throwing an error when I tried casting to int directly Decimal returnValue = (Decimal)SqlComm.SqlReturn(sql); returnID = (int)returnValue; return(returnID); }
//Inserts new artist into database with given details //Returns the ID of item inserted public static int insert(int userID, string name, string location, string bio) { string sql; int returnID; //Insert artist into the database sql = "insertNewArtist @userID=" + userID + ",@name='" + name + "', @location ="; sql = SqlComm.AddIfNotNull(sql, location); sql = sql + ",@bio="; sql = SqlComm.AddIfNotNull(sql, bio); //Don't know why I had to cast this as a decimal first but it was throwing an error when I tried casting to int directly Decimal returnValue = (Decimal)SqlComm.SqlReturn(sql); returnID = (int)returnValue; return(returnID); }