/// <summary> /// This method inserts a 'DTNField' object. /// This method uses the 'DTNField_Insert' procedure. /// </summary> /// <returns>The identity value of the new record.</returns> /// </summary> public int InsertDTNField(InsertDTNFieldStoredProcedure insertDTNFieldProc, DataConnector databaseConnector) { // Initial Value int newIdentity = -1; // Verify database connection is connected if ((databaseConnector != null) && (databaseConnector.Connected)) { // Execute Non Query newIdentity = this.DataHelper.InsertRecord(insertDTNFieldProc, databaseConnector); } // return value return(newIdentity); }
/// <summary> /// This method inserts a 'DTNField' object. /// </summary> /// <param name='List<PolymorphicObject>'>The 'DTNField' to insert. /// <returns>A PolymorphicObject object with a Boolean value. internal PolymorphicObject InsertDTNField(List <PolymorphicObject> parameters, DataConnector dataConnector) { // Initial Value PolymorphicObject returnObject = new PolymorphicObject(); // locals DTNField dTNField = null; // If the data connection is connected if ((dataConnector != null) && (dataConnector.Connected == true)) { // Create Insert StoredProcedure InsertDTNFieldStoredProcedure insertDTNFieldProc = null; // verify the first parameters is a(n) 'DTNField'. if (parameters[0].ObjectValue as DTNField != null) { // Create DTNField Parameter dTNField = (DTNField)parameters[0].ObjectValue; // verify dTNField exists if (dTNField != null) { // Now create insertDTNFieldProc from DTNFieldWriter // The DataWriter converts the 'DTNField' // to the SqlParameter[] array needed to insert a 'DTNField'. insertDTNFieldProc = DTNFieldWriter.CreateInsertDTNFieldStoredProcedure(dTNField); } // Verify insertDTNFieldProc exists if (insertDTNFieldProc != null) { // Execute Insert Stored Procedure returnObject.IntegerValue = this.DataManager.DTNFieldManager.InsertDTNField(insertDTNFieldProc, 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 /// 'InsertDTNFieldStoredProcedure' object and /// creates the sql parameter[] array needed /// to execute the procedure 'DTNField_Insert'. /// </summary> /// <param name="dTNField"The 'DTNField' object to insert</param> /// <returns>An instance of a 'InsertDTNFieldStoredProcedure' object.</returns> public static InsertDTNFieldStoredProcedure CreateInsertDTNFieldStoredProcedure(DTNField dTNField) { // Initial Value InsertDTNFieldStoredProcedure insertDTNFieldStoredProcedure = null; // verify dTNField exists if (dTNField != null) { // Instanciate insertDTNFieldStoredProcedure insertDTNFieldStoredProcedure = new InsertDTNFieldStoredProcedure(); // Now create parameters for this procedure insertDTNFieldStoredProcedure.Parameters = CreateInsertParameters(dTNField); } // return value return(insertDTNFieldStoredProcedure); }