示例#1
0
        public void insertAlbum(AlbumDTO obj)
        {
            MySqlConnection mysqlcon = DatabaseConnection.getInstance().getConnection();
            MySqlCommand    command  = mysqlcon.CreateCommand();

            command.CommandText = "INSERT INTO tbl_album(name, releaseyear, fk_genre, fk_interpret, coverpath) VALUES (@colName, @colReleaseyear, @colFK_genre, @colFK_interpret, @colCoverpath);";
            command.Parameters.AddWithValue("colName", obj.getName());
            command.Parameters.AddWithValue("colReleaseyear", obj.getReleaseYear());
            command.Parameters.AddWithValue("colFK_genre", obj.getGenre());
            command.Parameters.AddWithValue("colFK_interpret", obj.getInterpret());
            command.Parameters.AddWithValue("colCoverpath", obj.getCoverpath());
            mysqlcon.Open();
            command.ExecuteNonQuery();
            mysqlcon.Close();
        }
示例#2
0
        private void treeMain_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            FunctionController fc         = new FunctionController();
            string             typeOfNode = getTypeOfNode(e.Node);

            setDetailEditingPanelsInvisible();
            if (typeOfNode == "interpret")
            {
                String       interpretName = e.Node.Text;
                InterpretDTO iDTO          = fc.getInterpretByName(interpretName);
                löschenToolStripMenuItem.Enabled             = true;
                alsFavoritMarkierenToolStripMenuItem.Enabled = true;

                pnDetailEditingInterpret.Visible            = true;
                edDetailEditingInterpretName.Text           = iDTO.getName();
                edDetailEditingInterpretFoundationYear.Text = iDTO.getFoundationYear();
                edDetailEditingInterpretLand.Text           = iDTO.getLand();
                edDetailEditingInterpretNoOfAlbums.Text     = fc.getAlbumsByInterpret(iDTO.getName()).Count.ToString();
            }
            else if (typeOfNode == "album")
            {
                String         albumName = e.Node.Text;
                AlbumDTO       aDTO      = fc.getAlbumByName(albumName);
                List <SongDTO> songs     = new List <SongDTO>();
                listSongs.Items.Clear();

                pnDetailEditingAlbum.Visible       = true;
                edDetailEditingAlbumName.Text      = aDTO.getName();
                edDetailEditingAlbumInterpret.Text = fc.getInterpretNameById(aDTO.getInterpret());
                edDetailEditingAlbumYear.Text      = aDTO.getReleaseYear();
                edDetailEditingAlbumGenre.Text     = fc.getGenreById(aDTO.getGenre());
                if (aDTO.getCoverpath() != null && aDTO.getCoverpath() != "")
                {
                    pictureBox1.Image    = Image.FromFile(aDTO.getCoverpath());
                    pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                }
                else
                {
                    pictureBox1.Image = null;
                }

                songs = fc.getAllSongsByAlbum(albumName);
                foreach (SongDTO song in songs)
                {
                    listSongs.Items.Add(song.getTrackNo() + " - " + song.getName() + " | " + song.getDuration());
                }
            }
        }
示例#3
0
        public void updateAlbum(AlbumDTO obj, int id)
        {
            MySqlConnection mysqlcon = DatabaseConnection.getInstance().getConnection();
            MySqlCommand    command  = mysqlcon.CreateCommand();

            command.CommandText = "UPDATE tbl_album SET name = @colName, releaseyear = @colReleaseyear, fk_genre = @colGenre, fk_interpret = @colInterpret, coverpath = @colCoverpath WHERE id_album = " + id + ";";
            command.Parameters.AddWithValue("colName", obj.getName());
            command.Parameters.AddWithValue("colReleaseyear", obj.getReleaseYear());
            command.Parameters.AddWithValue("colGenre", obj.getGenre());
            command.Parameters.AddWithValue("colInterpret", obj.getInterpret());
            command.Parameters.AddWithValue("colCoverpath", obj.getCoverpath());

            mysqlcon.Open();
            command.ExecuteNonQuery();
            mysqlcon.Close();
        }