예제 #1
0
        /// <summary>
        /// This method deletes a 'DTNTable' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'DTNTable' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject DeleteDTNTable(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Delete StoredProcedure
                DeleteDTNTableStoredProcedure deleteDTNTableProc = null;

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

                    // verify dTNTable exists
                    if (dTNTable != null)
                    {
                        // Now create deleteDTNTableProc from DTNTableWriter
                        // The DataWriter converts the 'DTNTable'
                        // to the SqlParameter[] array needed to delete a 'DTNTable'.
                        deleteDTNTableProc = DTNTableWriter.CreateDeleteDTNTableStoredProcedure(dTNTable);
                    }
                }

                // Verify deleteDTNTableProc exists
                if (deleteDTNTableProc != null)
                {
                    // Execute Delete Stored Procedure
                    bool deleted = this.DataManager.DTNTableManager.DeleteDTNTable(deleteDTNTableProc, dataConnector);

                    // Create returnObject.Boolean
                    returnObject.Boolean = new NullableBoolean();

                    // If delete was successful
                    if (deleted)
                    {
                        // 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);
        }
예제 #2
0
        /// <summary>
        /// This method finds a 'DTNTable' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'DTNTable' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject FindDTNTable(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 Find StoredProcedure
                FindDTNTableStoredProcedure findDTNTableProc = null;

                // verify the first parameters is a 'DTNTable'.
                if (parameters[0].ObjectValue as DTNTable != null)
                {
                    // Get DTNTableParameter
                    DTNTable paramDTNTable = (DTNTable)parameters[0].ObjectValue;

                    // verify paramDTNTable exists
                    if (paramDTNTable != null)
                    {
                        // Now create findDTNTableProc from DTNTableWriter
                        // The DataWriter converts the 'DTNTable'
                        // to the SqlParameter[] array needed to find a 'DTNTable'.
                        findDTNTableProc = DTNTableWriter.CreateFindDTNTableStoredProcedure(paramDTNTable);
                    }

                    // Verify findDTNTableProc exists
                    if (findDTNTableProc != null)
                    {
                        // Execute Find Stored Procedure
                        dTNTable = this.DataManager.DTNTableManager.FindDTNTable(findDTNTableProc, dataConnector);

                        // if dataObject exists
                        if (dTNTable != null)
                        {
                            // set returnObject.ObjectValue
                            returnObject.ObjectValue = dTNTable;
                        }
                    }
                }
                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 fetches all 'DTNTable' objects.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'DTNTable' to delete.
        /// <returns>A PolymorphicObject object with all  'DTNTables' objects.
        internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            List <DTNTable> dTNTableListCollection = null;

            // Create FetchAll StoredProcedure
            FetchAllDTNTablesStoredProcedure fetchAllProc = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Get DTNTableParameter
                // Declare Parameter
                DTNTable paramDTNTable = null;

                // verify the first parameters is a(n) 'DTNTable'.
                if (parameters[0].ObjectValue as DTNTable != null)
                {
                    // Get DTNTableParameter
                    paramDTNTable = (DTNTable)parameters[0].ObjectValue;
                }

                // Now create FetchAllDTNTablesProc from DTNTableWriter
                fetchAllProc = DTNTableWriter.CreateFetchAllDTNTablesStoredProcedure(paramDTNTable);
            }

            // Verify fetchAllProc exists
            if (fetchAllProc != null)
            {
                // Execute FetchAll Stored Procedure
                dTNTableListCollection = this.DataManager.DTNTableManager.FetchAllDTNTables(fetchAllProc, dataConnector);

                // if dataObjectCollection exists
                if (dTNTableListCollection != null)
                {
                    // set returnObject.ObjectValue
                    returnObject.ObjectValue = dTNTableListCollection;
                }
            }
            else
            {
                // Raise Error Data Connection Not Available
                throw new Exception("The database connection is not available.");
            }

            // return value
            return(returnObject);
        }