public ActionResult SongTag(string title, string artist, string disk) { SingersGrid singers = new SingersGrid(); singers.song = new TSCSongs(); if (SessionBag.Current.SongsXml != null) { XmlDocument doc = SessionBag.Current.SongsXml as XmlDocument; XmlNode node = doc.SelectSingleNode(string.Format("/Root/Data[Title=\"{0}\" and Artist=\"{1}\" and Disk=\"{2}\"]", title, artist, disk)); if (node != null) { singers.song = new TSCSongs(node); } } Models.MvcList list = Controllers.QueueRoundData.GetRound(SessionBag.Current.RoundXml as XmlDocument, 1); foreach (object itm in list) { MVCQueue queue = itm as MVCQueue; if (queue != null) { if (queue.SingerKey != null && queue.SingerKey.Trim().Length > 0) { MVCSingers singer = new MVCSingers(); singer.SingerKey = queue.SingerKey; singers.singers.Add(singer); singers.singersref.Add(singer); } } } singers.Bind(); ViewData.Model = singers; return(View()); }
public static List <MVCQueue> GetRounds(string xml, int round) { List <MVCQueue> qlist = new List <MVCQueue>(); Models.MvcList list = GetRound(xml, round); foreach (MVCQueue item in list) { qlist.Add(item); } return(qlist); }
public static List <MVCQueue> GetRounds(XmlDocument doc, int round) { List <MVCQueue> qlist = new List <MVCQueue>(); Models.MvcList list = GetRound(doc, round); foreach (MVCQueue item in list) { qlist.Add(item); } return(qlist); }
public static QueueStation.Models.MvcList GetRound(XmlDocument doc, int QueueRound) { QueueStation.Models.MvcList roundx = new Models.MvcList(); XmlNodeList nodes = doc.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { if (Utility.GetXmlInteger(node, "QueueRound") == QueueRound) { roundx.Add(new MVCQueue(node)); } } return(roundx); }
// GET: EditQueue public ActionResult PageEditQueue(string SingerKey, int QueueRound) { if (SingerKey != null && SingerKey.Trim().Length > 0) { Models.MvcList list = Controllers.QueueRoundData.GetRound(SessionBag.Current.RoundXml as XmlDocument, QueueRound); foreach (object itm in list) { MVCQueue queue = itm as MVCQueue; if (queue != null) { if (queue.SingerKey == SingerKey) { ViewData.Model = queue; return(View(queue)); } } } } else { MVCQueue model = new MVCQueue(); XmlDocument doc = SessionBag.Current.SingersXml; if (doc != null) { XmlNodeList nodes = doc.SelectNodes("/Root/Data/SingerKey"); foreach (XmlNode node in nodes) { string singer = node.InnerText; if (singer != null && singer.Trim().Length > 0) { model.SingerList.Add(singer); } } } model.QueueRound = QueueRound; return(View(model)); } return(View()); }
public ActionResult PageSetRound(MVCQueue model) { string state = Request.Form["theQueueState"]; string singerlist = Request.Form["SingerList"]; int maxorder = 0; if (model.QueueRound > 0) { Models.MvcList sessionround = QueueRoundData.GetRound(SessionBag.Current.RoundXml, model.QueueRound); bool found = false; foreach (MVCQueue q in sessionround) { if (q.QueueOrder > maxorder) { maxorder = q.QueueOrder; } if (q.SingerKey == model.SingerKey) { found = true; if (MVCQueue.RoundsEqual(q, model) == false) { SetField("QueueSong", model.QueueSong, model.SingerKey, model.QueueRound); SetField("QueueArtist", model.QueueArtist, model.SingerKey, model.QueueRound); SetField("QueueNote", model.QueueNote, model.SingerKey, model.QueueRound); SetField("QueueLink", model.QueueLink, model.SingerKey, model.QueueRound); if (state != null && state.Trim().Length > 0) { SetField("QueueState", state, model.SingerKey, model.QueueRound); } } } } if (found == false && singerlist != null && singerlist.Trim().Length > 0) { XmlDocument doc = SessionBag.Current.SingersXml as XmlDocument; if (doc != null) { XmlNode node = doc.SelectSingleNode(string.Format("/Root/Data[SingerKey='{0}']/SingerKey", singerlist.Trim())); if (node != null) { doc = SessionBag.Current.RoundXml as XmlDocument; if (doc != null && (SessionBag.Current.EventKey as string) != null && (SessionBag.Current.EventKey as string).Trim().Length > 0) { model.EventKey = (SessionBag.Current.EventKey as string); model.SingerKey = singerlist.Trim(); model.QueueOrder = maxorder + 1; if (state != null && state.Trim().Length > 0) { model.QueueState = state; } else { model.QueueState = "Pending"; } model.AppendToDocument(doc); } } } } } return(View(model)); }