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