Example #1
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllFieldSetsStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'FieldSet_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllFieldSetsStoredProcedure' object.</returns>
        public static new FetchAllFieldSetsStoredProcedure CreateFetchAllFieldSetsStoredProcedure(FieldSet fieldSet)
        {
            // Initial value
            FetchAllFieldSetsStoredProcedure fetchAllFieldSetsStoredProcedure = new FetchAllFieldSetsStoredProcedure();

            // If the fieldSet object exists
            if (fieldSet != null)
            {
                // if FetchAllForTable is true and the TableId is set
                if ((fieldSet.FetchAllForTable) && (fieldSet.HasTableId))
                {
                    // if ParameterMode is true, only FieldSets set to ParameterMode = true will be shown
                    if (fieldSet.ParameterMode)
                    {
                        // change the ProcedureName
                        fetchAllFieldSetsStoredProcedure.ProcedureName = "FieldSet_FetchAllInParameterModeForTable";
                    }
                    else
                    {
                        // change the ProcedureName
                        fetchAllFieldSetsStoredProcedure.ProcedureName = "FieldSet_FetchAllForTable";
                    }

                    // Create the TableId parameter
                    fetchAllFieldSetsStoredProcedure.Parameters = SqlParameterHelper.CreateSqlParameters("@TableId", fieldSet.TableId);
                }
            }

            // return value
            return(fetchAllFieldSetsStoredProcedure);
        }
Example #2
0
        /// <summary>
        /// This method fetches a  'List<FieldSet>' object.
        /// This method uses the 'FieldSets_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<FieldSet>'</returns>
        /// </summary>
        public List <FieldSet> FetchAllFieldSets(FetchAllFieldSetsStoredProcedure fetchAllFieldSetsProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <FieldSet> fieldSetCollection = null;

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

                // Verify DataSet Exists
                if (allFieldSetsDataSet != null)
                {
                    // Get DataTable From DataSet
                    DataTable table = this.DataHelper.ReturnFirstTable(allFieldSetsDataSet);

                    // if table exists
                    if (table != null)
                    {
                        // Load Collection
                        fieldSetCollection = FieldSetReader.LoadCollection(table);
                    }
                }
            }

            // return value
            return(fieldSetCollection);
        }
Example #3
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllFieldSetsStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'FieldSet_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllFieldSetsStoredProcedure' object.</returns>
        public static FetchAllFieldSetsStoredProcedure CreateFetchAllFieldSetsStoredProcedure(FieldSet fieldSet)
        {
            // Initial value
            FetchAllFieldSetsStoredProcedure fetchAllFieldSetsStoredProcedure = new FetchAllFieldSetsStoredProcedure();

            // return value
            return(fetchAllFieldSetsStoredProcedure);
        }
Example #4
0
        /// <summary>
        /// This method fetches all 'FieldSet' objects.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'FieldSet' to delete.
        /// <returns>A PolymorphicObject object with all  'FieldSets' objects.
        internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            List <FieldSet> fieldSetListCollection = null;

            // Create FetchAll StoredProcedure
            FetchAllFieldSetsStoredProcedure fetchAllProc = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Get FieldSetParameter
                // Declare Parameter
                FieldSet paramFieldSet = null;

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

                // Now create FetchAllFieldSetsProc from FieldSetWriter
                fetchAllProc = FieldSetWriter.CreateFetchAllFieldSetsStoredProcedure(paramFieldSet);
            }

            // Verify fetchAllProc exists
            if (fetchAllProc != null)
            {
                // Execute FetchAll Stored Procedure
                fieldSetListCollection = this.DataManager.FieldSetManager.FetchAllFieldSets(fetchAllProc, dataConnector);

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

            // return value
            return(returnObject);
        }