示例#1
0
 public void AddFormatClick()
 {
     try
     {
         AlbumFormat nFormat = new AlbumFormat(_iGenreLableAdd.FormatAdd);
         nFormat.Create();
         _iGenreLableAdd.ShowSuccessMessage();
     }
     catch
     {
         _iGenreLableAdd.ShowErrorMessage();
     }
 }
示例#2
0
 private void addFormatButton_Click(object sender, EventArgs e)
 {
     try
     {
         string temp = formatTBox.Text;
         AlbumFormat nFormat = new AlbumFormat(temp);
         nFormat.Create();
         MessageBox.Show("Done!^_^", "TheResult");
     }
     catch
     {
         MessageBox.Show("Something bad has happened!", "Whoops!");
     }
 }
示例#3
0
        // add artist and album
        private void addButton_Click(object sender, EventArgs e)
        {
            try
               {
                string artistName = artistTBox.Text;

                if (artistName == "")
                {
                   Exception ex = new Exception("Please, insert artist's name!");
                   throw ex;
                }

                string gName = genreBox.Text;
                Genre gID = Genre.GetGenreID(gName);
                Artist findartist = Artist.CheckArtist(artistName);

                Artist artist = new Artist();

                if (findartist == null)
                {
                    artist = new Artist(artistName, gID);
                    artist.Create();
                    artist = Artist.CheckArtist(artistName);
                }
                else
                {
                    artist = Artist.CheckArtist(artistName);
                }
                string y = yearBox.Text;

                YearTable year = YearTable.GetYearID(y);

                if (year == null)
                {
                    year = new YearTable(y);
                    year.Create();
                    year = YearTable.GetYearID(y);
                }
                else
                {
                    year = YearTable.GetYearID(y);
                }

                string l = lableBox.Text;
                Lable lable = Lable.GetLableID(l);

                if (lable == null)
                {
                    lable = new Lable(l);
                    lable.Create();
                    lable = Lable.GetLableID(l);
                }
                else
                {
                    lable = Lable.GetLableID(l);
                }

                string af = formatBox.Text;
                AlbumFormat format = AlbumFormat.GetFormatID(af);

                if (format == null)
                {
                    format = new AlbumFormat(af);
                    format.Create();
                    format = AlbumFormat.GetFormatID(af);
                }
                else
                {
                    format = AlbumFormat.GetFormatID(af);
                }

                string alname = albumTBox.Text;

                Album album = new Album(alname, artist, year, lable, format);
                album.Create();

                album = Album.GetAlbumID(alname);

                string[] tracklist = tracklistTBox.Lines;

                TrackList tl;

                for (int i = 0; i < tracklist.Length; ++i)
                {
                    string tnum = "00";
                    string tname = "";
                    string tempp = "";
                    bool whitespace = false;
                    for (int j = 0; j < tracklist[i].Length; ++j)
                    {
                        if (tracklist[i][j] == ' ' && !whitespace)
                        {
                            whitespace = true;
                            tnum = tempp;
                            tempp = "";
                        }
                        else
                        {
                            tempp += tracklist[i][j];
                        }
                    }
                    tname = tempp;
                    tl = new TrackList(tname, tnum, album);
                    tl.Create();
                }

                MessageBox.Show("Done!^_^", "TheResult");
              }
              catch
              {
             MessageBox.Show("Something bad has happened!", "Whoops!");
              }
        }
示例#4
0
        public void AddButtClick()
        {
            try
            {
                if (_addMusicControl.ArtistAdd == "")
                {
                    Exception ex = new Exception("Please, insert artist's name!");
                    throw ex;
                }

                Genre gId = Genre.GetGenreID(_addMusicControl.GenreAdd);
                Artist findartist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                Artist artist;

                if (findartist == null)
                {
                    artist = new Artist(_addMusicControl.ArtistAdd, gId);
                    artist.Create();
                    artist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                }
                else
                {
                    artist = Artist.CheckArtist(_addMusicControl.ArtistAdd);
                }

                YearTable year = YearTable.GetYearID(_addMusicControl.YearAdd);

                if (year == null)
                {
                    year = new YearTable(_addMusicControl.YearAdd);
                    year.Create();
                    year = YearTable.GetYearID(_addMusicControl.YearAdd);
                }
                else
                {
                    year = YearTable.GetYearID(_addMusicControl.YearAdd);
                }

                Lable lable = Lable.GetLableId(_addMusicControl.LableAdd);

                if (lable == null)
                {
                    lable = new Lable(_addMusicControl.LableAdd);
                    lable.Create();
                    lable = Lable.GetLableId(_addMusicControl.LableAdd);
                }
                else
                {
                    lable = Lable.GetLableId(_addMusicControl.LableAdd);
                }

                AlbumFormat format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);

                if (format == null)
                {
                    format = new AlbumFormat(_addMusicControl.FormatAdd);
                    format.Create();
                    format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);
                }
                else
                {
                    format = AlbumFormat.GetFormatId(_addMusicControl.FormatAdd);
                }

                Album album = new Album(_addMusicControl.AlbumAdd, artist, year, lable, format);
                album.Create();
                album = Album.GetAlbumId(_addMusicControl.AlbumAdd);
                TrackList tl;

                for (int i = 0; i < _addMusicControl.TrackListAdd.Length; ++i)
                {
                    string tnum = "00";
                    string tname = "";
                    string tempp = "";
                    bool whitespace = false;
                    for (int j = 0; j < _addMusicControl.TrackListAdd[i].Length; ++j)
                    {
                        if (_addMusicControl.TrackListAdd[i][j] == ' ' && !whitespace)
                        {
                            whitespace = true;
                            tnum = tempp;
                            tempp = "";
                        }
                        else
                        {
                            tempp += _addMusicControl.TrackListAdd[i][j];
                        }
                    }
                    tname = tempp;
                    tl = new TrackList(tname, tnum, album);
                    tl.Create();
                }
                _addMusicControl.ShowSuccessMessage();
            }
            catch
            {
                _addMusicControl.ShowErrorMessage();
            }
        }