Example #1
0
        public void updateInterpret(InterpretDTO obj, int id)
        {
            MySqlConnection mysqlcon = DatabaseConnection.getInstance().getConnection();
            MySqlCommand    command  = mysqlcon.CreateCommand();

            command.CommandText = "UPDATE tbl_interpret SET name = @colName, foundationyear = @colFoundationyear, land = @colLand WHERE id_interpret = " + id + ";";
            command.Parameters.AddWithValue("colName", obj.getName());
            command.Parameters.AddWithValue("colFoundationyear", obj.getFoundationYear());
            command.Parameters.AddWithValue("colLand", obj.getLand());

            mysqlcon.Open();
            command.ExecuteNonQuery();
            mysqlcon.Close();
        }
Example #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());
                }
            }
        }
Example #3
0
        public void updateInterpret(InterpretDTO obj)
        {
            InterpretDAO iDAO = new InterpretDAO();

            iDAO.updateInterpret(obj, iDAO.getIdFromDb(obj.getName()));
        }
Example #4
0
        public void insertInterpret(InterpretDTO obj)
        {
            MySqlConnection mysqlcon = DatabaseConnection.getInstance().getConnection();
            MySqlCommand    command  = mysqlcon.CreateCommand();

            command.CommandText = "INSERT INTO tbl_interpret(name, foundationyear, land) VALUES ('" + obj.getName() + "', '" + obj.getFoundationYear() + "', '" + obj.getLand() + "');";
            mysqlcon.Open();
            command.ExecuteNonQuery();
            mysqlcon.Close();
        }