本文整理汇总了C#中Album类的典型用法代码示例。如果您正苦于以下问题:C# Album类的具体用法?C# Album怎么用?C# Album使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Album类属于命名空间,在下文中一共展示了Album类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AmazonAlbumLookup
public Album AmazonAlbumLookup(string albumId)
{
Album album = new Album();
var helper = new SignedRequestHelper(Options.MainSettings.AmazonSite);
string requestString = helper.Sign(string.Format(itemLookup, albumId));
string responseXml = Util.GetWebPage(requestString);
if (responseXml == null)
return album;
XmlDocument xml = new XmlDocument();
xml.LoadXml(responseXml);
// Retrieve default Namespace of the document and add it to the NameSpacemanager
string defaultNameSpace = xml.DocumentElement.GetNamespaceOfPrefix("");
XmlNamespaceManager nsMgr = new XmlNamespaceManager(xml.NameTable);
nsMgr.AddNamespace("ns", defaultNameSpace);
XmlNodeList nodes = xml.SelectNodes("/ns:ItemLookupResponse/ns:Items/ns:Item", nsMgr);
if (nodes.Count > 0)
{
album = FillAlbum(nodes[0]);
}
return album;
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
user = Membership.GetUser();
if (user != null)
userName = user.UserName;
if (Request.Params.AllKeys.Contains<string>("id"))
{
photoId = int.Parse(Request.Params.Get("id"));
try
{
photo = new Photo(photoId);
album = photo.getAlbum();
photoUrl = "Photos/" + photo.getId() + ".jpg";
comments = photo.getComments();
}
catch (Exception ex)
{
Response.Redirect("Default.aspx");
}
}
else
{
Response.Redirect("Default.aspx");
}
}
示例3: Album
public Album(Album a)
{
this.setid = a.setid;
this.title = a.title;
this.desc = a.desc;
this.photoid = a.photoid;
}
示例4: ExecuteInsertMediaCommand
protected override void ExecuteInsertMediaCommand(string[] commandWords)
{
switch (commandWords[2])
{
case "album":
var performer = this.performers.FirstOrDefault(p => p.Name == commandWords[5]);
if (performer == null)
{
this.Printer.PrintLine("The performer does not exist in the database.");
return;
}
var album = new Album(
commandWords[3],
decimal.Parse(commandWords[4]),
performer, commandWords[6],
int.Parse(commandWords[7]));
this.InsertAlbum(album, performer);
break;
default:
base.ExecuteInsertMediaCommand(commandWords);
break;
}
}
示例5: AlbumWithArchivedVersionsContract
public AlbumWithArchivedVersionsContract(Album album, ContentLanguagePreference languagePreference)
: base(album, languagePreference)
{
ParamIs.NotNull(() => album);
ArchivedVersions = album.ArchivedVersionsManager.Versions.Select(a => new ArchivedAlbumVersionContract(a)).ToArray();
}
示例6: Modify
public void Modify(Album album)
{
if (album == null)
throw new ArgumentNullException("album");
_repository.Update(album);
}
示例7: ReadMyXML
public async void ReadMyXML(string year, string month)
{
Albums = new Albums();
Progress<int> progress = new Progress<int>((p) => { ProgressPercent = p; });
BasicFileDownloader bidl = new BasicFileDownloader(ToAbsoluteUri("xmlalbums.aspx?ay=" + year + "&am=" + month));
IRandomAccessStream s = await bidl.DownloadAsync(progress);
XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment;
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;
settings.Async = true;
XmlReader reader = XmlReader.Create(s.AsStream(), settings);
reader.ReadStartElement("Model");
reader.ReadStartElement("Albums");
Count = 0;
while (reader.IsStartElement())
{
string albumid = reader[0];
string album = reader[2];
string str = reader[1];
str = str.Replace("_s.jpg", "");
uint count = 0;
if (uint.TryParse(reader[3], out count))
{
Album m = new Album(albumid, album, str, count);
Albums.Add(m);
Count += m.Count;
}
await reader.ReadAsync();
}
}
示例8: Validate
public static ValidationResult Validate(Album album)
{
ParamIs.NotNull(() => album);
var errors = new List<string>();
if (album.CoverPictureData == null)
errors.Add(AlbumValidationErrors.NeedCover);
if (album.DiscType == DiscType.Unknown)
errors.Add(AlbumValidationErrors.NeedType);
if (album.Artists.All(a => a.Artist == null))
errors.Add(AlbumValidationErrors.NeedArtist);
if (album.Names.Names.All(n => n.Language == ContentLanguageSelection.Unspecified))
errors.Add(AlbumValidationErrors.UnspecifiedNames);
if (album.OriginalReleaseDate.IsEmpty)
errors.Add(AlbumValidationErrors.NeedReleaseYear);
if (!album.Songs.Any())
errors.Add(AlbumValidationErrors.NeedTracks);
return new ValidationResult(errors);
}
示例9: 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;
}
示例10: AddAlbum
public bool AddAlbum(Album album)
{
using (var connection = new SqlConnection(this.connectionString))
{
var storeProcedure = "Album_AddAlbum";
var command = new SqlCommand(storeProcedure, connection)
{
CommandType = CommandType.StoredProcedure
};
command.Parameters.AddWithValue("@name", album.Name);
var dateParameter = new SqlParameter("@date", SqlDbType.DateTime);
dateParameter.Value = album.Date;
command.Parameters.Add(dateParameter);
command.Parameters.AddWithValue("@userId", album.UserId);
connection.Open();
var reader = command.ExecuteReader();
if (reader.Read())
{
album.Id = (int)(decimal)reader["newId"];
return true;
}
else
{
return false;
}
}
}
示例11: ToEntity
public static Db.Album ToEntity(Album album)
{
if (album != null)
{
var media = new List<DataAccess.Database.Entities.Objects.Media>();
if (album.Media != null)
{
media = album.Media.Select(MediaMapper.ToEntity).ToList();
}
return new Db.Album
{
AlbumId = album.AlbumId,
AlbumName = album.AlbumName,
Media = media,
UserId = album.User.Id,
IsUserDefault = album.IsUserDefault,
CreatedBy = album.CreatedBy,
CreatedDate = album.CreatedDate,
ModifiedBy = album.ModifiedBy,
ModifiedDate = album.ModifiedDate
};
}
return null;
}
示例12: PutAlbum
// PUT api/Albums/5
public HttpResponseMessage PutAlbum(int id, Album album)
{
if (!ModelState.IsValid)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
}
if (id != album.AlbumId)
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
db.Entry(album).State = EntityState.Modified;
try
{
db.SaveChanges();
}
catch (DbUpdateConcurrencyException ex)
{
return Request.CreateErrorResponse(HttpStatusCode.NotFound, ex);
}
return Request.CreateResponse(HttpStatusCode.OK);
}
示例13: Add
/// <summary>
/// Adds a new album to the database.
/// </summary>
/// <param name="creatorName">The username(email) of the requesting user.</param>
/// <returns>The id of the created album.</returns>
public int Add(Album newAlbum, string creatorName)
{
if (creatorName == null)
{
throw new ArgumentNullException("Creator name must be specified.");
}
if (newAlbum == null)
{
throw new ArgumentNullException("Album cannot be null.");
}
var currentUser = this.data.Users
.All()
.FirstOrDefault(u => u.UserName == creatorName);
if (currentUser == null)
{
throw new ArgumentException("No user with this username found.");
}
newAlbum.CreatedOn = DateTime.Now;
newAlbum.Owner = currentUser;
this.data.Albums.Add(newAlbum);
this.data.SaveChanges();
return newAlbum.Id;
}
示例14: btnSubmit_Click
public void btnSubmit_Click(object sender, EventArgs e)
{
if (EmptyNullUndefined(txtAlbumName.Text) || ddlYearReleased.SelectedValue == "-1")
return;
var album = new Album
{
AlbumId = Guid.NewGuid(),
AlbumName = txtAlbumName.Text,
CreatedDate = DateTime.UtcNow,
YearReleased = int.Parse(ddlYearReleased.SelectedValue)
};
var albumService = new AlbumService(Ioc.GetInstance<IAlbumRepository>());
bool success;
albumService.SaveCommit(album, out success);
if (success)
{
var scriptHelper = new ScriptHelper("SuccessAlert", "alertDiv", "You have successfully created an album.");
Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetSuccessScript());
}
else
{
var scriptHelper = new ScriptHelper("ErrorAlert", "alertDiv", "There was an error, try again later.");
Page.RegisterStartupScript(scriptHelper.ScriptName, scriptHelper.GetFatalScript());
}
}
示例15: AlbumEditorUI
private AlbumEditorUI(Album album, bool isnew)
{
Glade.XML gxml = new Glade.XML (null, "organizer.glade", "window3", null);
gxml.Autoconnect (this);
this._isnew = isnew;
this._album = album;
window3.Title = String.Format("Editing information for {0}", album.Title);
window3.SetIconFromFile(DeskFlickrUI.ICON_PATH);
label8.Text = "Edit";
label9.Text = "Title: ";
label10.Text = "Description: ";
entry3.Text = album.Title;
textview6.Buffer.Text = album.Desc;
entry3.Changed += new EventHandler(OnTitleChanged);
textview6.Buffer.Changed += new EventHandler(OnDescriptionChanged);
button7.Clicked += new EventHandler(OnCancelButtonClicked);
button8.Clicked += new EventHandler(OnSaveButtonClicked);
image4.Pixbuf = PersistentInformation.GetInstance()
.GetSmallImage(album.PrimaryPhotoid);
window3.ShowAll();
}