// GET: Songs public ActionResult SongsView() { SongsGrid songs = new SongsGrid(); if (SessionBag.Current.SongsXml != null && SessionBag.Current.SongsXml is XmlDocument && SessionBag.Current.SongsXmlReference != null && SessionBag.Current.SongsXmlReference is XmlDocument) { XmlDocument doc = SessionBag.Current.SongsXml as XmlDocument; XmlDocument docref = SessionBag.Current.SongsXmlReference as XmlDocument; XmlNodeList nodes = doc.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { songs.songs.Add(new MVCSongs(node)); } nodes = docref.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { songs.songsref.Add(new MVCSongs(node)); } //songs.songs.Sort(); songs.Bind(); ViewData.Model = songs; } return(View()); }
public ActionResult PageNavigate() { SongsGrid songs = new SongsGrid(); ViewData.Model = songs; int offset = 0; if (int.TryParse(Request.Form["txtoffset"], out offset) == true) { songs.offset = offset; } string sortby = Utility.NotNullString(Request.Form["sortby"]); bool bydisk = Utility.NotNullBool(Request.Form["bydisk"]); if (sortby == "Title" || sortby == "Artist") { if (sortby != SessionBag.Current.SongsPageOrderRef || bydisk != SessionBag.Current.SongsPageByDiskRef) { songs.offset = SessionBag.Current.SongsPageOffset = SessionBag.Current.SongsPageOffsetRef = 0; } SessionBag.Current.SongsPageOrder = sortby; SessionBag.Current.SongsPageByDisk = bydisk; } string txtsrch = Utility.NotNullString(Request.Form["searchstring"]); if (txtsrch.Trim().Length > 0) { if (txtsrch != Utility.NotNullString(SessionBag.Current.SongsPageSearchStringRef)) { songs.offset = SessionBag.Current.SongsPageOffset = SessionBag.Current.SongsPageOffsetRef = 0; } SessionBag.Current.SongsPageSearchString = txtsrch; } else { if (txtsrch != Utility.NotNullString(SessionBag.Current.SongsPageSearchStringRef)) { songs.offset = SessionBag.Current.SongsPageOffset = SessionBag.Current.SongsPageOffsetRef = 0; } SessionBag.Current.SongsPageSearchString = ""; } return(View()); }
public ActionResult SongsView(int offset = 0) { if (offset > 0) { IncrementOffset(); } else if (offset < 0) { DecrementOffset(); } if (SetSongsPageDirty() == true) { GetSongs(); } SongsGrid songs = new SongsGrid(); songs.sortby = SessionBag.Current.SongsPageOrder; songs.bydisk = SessionBag.Current.SongsPageByDisk; songs.searchstring = SessionBag.Current.SongsPageSearchString; if (SessionBag.Current.SongsXml != null && SessionBag.Current.SongsXml is XmlDocument && SessionBag.Current.SongsXmlReference != null && SessionBag.Current.SongsXmlReference is XmlDocument) { XmlDocument doc = SessionBag.Current.SongsXml as XmlDocument; XmlDocument docref = SessionBag.Current.SongsXmlReference as XmlDocument; XmlNodeList nodes = doc.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { songs.songs.Add(new MVCSongs(node)); } nodes = docref.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { songs.songsref.Add(new MVCSongs(node)); } //songs.songs.Sort(); songs.offset += 50; songs.Bind(); ViewData.Model = songs; } return(View()); }