Пример #1
0
        /// <summary>
        /// This method fetches a  'List<Project>' object.
        /// This method uses the 'Projects_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<Project>'</returns>
        /// </summary>
        public List <Project> FetchAllProjects(FetchAllProjectsStoredProcedure fetchAllProjectsProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <Project> projectCollection = null;

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

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

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

            // return value
            return(projectCollection);
        }
Пример #2
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllProjectsStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Project_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllProjectsStoredProcedure' object.</returns>
        public static FetchAllProjectsStoredProcedure CreateFetchAllProjectsStoredProcedure(Project project)
        {
            // Initial value
            FetchAllProjectsStoredProcedure fetchAllProjectsStoredProcedure = new FetchAllProjectsStoredProcedure();

            // return value
            return(fetchAllProjectsStoredProcedure);
        }
Пример #3
0
        /// <summary>
        /// This method fetches all 'Project' objects.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Project' to delete.
        /// <returns>A PolymorphicObject object with all  'Projects' objects.
        internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            List <Project> projectListCollection = null;

            // Create FetchAll StoredProcedure
            FetchAllProjectsStoredProcedure fetchAllProc = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Get ProjectParameter
                // Declare Parameter
                Project paramProject = null;

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

                // Now create FetchAllProjectsProc from ProjectWriter
                fetchAllProc = ProjectWriter.CreateFetchAllProjectsStoredProcedure(paramProject);
            }

            // Verify fetchAllProc exists
            if (fetchAllProc != null)
            {
                // Execute FetchAll Stored Procedure
                projectListCollection = this.DataManager.ProjectManager.FetchAllProjects(fetchAllProc, dataConnector);

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

            // return value
            return(returnObject);
        }