/// <summary> /// This method inserts a 'Method' object. /// This method uses the 'Method_Insert' procedure. /// </summary> /// <returns>The identity value of the new record.</returns> /// </summary> public int InsertMethod(InsertMethodStoredProcedure insertMethodProc, DataConnector databaseConnector) { // Initial Value int newIdentity = -1; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Non Query newIdentity = this.DataHelper.InsertRecord(insertMethodProc, databaseConnector); } // return value return(newIdentity); }
/// <summary> /// This method inserts a 'Method' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'Method' to insert. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject InsertMethod(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 Insert StoredProcedure InsertMethodStoredProcedure insertMethodProc = 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 insertMethodProc from MethodWriter // The DataWriter converts the 'Method' // to the SqlParameter[] array needed to insert a 'Method'. insertMethodProc = MethodWriter.CreateInsertMethodStoredProcedure(method); } // Verify insertMethodProc exists if (insertMethodProc != null) { // Execute Insert Stored Procedure returnObject.IntegerValue = this.DataManager.MethodManager.InsertMethod(insertMethodProc, dataConnector); } } else { // Raise Error Data Connection Not Available throw new Exception("The database connection is not available."); } } // return value return(returnObject); }
/// <summary> /// This method creates an instance of an /// 'InsertMethodStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'Method_Insert'. /// </summary> /// <param name="method"The 'Method' object to insert</param> /// <returns>An instance of a 'InsertMethodStoredProcedure' object.</returns> public static InsertMethodStoredProcedure CreateInsertMethodStoredProcedure(Method method) { // Initial Value InsertMethodStoredProcedure insertMethodStoredProcedure = null; // verify method exists if (method != null) { // Instanciate insertMethodStoredProcedure insertMethodStoredProcedure = new InsertMethodStoredProcedure(); // Now create parameters for this procedure insertMethodStoredProcedure.Parameters = CreateInsertParameters(method); } // return value return(insertMethodStoredProcedure); }