Exemplo n.º 1
0
        /// <summary>
        /// Creator: Michael Thompson
        /// Created: 2/19/2020
        /// Approver: Austin Gee
        /// Method to take a user to the canvas to update the profile
        /// </summary>
        /// <remarks>
        /// Updater:
        /// Updated:
        /// Update:
        /// </remarks>

        private void DgAnimals_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            //canUpdateAnimal.Visibility = Visibility.Visible;
            BtnSubmitAnimalUpdate.Visibility    = Visibility.Visible;
            canViewAnimalProfileList.Visibility = Visibility.Hidden;
            canAnimalProfile.Visibility         = Visibility.Visible;

            _selectedAnimal = _animalManager.RetrieveAnimalByAnimalID(((Animal)dgAnimalProfiles.SelectedItem).AnimalID)[0];


            //var selectedItem = dgAnimalProfiles.SelectedItem;
            //string ID = (dgAnimalProfiles.SelectedCells[0].Column.GetCellContent(selectedItem) as TextBlock).Text;
            try
            {
                lblAnimalName.Content    = _selectedAnimal.AnimalName;
                lblAnimalBreed.Content   = _selectedAnimal.AnimalBreed;
                lblAnimalSpecies.Content = _selectedAnimal.AnimalSpeciesID;

                //int animalID = Int32.Parse(ID);
                //Animal selectedAnimal = getInitialData(animalID);
                Animal selectedAnimal = _animalManager.RetrieveOneAnimalByAnimalID(((Animal)(dgAnimalProfiles.SelectedItem)).AnimalID);
                txtAnimalProfileDescription.Text = selectedAnimal.ProfileDescription;

                if (selectedAnimal.ProfileImageData != null)
                {
                    currentPetProfile.Source = null;
                    currentPetProfile.Source = byteArrayToImage(selectedAnimal.ProfileImageData);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        public FileContentResult GetImage(int animalId)
        {
            Animal animal = _animalManager.RetrieveOneAnimalByAnimalID(animalId);

            if (animal.ProfileImageData != null && animal.ProfileImageMimeType != null)
            {
                return(File(animal.ProfileImageData, animal.ProfileImageMimeType));
            }
            else
            {
                return(null);
            }
        }