예제 #1
0
        /// <summary>
        /// This method inserts a 'FieldSet' object.
        /// This method uses the 'FieldSet_Insert' procedure.
        /// </summary>
        /// <returns>The identity value of the new record.</returns>
        /// </summary>
        public int InsertFieldSet(InsertFieldSetStoredProcedure insertFieldSetProc, DataConnector databaseConnector)
        {
            // Initial Value
            int newIdentity = -1;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // Execute Non Query
                newIdentity = this.DataHelper.InsertRecord(insertFieldSetProc, databaseConnector);
            }

            // return value
            return(newIdentity);
        }
예제 #2
0
        /// <summary>
        /// This method inserts a 'FieldSet' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'FieldSet' to insert.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject InsertFieldSet(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            FieldSet fieldSet = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Insert StoredProcedure
                InsertFieldSetStoredProcedure insertFieldSetProc = null;

                // verify the first parameters is a(n) 'FieldSet'.
                if (parameters[0].ObjectValue as FieldSet != null)
                {
                    // Create FieldSet Parameter
                    fieldSet = (FieldSet)parameters[0].ObjectValue;

                    // verify fieldSet exists
                    if (fieldSet != null)
                    {
                        // Now create insertFieldSetProc from FieldSetWriter
                        // The DataWriter converts the 'FieldSet'
                        // to the SqlParameter[] array needed to insert a 'FieldSet'.
                        insertFieldSetProc = FieldSetWriter.CreateInsertFieldSetStoredProcedure(fieldSet);
                    }

                    // Verify insertFieldSetProc exists
                    if (insertFieldSetProc != null)
                    {
                        // Execute Insert Stored Procedure
                        returnObject.IntegerValue = this.DataManager.FieldSetManager.InsertFieldSet(insertFieldSetProc, dataConnector);
                    }
                }
                else
                {
                    // Raise Error Data Connection Not Available
                    throw new Exception("The database connection is not available.");
                }
            }

            // return value
            return(returnObject);
        }
예제 #3
0
        /// <summary>
        /// This method creates an instance of an
        /// 'InsertFieldSetStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'FieldSet_Insert'.
        /// </summary>
        /// <param name="fieldSet"The 'FieldSet' object to insert</param>
        /// <returns>An instance of a 'InsertFieldSetStoredProcedure' object.</returns>
        public static InsertFieldSetStoredProcedure CreateInsertFieldSetStoredProcedure(FieldSet fieldSet)
        {
            // Initial Value
            InsertFieldSetStoredProcedure insertFieldSetStoredProcedure = null;

            // verify fieldSet exists
            if (fieldSet != null)
            {
                // Instanciate insertFieldSetStoredProcedure
                insertFieldSetStoredProcedure = new InsertFieldSetStoredProcedure();

                // Now create parameters for this procedure
                insertFieldSetStoredProcedure.Parameters = CreateInsertParameters(fieldSet);
            }

            // return value
            return(insertFieldSetStoredProcedure);
        }