예제 #1
0
        /// <summary>
        /// This method fetches a  'List<Image>' object.
        /// This method uses the 'Images_FetchAll' procedure.
        /// </summary>
        /// <returns>A 'List<Image>'</returns>
        /// </summary>
        public List <Image> FetchAllImages(FetchAllImagesStoredProcedure fetchAllImagesProc, DataConnector databaseConnector)
        {
            // Initial Value
            List <Image> imageCollection = null;

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

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

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

            // return value
            return(imageCollection);
        }
예제 #2
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllImagesStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Image_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllImagesStoredProcedure' object.</returns>
        public static FetchAllImagesStoredProcedure CreateFetchAllImagesStoredProcedure(Image image)
        {
            // Initial value
            FetchAllImagesStoredProcedure fetchAllImagesStoredProcedure = new FetchAllImagesStoredProcedure();

            // return value
            return(fetchAllImagesStoredProcedure);
        }
예제 #3
0
        /// <summary>
        /// This method fetches all 'Image' objects.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Image' to delete.
        /// <returns>A PolymorphicObject object with all  'Images' objects.
        internal PolymorphicObject FetchAll(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            List <Image> imageListCollection = null;

            // Create FetchAll StoredProcedure
            FetchAllImagesStoredProcedure fetchAllProc = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Get ImageParameter
                // Declare Parameter
                Image paramImage = null;

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

                // Now create FetchAllImagesProc from ImageWriter
                fetchAllProc = ImageWriter.CreateFetchAllImagesStoredProcedure(paramImage);
            }

            // Verify fetchAllProc exists
            if (fetchAllProc != null)
            {
                // Execute FetchAll Stored Procedure
                imageListCollection = this.DataManager.ImageManager.FetchAllImages(fetchAllProc, dataConnector);

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

            // return value
            return(returnObject);
        }
예제 #4
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FetchAllImagesStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Image_FetchAll'.
        /// </summary>
        /// <returns>An instance of a(n) 'FetchAllImagesStoredProcedure' object.</returns>
        public static new FetchAllImagesStoredProcedure CreateFetchAllImagesStoredProcedure(Image image)
        {
            // Initial value
            FetchAllImagesStoredProcedure fetchAllImagesStoredProcedure = new FetchAllImagesStoredProcedure();

            // if the image object exists
            if (image != null)
            {
                // if LoadByOwnerId is true
                if (image.LoadByOwnerId)
                {
                    // Change the procedure name
                    fetchAllImagesStoredProcedure.ProcedureName = "Image_FetchAllForOwnerId";

                    // Create the @OwnerId parameter
                    fetchAllImagesStoredProcedure.Parameters = SqlParameterHelper.CreateSqlParameters("@OwnerId", image.OwnerId);
                }
            }

            // return value
            return(fetchAllImagesStoredProcedure);
        }