/// <summary> /// This method updates a 'Artist'. /// This method uses the 'Artist_Update' procedure. /// </summary> /// <returns>True if successful false if not.</returns> /// </summary> public bool UpdateArtist(UpdateArtistStoredProcedure updateArtistProc, DataConnector databaseConnector) { // Initial Value bool saved = false; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Update. saved = this.DataHelper.UpdateRecord(updateArtistProc, databaseConnector); } // return value return(saved); }
/// <summary> /// This method creates an instance of an /// 'UpdateArtistStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Artist_Update'. /// </summary> /// <param name="artist"The 'Artist' object to update</param> /// <returns>An instance of a 'UpdateArtistStoredProcedure</returns> public static UpdateArtistStoredProcedure CreateUpdateArtistStoredProcedure(Artist artist) { // Initial Value UpdateArtistStoredProcedure updateArtistStoredProcedure = null; // verify artist exists if (artist != null) { // Instanciate updateArtistStoredProcedure updateArtistStoredProcedure = new UpdateArtistStoredProcedure(); // Now create parameters for this procedure updateArtistStoredProcedure.Parameters = CreateUpdateParameters(artist); } // return value return(updateArtistStoredProcedure); }
/// <summary> /// This method updates a 'Artist' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Artist' to update. /// <returns>A PolymorphicObject object with a value. internal PolymorphicObject UpdateArtist(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals Artist artist = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Update StoredProcedure UpdateArtistStoredProcedure updateArtistProc = null; // verify the first parameters is a(n) 'Artist'. if (parameters[0].ObjectValue as Artist != null) { // Create Artist Parameter artist = (Artist)parameters[0].ObjectValue; // verify artist exists if (artist != null) { // Now create updateArtistProc from ArtistWriter // The DataWriter converts the 'Artist' // to the SqlParameter[] array needed to update a 'Artist'. updateArtistProc = ArtistWriter.CreateUpdateArtistStoredProcedure(artist); } // Verify updateArtistProc exists if (updateArtistProc != null) { // Execute Update Stored Procedure bool saved = this.DataManager.ArtistManager.UpdateArtist(updateArtistProc, dataConnector); // Create returnObject.Boolean returnObject.Boolean = new NullableBoolean(); // If save was successful if (saved) { // Set returnObject.Boolean.Value to true returnObject.Boolean.Value = NullableBooleanEnum.True; } else { // Set returnObject.Boolean.Value to false returnObject.Boolean.Value = NullableBooleanEnum.False; } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } } } // return value return(returnObject); }