/// <summary> /// This method updates a 'FirstName'. /// This method uses the 'FirstName_Update' procedure. /// </summary> /// <returns>True if successful false if not.</returns> /// </summary> public bool UpdateFirstName(UpdateFirstNameStoredProcedure updateFirstNameProc, DataConnector databaseConnector) { // Initial Value bool saved = false; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Update. saved = this.DataHelper.UpdateRecord(updateFirstNameProc, databaseConnector); } // return value return(saved); }
/// <summary> /// This method creates an instance of an /// 'UpdateFirstNameStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'FirstName_Update'. /// </summary> /// <param name="firstName"The 'FirstName' object to update</param> /// <returns>An instance of a 'UpdateFirstNameStoredProcedure</returns> public static UpdateFirstNameStoredProcedure CreateUpdateFirstNameStoredProcedure(FirstName firstName) { // Initial Value UpdateFirstNameStoredProcedure updateFirstNameStoredProcedure = null; // verify firstName exists if (firstName != null) { // Instanciate updateFirstNameStoredProcedure updateFirstNameStoredProcedure = new UpdateFirstNameStoredProcedure(); // Now create parameters for this procedure updateFirstNameStoredProcedure.Parameters = CreateUpdateParameters(firstName); } // return value return(updateFirstNameStoredProcedure); }
/// <summary> /// This method updates a 'FirstName' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'FirstName' to update. /// <returns>A PolymorphicObject object with a value. internal PolymorphicObject UpdateFirstName(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals FirstName firstName = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Update StoredProcedure UpdateFirstNameStoredProcedure updateFirstNameProc = null; // verify the first parameters is a(n) 'FirstName'. if (parameters[0].ObjectValue as FirstName != null) { // Create FirstName Parameter firstName = (FirstName)parameters[0].ObjectValue; // verify firstName exists if (firstName != null) { // Now create updateFirstNameProc from FirstNameWriter // The DataWriter converts the 'FirstName' // to the SqlParameter[] array needed to update a 'FirstName'. updateFirstNameProc = FirstNameWriter.CreateUpdateFirstNameStoredProcedure(firstName); } // Verify updateFirstNameProc exists if (updateFirstNameProc != null) { // Execute Update Stored Procedure bool saved = this.DataManager.FirstNameManager.UpdateFirstName(updateFirstNameProc, 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); }