private void loadAbums()
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            var selectedItem          = from el in db.ImagesInAlbums
                                        join b in db.Albums
                                        on el.albumID equals b.id
                                        where el.fileID == this.imgID
                                        select b;

            this.album_list.ItemsSource = selectedItem.ToList();
        }
Esempio n. 2
0
        private void addTag_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            Tag tagObject             = new Tag()
            {
                tagName = tag_name.Text,
            };

            db.Tags.Add(tagObject);
            db.SaveChanges();
            this.loadTags();
        }
Esempio n. 3
0
        private void addAalbum_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            Album albumObject         = new Album()
            {
                albumName = album_name.Text,
            };

            db.Albums.Add(albumObject);
            db.SaveChanges();
            this.loadAbums();
        }
        public Details(int imageID)
        {
            InitializeComponent();

            //Initial setting for the Combobox (Dropdown) with the albums (NO NEED TO CHANGE)
            DataContext = this;
            cbItems     = new ObservableCollection <ComboBoxItem>();
            var cbItem = new ComboBoxItem {
                Content = "<--Select-->"
            };

            SelectedcbItem = cbItem;
            cbItems.Add(cbItem);

            //Store the IF of the image
            this.imgID = imageID;
            this.loadAbums();

            //Query the DB based on the ID received
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            var images = from d in db.Files
                         where d.id.Equals(imgID)
                         select d;

            foreach (var el in images)
            {
                //Name of the file
                FileName.Text = $"{el.fileName}";
                // Size in KB
                FileSize.Text = $"{el.fileSize} KB";

                //Display the image on the screen
                imagePathToDisplay = el.filePath;

                var uriSource = new Uri(el.filePath, UriKind.RelativeOrAbsolute);
                singleImage.Source = new BitmapImage(uriSource);

                //Query the Albums table to get a list of albuns availables
                var albums = from d in db.Albums
                             select d;

                foreach (var alb in albums)
                {
                    //For every "album", display on our combobox
                    cbItems.Add(new ComboBoxItem {
                        Content = alb.albumName, Tag = alb.id
                    });
                }
            }
        }
Esempio n. 5
0
        private void deleteAlbum_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            var selectedItem          = from el in db.Albums
                                        where el.id == this.albumSelected
                                        select el;

            Album albumToDelete = selectedItem.SingleOrDefault();

            if (albumToDelete != null)
            {
                db.Albums.Remove(albumToDelete);
                db.SaveChanges();
            }
            this.loadAbums();
        }
Esempio n. 6
0
        private void deleteTag_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            var selectedItem          = from el in db.Tags
                                        where el.id == this.tagSelected
                                        select el;

            Tag tagToDelete = selectedItem.SingleOrDefault();

            if (tagToDelete != null)
            {
                db.Tags.Remove(tagToDelete);
                db.SaveChanges();
            }
            this.loadTags();
        }
        private void album_list_Main_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem typeItem    = (ComboBoxItem)listAlbums.SelectedItem;
            string       contentName = typeItem.Content.ToString();

            Console.WriteLine("album name: " + contentName);
            ApplicationDBEntities1 db = new ApplicationDBEntities1();
            var selectedItem          = from el in db.Albums
                                        where el.albumName == contentName
                                        select el;

            if (selectedItem.FirstOrDefault <Album>() != null)
            {
                albumSelectedToAddRemove = selectedItem.FirstOrDefault <Album>().id;
            }
        }
        private void addAlbum_Click(object sender, RoutedEventArgs e)
        {
            //TO DO: Grab selected album and add image to DB ImagesAlbums
            // Re-load the list

            ApplicationDBEntities1 db          = new ApplicationDBEntities1();
            ImagesInAlbum          albumObject = new ImagesInAlbum()
            {
                fileID  = this.imgID,
                albumID = albumSelectedToAddRemove
            };

            db.ImagesInAlbums.Add(albumObject);
            db.SaveChanges();
            this.loadAbums();
        }
Esempio n. 9
0
        private void loadTags()
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();

            this.tag_list.ItemsSource = db.Tags.ToList();
        }
Esempio n. 10
0
        private void loadAbums()
        {
            ApplicationDBEntities1 db = new ApplicationDBEntities1();

            this.album_list.ItemsSource = db.Albums.ToList();
        }