Exemple #1
0
        /// <summary>
        /// This method finds a  'Image' object.
        /// This method uses the 'Image_Find' procedure.
        /// </summary>
        /// <returns>A 'Image' object.</returns>
        /// </summary>
        public Image FindImage(FindImageStoredProcedure findImageProc, DataConnector databaseConnector)
        {
            // Initial Value
            Image image = null;

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

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

                    // if row exists
                    if (row != null)
                    {
                        // Load Image
                        image = ImageReader.Load(row);
                    }
                }
            }

            // return value
            return(image);
        }
        /// <summary>
        /// This method finds a 'Image' object.
        /// </summary>
        /// <param name='List<PolymorphicObject>'>The 'Image' to delete.
        /// <returns>A PolymorphicObject object with a Boolean value.
        internal PolymorphicObject FindImage(List <PolymorphicObject> parameters, DataConnector dataConnector)
        {
            // Initial Value
            PolymorphicObject returnObject = new PolymorphicObject();

            // locals
            Image image = null;

            // If the data connection is connected
            if ((dataConnector != null) && (dataConnector.Connected == true))
            {
                // Create Find StoredProcedure
                FindImageStoredProcedure findImageProc = null;

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

                    // verify paramImage exists
                    if (paramImage != null)
                    {
                        // Now create findImageProc from ImageWriter
                        // The DataWriter converts the 'Image'
                        // to the SqlParameter[] array needed to find a 'Image'.
                        findImageProc = ImageWriter.CreateFindImageStoredProcedure(paramImage);
                    }

                    // Verify findImageProc exists
                    if (findImageProc != null)
                    {
                        // Execute Find Stored Procedure
                        image = this.DataManager.ImageManager.FindImage(findImageProc, dataConnector);

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

            // return value
            return(returnObject);
        }
Exemple #3
0
        /// <summary>
        /// This method creates an instance of a
        /// 'FindImageStoredProcedure' object and
        /// creates the sql parameter[] array needed
        /// to execute the procedure 'Image_Find'.
        /// </summary>
        /// <param name="image">The 'Image' to use to
        /// get the primary key parameter.</param>
        /// <returns>An instance of an FetchUserStoredProcedure</returns>
        public static FindImageStoredProcedure CreateFindImageStoredProcedure(Image image)
        {
            // Initial Value
            FindImageStoredProcedure findImageStoredProcedure = null;

            // verify image exists
            if (image != null)
            {
                // Instanciate findImageStoredProcedure
                findImageStoredProcedure = new FindImageStoredProcedure();

                // Now create parameters for this procedure
                findImageStoredProcedure.Parameters = CreatePrimaryKeyParameter(image);
            }

            // return value
            return(findImageStoredProcedure);
        }