Exemplo n.º 1
0
        private void loadLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var photoId   = int.Parse(loadPhotoIdTextBox.Text);
            var photoData = PhotoData.SelectPhoto(photoId);

            descriptionLabel.Text = photoData.Description;
            photoPictureBox.Image = Image.FromStream(new MemoryStream(photoData.Photo));
        }
Exemplo n.º 2
0
        private void saveLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var photoId  = int.Parse(savePhotoIdTextBox.Text);
            var desc     = descriptionTextBox.Text;
            var filename = filenameTextBox.Text;

            if (!File.Exists(filename))
            {
                MessageBox.Show("File not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            PhotoData.InsertPhoto(photoId, desc, filename);
            MessageBox.Show("Photo has been added to the database", "Photo added", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }