Beispiel #1
0
        /// <summary>
        /// Check if that found image.
        /// If found image and this image yet is not cache, it will cache this image.
        /// </summary>
        /// <param name="imageCode">Image Code.</param>
        /// <returns>Boolean</returns>
        public bool IsFoundImage(string imageCode)
        {
            if (!ImageItemList.ContainKeys(imageCode))
            {
                // Load from database and store into cache.
                ImageDTO imageDTO = m_daoImage.LoadByPK(CommonLib.Common.CurrentDatabase, new NZString(null, imageCode));

                if (imageDTO == null)
                {
                    return(false);
                }

                // Convert byte array to Image.
                byte[]       byteArray    = imageDTO.IMAGE_BIN.StrongValue;
                MemoryStream memoryStream = new MemoryStream(byteArray);
                Image        img          = Image.FromStream(memoryStream);
                memoryStream.Close();

                // Add to image cache.
                ImageItem item = new ImageItem(imageCode, img);
                m_imageItemList.Add(item);
            }

            return(true);
        }