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