コード例 #1
0
        /// <summary>
        /// This method finds a  'DTNTable' object.
        /// This method uses the 'DTNTable_Find' procedure.
        /// </summary>
        /// <returns>A 'DTNTable' object.</returns>
        /// </summary>
        public DTNTable FindDTNTable(FindDTNTableStoredProcedure findDTNTableProc, DataConnector databaseConnector)
        {
            // Initial Value
            DTNTable dTNTable = null;

            // Verify database connection is connected
            if ((databaseConnector != null) && (databaseConnector.Connected))
            {
                // First Get Dataset
                DataSet dTNTableDataSet = this.DataHelper.LoadDataSet(findDTNTableProc, databaseConnector);

                // Verify DataSet Exists
                if (dTNTableDataSet != null)
                {
                    // Get DataTable From DataSet
                    DataRow row = this.DataHelper.ReturnFirstRow(dTNTableDataSet);

                    // if row exists
                    if (row != null)
                    {
                        // Load DTNTable
                        dTNTable = DTNTableReader.Load(row);
                    }
                }
            }

            // return value
            return(dTNTable);
        }
コード例 #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 creates an instance of a
        /// 'FindDTNTableStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'DTNTable_Find'.
        /// </summary>
        /// <param name="dTNTable">The 'DTNTable' to use to
        /// get the primary key parameter.</param>
        /// <returns>An instance of an FetchUserStoredProcedure</returns>
        public static FindDTNTableStoredProcedure CreateFindDTNTableStoredProcedure(DTNTable dTNTable)
        {
            // Initial Value
            FindDTNTableStoredProcedure findDTNTableStoredProcedure = null;

            // verify dTNTable exists
            if (dTNTable != null)
            {
                // Instanciate findDTNTableStoredProcedure
                findDTNTableStoredProcedure = new FindDTNTableStoredProcedure();

                // Now create parameters for this procedure
                findDTNTableStoredProcedure.Parameters = CreatePrimaryKeyParameter(dTNTable);
            }

            // return value
            return(findDTNTableStoredProcedure);
        }