Пример #1
0
        /// <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);
        }