本文整理汇总了C#中Artist类的典型用法代码示例。如果您正苦于以下问题:C# Artist类的具体用法?C# Artist怎么用?C# Artist使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Artist类属于命名空间,在下文中一共展示了Artist类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhereHasArtistParticipationStatus
public static IQueryable<ArtistForAlbum> WhereHasArtistParticipationStatus(this IQueryable<ArtistForAlbum> query, Artist artist, ArtistAlbumParticipationStatus participation) {
if (participation == ArtistAlbumParticipationStatus.Everything || artist == null)
return query;
var musicProducerTypes = new[] {ArtistType.Producer, ArtistType.Circle, ArtistType.OtherGroup};
if (musicProducerTypes.Contains(artist.ArtistType)) {
var producerRoles = ArtistRoles.Composer | ArtistRoles.Arranger;
switch (participation) {
case ArtistAlbumParticipationStatus.OnlyMainAlbums:
return query.Where(a => !a.IsSupport && ((a.Roles == ArtistRoles.Default) || ((a.Roles & producerRoles) != ArtistRoles.Default)) && a.Album.ArtistString.Default != ArtistHelper.VariousArtists);
case ArtistAlbumParticipationStatus.OnlyCollaborations:
return query.Where(a => a.IsSupport || ((a.Roles != ArtistRoles.Default) && ((a.Roles & producerRoles) == ArtistRoles.Default)) || a.Album.ArtistString.Default == ArtistHelper.VariousArtists);
default:
return query;
}
} else {
switch (participation) {
case ArtistAlbumParticipationStatus.OnlyMainAlbums:
return query.Where(a => !a.IsSupport);
case ArtistAlbumParticipationStatus.OnlyCollaborations:
return query.Where(a => a.IsSupport);
default:
return query;
}
}
}
示例2: ArtistWithArchivedVersionsContract
public ArtistWithArchivedVersionsContract(Artist artist, ContentLanguagePreference languagePreference)
: base(artist, languagePreference)
{
ParamIs.NotNull(() => artist);
ArchivedVersions = artist.ArchivedVersionsManager.Versions.Select(a => new ArchivedArtistVersionContract(a)).ToArray();
}
示例3: HomeModule
public HomeModule()
{
Get["/"] = _ => {
var allCDs = CD.GetAllCDs();
return View["index.cshtml", allCDs];
};
// view the mainpage, taking all the CDs as model
Get["/cd/new"] = _ => {
return View["addCD.cshtml"];
};
//if you get CD/new, take to add CD form//
Post["/cdAdded"] = _ => {
var newCD = new CD(Request.Form["cd-title"], Request.Form["cd-artist"], Request.Form["cd-year"], Request.Form["cd-cover"]);
var newArtist = new Artist(Request.Form["cd-artist"]);
newArtist.AddArtistCD(newCD);
return View["cdAdded.cshtml", newCD];
};
Get["/searchbyartist"] = _ => {
return View["searchByArtist.cshtml"];
};
Post["/searchresults"] = _ => {
var selectedArtist = Artist.Find(Request.Form["artist-name"]);
List<CD> resultCDs = selectedArtist.GetAllArtistsCDs();
return View["searchResults.cshtml", resultCDs];
};
}
示例4: ArtistViewModel
public ArtistViewModel(Artist a)
: base(a)
{
artist = a;
TypeImage = "\xe13d";
InitLogo(string.Format("artist_{0}.jpg", Id));
}
示例5: AddOwnedArtist_AlreadyAdded
public void AddOwnedArtist_AlreadyAdded()
{
var artist = new Artist { Id = 1 };
user.AddOwnedArtist(artist);
user.AddOwnedArtist(artist);
}
示例6: AddArtist
public int AddArtist(ArtistLite al)
{
int result = 1;
Artist a = new Artist();
a.ArtistName = al.ArtistName;
a.ArtistEmail = al.Email;
a.ArtistWebPage = al.WebPage;
a.ArtistDateEntered = DateTime.Now;
try
{
st.Artists.Add(a);
st.SaveChanges();
}
catch (Exception ex)
{
result = 0;
throw ex;
}
return result;
}
示例7: addArtistButton_Click
private void addArtistButton_Click(object sender, System.EventArgs e)
{
var repository = new CDCatalogRepository();
var formHelper = new FormHelper();
if (!formHelper.TextBoxHasContents(addArtistTxtBoxArtistName))
{
MessageBox.Show("Please enter an artist name.", "Input validation error");
addArtistTxtBoxArtistName.Focus();
}
else
{
var newArtist = addArtistTxtBoxArtistName.Text.Trim();
var artists = repository.SearchArtistByArtistNameExclusive(newArtist);
if (artists.Count > 0)
{
MessageBox.Show("You wanted to add " + newArtist + ", but " + artists[0].ArtistName + " already exsists.", "Artist must be unique");
addArtistTxtBoxArtistName.Focus();
}
else
{
CreatedArtist = repository.CreateArtist(addArtistTxtBoxArtistName.Text.Trim());
this.Close();
}
}
}
示例8: EntryRefWithCommonPropertiesContract
public EntryRefWithCommonPropertiesContract(Artist entry, ContentLanguagePreference languagePreference)
: base(entry, languagePreference) {
ArtistString = null;
EntryTypeName = ArtistTypeNames.ResourceManager.GetString(entry.ArtistType.ToString());
}
示例9: ArtistForUser
public ArtistForUser(User user, Artist artist)
: this() {
User = user;
Artist = artist;
}
示例10: PlayListElems
public PlayListElems(Artist aid, Album alid, TrackList trid)
{
ArtistName = (string)aid.ArtistName;
AlbumName = (string)alid.AlbumName;
TrackNum = (string)trid.TrackNum;
TrackName = (string)trid.TrackName;
}
示例11: SetUp
public void SetUp() {
artist = CreateEntry.Producer(name: "Tripshots");
repository = new FakeArtistRepository(artist);
foreach (var name in artist.Names)
repository.Save(name);
user = CreateEntry.User(name: "Miku");
repository.Save(user);
permissionContext = new FakePermissionContext(user);
imagePersister = new InMemoryImagePersister();
queries = new ArtistQueries(repository, permissionContext, new FakeEntryLinkFactory(), imagePersister, MemoryCache.Default);
newArtistContract = new CreateArtistContract {
ArtistType = ArtistType.Producer,
Description = string.Empty,
Names = new[] {
new LocalizedStringContract("Tripshots", ContentLanguageSelection.English)
},
WebLink = new WebLinkContract("http://tripshots.net/", "Website", WebLinkCategory.Official)
};
}
示例12: Save
public Artist Save(Artist artist)
{
Artist artistDB = null;
if (artist == null)
{
throw new ArgumentException("Cannot save null artist");
}
try
{
StartTx();
if (artist.Id == null)
{
artistDB = artistDao.Persist(artist);
}
else
{
artistDB = artistDao.ById(artist.Id);
if (artistDB.Deleted)
{
throw new EntityNotFoundException();
}
artistDB = artistDao.Update(artist);
}
CommitTx();
}
catch (Exception e)
{
RollbackTx();
throw e;
}
return artistDB;
}
示例13: ArtistReport
public ArtistReport(Artist artist, ArtistReportType reportType, User user, string hostname, string notes)
: base(user, hostname, notes) {
Artist = artist;
ReportType = reportType;
}
示例14: PutArtist
public IHttpActionResult PutArtist(int id, Artist artist)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
if (id != artist.ArtistId)
{
return BadRequest();
}
//db.Entry(artist).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException)
{
if (!ArtistExists(id))
{
return NotFound();
}
else
{
throw;
}
}
return StatusCode(HttpStatusCode.NoContent);
}
示例15: CreateArtist
private IArtistWithSupport CreateArtist(ArtistType artistType, string name) {
var p = new Artist { ArtistType = artistType };
p.Names.Add(new ArtistName(p, new LocalizedString(name, ContentLanguageSelection.English)));
return p.AddAlbum(new Album());
}