本文整理汇总了C#中Album.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Album.Create方法的具体用法?C# Album.Create怎么用?C# Album.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Album
的用法示例。
在下文中一共展示了Album.Create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: addButton_Click
// 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];
//.........这里部分代码省略.........
示例2: AddButtClick
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();
}
}