public ActionResult SongTagEdit(string singerkey, string title, string artist, string disk) { SingingClubClient client = new SingingClubClient(); TSCSongs songs = null; if (SessionBag.Current.SongsXml != null && client != null && title != null && artist != null && disk != null && singerkey != null && title.Trim().Length > 0 && artist.Trim().Length > 0 && disk.Trim().Length > 0 && singerkey.Trim().Length > 0) { 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) { songs = new TSCSongs(node); TSCSingersSongs singerssongs = new TSCSingersSongs(singerkey, songs.Title, songs.Artist); string xml = client.GeneralStore("TSCSingersSongs", "GET", singerssongs.GetDataXml()); if (xml != null && xml.Trim().Length == 0) { singerssongs.OneDriveZip = songs.OneDriveZip; xml = client.GeneralStore("TSCSingersSongs", "INSERT", singerssongs.GetDataXml()); } } } return(View()); }
public ActionResult PageAddSaveRevert(SingerRound singerround) { int round = Utility.GetInt(Request.Form.Get("QueueRound")); string command = Request.Form.Get("command"); singerround.round = round; singerround.command = command; if (round > 0) { switch (command.ToLower()) { case "revert": XmlDocument doc = SessionBag.Current.RoundXml as XmlDocument; XmlDocument docref = SessionBag.Current.RoundXmlReference as XmlDocument; if (doc != null && docref != null) { doc.LoadXml(docref.OuterXml); } break; case "save": QueueGrid model = new QueueGrid(round); model.QueueRound = round; model.queues = QueueRoundData.GetRounds(SessionBag.Current.RoundXml as XmlDocument, round); model.queuesref = QueueRoundData.GetRounds(SessionBag.Current.RoundXmlReference as XmlDocument, round); string result = model.Save(); string _RoundXml = ""; if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { SingingClubClient client = new SingingClubClient(); client.Open(); string eventKey = SessionBag.Current.EventKey; if (eventKey.Trim().Length > 0) { MVCQueue q = new MVCQueue(); q.EventKey = eventKey; q.QueueRound = -1; _RoundXml = client.GeneralStore("TSCQueue", "GET", q.GetDataXml()); } client.Close(); XmlDocument RoundXml = new XmlDocument(); XmlDocument RoundXmlReference = new XmlDocument(); RoundXml.LoadXml(_RoundXml); RoundXmlReference.LoadXml(_RoundXml); SessionBag.Current.RoundXml = RoundXml; SessionBag.Current.RoundXmlReference = RoundXmlReference; } break; case "add": break; default: break; } } return(View(singerround)); }
static void Main(string[] args) { /* * TSCSingers singers = new TSCSingers(); * SingingClubClient scc = new SingingClubDataReference.SingingClubClient();// new SingingClubClient(); * string s = scc.GeneralStore("TSCSingers", "GET", singers.GetDataXml()); * TSCSongs songs = new TSCSongs(); * songs.PageOrder = "[Title], [Artist], [Disk]"; * songs.PageOffset = 0; * songs.PageReturn = 50; * s = scc.GeneralStore("TSCSongList_Main", "GET", songs.GetDataXml()); * s = ""; */ SingingClubClient client = new SingingClubClient(); TSCSongs songs = new TSCSongs(); songs.Title = "Beautiful Noise"; songs.Artist = "Neil Diamond"; songs.Disk = "MJT"; //string singerkey = "Major Tom"; //TSCSingersSongs singerssongs = new TSCSingersSongs(singerkey, songs.Title, songs.Artist); string xml = client.GeneralStore("TSCSongList_Main", "GET", songs.GetDataXml()); /* * if (xml != null && xml.Trim().Length == 0) * { * singerssongs.URL = songs.OneDrive; * xml = client.GeneralStore("TSCSingersSongs", "INSERT", singerssongs.GetDataXml()); * } */ }
public ActionResult PageAddSaveRevert() { EventsGrid events = new EventsGrid(); if (Request.Form["Command"] != null && Request.Form["Command"].Trim().Length > 0) { string command = Request.Form["Command"].ToLower().Trim(); events.command = command; switch (command) { case "save": if (SessionBag.Current.EventsXml != null && SessionBag.Current.EventsXml is XmlDocument && SessionBag.Current.EventsXmlReference != null && SessionBag.Current.EventsXmlReference is XmlDocument) { XmlDocument doc = SessionBag.Current.EventsXml as XmlDocument; XmlDocument docref = SessionBag.Current.EventsXmlReference as XmlDocument; XmlNodeList nodes = doc.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { events.events.Add(new MVCEvents(node)); } nodes = docref.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { events.eventsref.Add(new MVCEvents(node)); } } if (command == "save") { string result = events.Save(); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { SingingClubClient client = new SingingClubClient(); client.Open(); string _EventsXml = client.GeneralStore("TSCEvents", "GET", (new MVCEvents()).GetDataXml()); client.Close(); XmlDocument EventsXml = new XmlDocument(); XmlDocument EventsXmlReference = new XmlDocument(); EventsXml.LoadXml(_EventsXml); EventsXmlReference.LoadXml(_EventsXml); SessionBag.Current.EventsXml = EventsXml; SessionBag.Current.EventsXmlReference = EventsXmlReference; } } break; case "add": break; case "revert": EventsGrid.Revert(); break; } } return(View(events)); }
public void InitialLoad() { InitData d = new InitData(); SingingClubClient client = new SingingClubClient(); client.Open(); d.VenuesXml = client.GeneralStore("TSCVenues", "GET", (new TSCVenues()).GetDataXml()); d.EventsXml = client.GeneralStore("TSCEvents", "GET", (new TSCEvents()).GetDataXml()); d.SingersXml = client.GeneralStore("TSCSingers", "GET", (new TSCSingers()).GetDataXml()); client.Close(); string eventvenueKey = GetLatestEventKey(d); InitialLoad(d, eventvenueKey); }
public string Save() { string result = ""; int recordschanged = 0; SingingClubClient client = new SingingClubClient(); client.Open(); if (singers != null && singersref != null) { List <MVCSingers> tobeadded = new List <MVCSingers>(); foreach (MVCSingers q in singers) { bool found = false; foreach (MVCSingers qref in singersref) { if (q.KeyEquals(qref) == true) { found = true; if (MVCSingers.FieldsEqual(q, qref) == false) { result = client.GeneralStore("TSCSingers", "UPDATE", q.GetDataXml()); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { recordschanged++; } } } } if (found == false) { tobeadded.Add(q); } } if (tobeadded.Count > 0) { foreach (MVCSingers tba in tobeadded) { result = client.GeneralStore("TSCSingers", "INSERT", tba.GetDataXml()); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { recordschanged++; } } } } client.Close(); return(recordschanged.ToString()); }
public string Save() { string result = ""; int recordschanged = 0; SingingClubClient client = new SingingClubClient(); client.Open(); if (queues != null && queuesref != null) { List <MVCQueue> tobeadded = new List <MVCQueue>(); foreach (MVCQueue q in queues) { bool found = false; foreach (MVCQueue qref in queuesref) { if (q.KeyEquals(qref) == true) { found = true; if (MVCQueue.FieldsEqual(q, qref) == false) { result = client.GeneralStore("TSCQueue", "UPDATE", q.GetDataXml()); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { recordschanged++; } } } } if (found == false) { tobeadded.Add(q); } } if (tobeadded.Count > 0) { foreach (MVCQueue tba in tobeadded) { int thisround = tba.QueueRound; string thisstate = tba.QueueState; for (int i = 1; i <= Utility.NumberOfRounds; i++) { tba.QueueRound = i; if (i < thisround) { tba.QueueState = "Not Here"; } else if (i > thisround) { tba.QueueState = "Pending"; } else { tba.QueueState = thisstate; } result = client.GeneralStore("TSCQueue", "INSERT", tba.GetDataXml()); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { recordschanged++; } } } } } client.Close(); return(recordschanged.ToString()); }
public ActionResult PageSetSinger(MVCSingers model) { string singerkey = Request.Form["SingerKey"]; string singername = Request.Form["SingerName"]; string singeremail = Request.Form["SingerEmail"]; string command = Request.Form["command"]; if (command == null) { command = ""; } else { command = command.Trim().ToLower(); } if (command == "remove" && singerkey != null && singerkey.Trim().Length > 0) { MVCSingers singer = new MVCSingers(); singer.SingerKey = singerkey; SingingClubClient client = new SingingClubClient(); string result = client.GeneralStore("TSCSingers", "DELETE", singer.GetDataXml()); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { string _SingersXml = client.GeneralStore("TSCSingers", "GET", (new MVCSingers()).GetDataXml()); client.Close(); XmlDocument SingersXml = new XmlDocument(); XmlDocument SingersXmlReference = new XmlDocument(); SingersXml.LoadXml(_SingersXml); SingersXmlReference.LoadXml(_SingersXml); SessionBag.Current.SingersXml = SingersXml; SessionBag.Current.SingersXmlReference = SingersXmlReference; } } SingersGrid singers = new SingersGrid(); if (SessionBag.Current.SingersXml != null && SessionBag.Current.SingersXml is XmlDocument && SessionBag.Current.SingersXmlReference != null && SessionBag.Current.SingersXmlReference is XmlDocument && singerkey != null && singerkey.Trim().Length > 0) { XmlDocument doc = SessionBag.Current.SingersXml as XmlDocument; XmlDocument docref = SessionBag.Current.SingersXmlReference as XmlDocument; XmlNodeList nodes = doc.SelectNodes("/Root/Data"); bool found = false; foreach (XmlNode node in nodes) { MVCSingers add = new MVCSingers(node); if (add.SingerKey == singerkey) { SetText(node, "SingerName", singername); SetText(node, "SingerEmail", singeremail); add = new MVCSingers(node); found = true; } singers.singers.Add(add); } if (found == false && command != "remove") { XmlNode root = doc.SelectSingleNode("/Root"); if (root != null) { XmlNode data = doc.CreateNode(XmlNodeType.Element, "Data", null); if (data != null) { root.AppendChild(data); SetText(data, "SingerKey", singerkey); SetText(data, "SingerName", singername); SetText(data, "SingerEmail", singeremail); MVCSingers add = new MVCSingers(data); singers.singers.Add(add); } } } nodes = docref.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { singers.singersref.Add(new MVCSingers(node)); } //singers.singers.Sort(); singers.Bind(); ViewData.Model = singers; } return(View()); }
public void InitialLoad(InitData d, string eventvenueKey) { SingingClubClient client = new SingingClubClient(); client.Open(); d.RoundXml = ""; string eventkey = ""; string venuekey = ""; if (eventvenueKey.Trim().Length > 0) { string[] keys = eventvenueKey.Split('\t'); if (keys.Length == 2) { eventkey = keys[0].Trim(); venuekey = keys[1].Trim(); } if (eventkey.Length > 0 && venuekey.Length > 0) { SessionBag.Current.EventKey = eventkey; SessionBag.Current.VenueKey = venuekey; TSCQueue q = new TSCQueue(); q.EventKey = eventkey; q.QueueRound = -1; d.RoundXml = client.GeneralStore("TSCQueue", "GET", q.GetDataXml()); } } client.Close(); XmlDocument VenuesXml = new XmlDocument(); XmlDocument EventsXml = new XmlDocument(); XmlDocument SingersXml = new XmlDocument(); XmlDocument RoundXml = new XmlDocument(); XmlDocument VenuesXmlReference = new XmlDocument(); XmlDocument EventsXmlReference = new XmlDocument(); XmlDocument SingersXmlReference = new XmlDocument(); XmlDocument RoundXmlReference = new XmlDocument(); if (d.VenuesXml != null && d.VenuesXml.Trim().Length > 0) { VenuesXml.LoadXml(d.VenuesXml); } if (d.EventsXml != null && d.EventsXml.Trim().Length > 0) { EventsXml.LoadXml(d.EventsXml); } if (d.SingersXml != null && d.SingersXml.Trim().Length > 0) { SingersXml.LoadXml(d.SingersXml); } if (d.RoundXml != null && d.RoundXml.Trim().Length > 0) { RoundXml.LoadXml(d.RoundXml); } if (d.VenuesXml != null && d.VenuesXml.Trim().Length > 0) { VenuesXmlReference.LoadXml(d.VenuesXml); } if (d.EventsXml != null && d.EventsXml.Trim().Length > 0) { EventsXmlReference.LoadXml(d.EventsXml); } if (d.SingersXml != null && d.SingersXml.Trim().Length > 0) { SingersXmlReference.LoadXml(d.SingersXml); } if (d.RoundXml != null && d.RoundXml.Trim().Length > 0) { RoundXmlReference.LoadXml(d.RoundXml); } SessionBag.Current.VenuesXml = VenuesXml; SessionBag.Current.EventsXml = EventsXml; SessionBag.Current.SingersXml = SingersXml; SessionBag.Current.RoundXml = RoundXml; SessionBag.Current.VenuesXmlReference = VenuesXmlReference; SessionBag.Current.EventsXmlReference = EventsXmlReference; SessionBag.Current.SingersXmlReference = SingersXmlReference; SessionBag.Current.RoundXmlReference = RoundXmlReference; }
// GET: Songs private void GetSongs() { if (SessionBag.Current.SongsPageOffset == null) { SessionBag.Current.SongsPageOffset = 0; } InitData d = new InitData(); SingingClubClient client = new SingingClubClient(); try { client.Open(); TSCSongs songs = new TSCSongs(); songs.PageOrder = SessionBag.Current.SongsPageOrder; songs.PageByDisk = SessionBag.Current.SongsPageByDisk; songs.PageOffset = SessionBag.Current.SongsPageOffset; songs.PageReturn = SessionBag.Current.SongsPageReturn; //songs.PageSearchString = SessionBag.Current.SongsSearchString; string whereclause = Utility.SqlString(SessionBag.Current.SongsPageSearchString); if (whereclause != null && whereclause.Length > 0) { string srch = "title"; if (songs.PageByDisk == true) { srch = "disk"; } else if (songs.PageOrder.ToLower().Contains("artist")) { srch = "artist"; } if (whereclause.Length > 0) { if (whereclause.Length == 1) { songs.WhereClause = string.Format("{0} > '{1}'", srch, whereclause); } else { songs.WhereClause = string.Format("{0} like '%{1}%'", srch, whereclause); } } } if (songs.WhereClause.Trim().Length > 0) { songs.WhereClause += " and IsHelper = 'No'"; } else { songs.WhereClause = "IsHelper = 'No'"; } d.SongsXml = client.GeneralStore("TSCSongList_Main", "GET", songs.GetDataXml()); XmlDocument SongsXml = new XmlDocument(); XmlDocument SongsXmlReference = new XmlDocument(); if (d.SongsXml != null && d.SongsXml.Trim().Length > 0) { SongsXml.LoadXml(d.SongsXml); XmlNodeList nodes = SongsXml.SelectNodes("/Root/Data"); if (nodes.Count > 0) { SongsXmlReference.LoadXml(d.SongsXml); SetSongsPageRef(); SessionBag.Current.SongsXml = SongsXml; SessionBag.Current.SongsXmlReference = SongsXmlReference; } else { SessionBag.Current.SongsPageOffset = SessionBag.Current.SongsPageOffsetRef; } } else { SessionBag.Current.SongsPageOffset = SessionBag.Current.SongsPageOffsetRef; } client.Close(); } catch {} finally { if (client != null) { client.Close(); } } }
public ActionResult PageSetVenue(MVCVenues model) { string venuekey = Request.Form["VenueKey"]; string venuename = Request.Form["VenueName"]; string venueemail = Request.Form["VenueEmail"]; string venueaddress = Request.Form["VenueAddress"]; string venuecontact = Request.Form["VenueContact"]; string venuephone = Request.Form["VenuePhone"]; string command = Request.Form["command"]; if (command == null) { command = ""; } else { command = command.Trim().ToLower(); } if (command == "remove" && venuekey != null && venuekey.Trim().Length > 0) { MVCVenues venue = new MVCVenues(); venue.VenueKey = venuekey; SingingClubClient client = new SingingClubClient(); client.Open(); string result = client.GeneralStore("TSCVenues", "DELETE", venue.GetDataXml()); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { string _VenuesXml = client.GeneralStore("TSCVenues", "GET", (new MVCVenues()).GetDataXml()); client.Close(); XmlDocument VenuesXml = new XmlDocument(); XmlDocument VenuesXmlReference = new XmlDocument(); VenuesXml.LoadXml(_VenuesXml); VenuesXmlReference.LoadXml(_VenuesXml); SessionBag.Current.VenuesXml = VenuesXml; SessionBag.Current.VenuesXmlReference = VenuesXmlReference; } } VenuesGrid venues = new VenuesGrid(); if (SessionBag.Current.VenuesXml != null && SessionBag.Current.VenuesXml is XmlDocument && SessionBag.Current.VenuesXmlReference != null && SessionBag.Current.VenuesXmlReference is XmlDocument && venuekey != null && venuekey.Trim().Length > 0) { XmlDocument doc = SessionBag.Current.VenuesXml as XmlDocument; XmlDocument docref = SessionBag.Current.VenuesXmlReference as XmlDocument; XmlNodeList nodes = doc.SelectNodes("/Root/Data"); bool found = false; foreach (XmlNode node in nodes) { MVCVenues add = new MVCVenues(node); if (add.VenueKey == venuekey) { SetText(node, "VenueName", venuename); SetText(node, "VenueEmail", venueemail); SetText(node, "VenueAddress", venueaddress); SetText(node, "VenueContact", venuecontact); SetText(node, "VenuePhone", venuephone); add = new MVCVenues(node); found = true; } venues.venues.Add(add); } if (found == false && command != "remove") { XmlNode root = doc.SelectSingleNode("/Root"); if (root != null) { XmlNode data = doc.CreateNode(XmlNodeType.Element, "Data", null); if (data != null) { root.AppendChild(data); SetText(data, "VenueKey", venuekey); SetText(data, "VenueName", venuename); SetText(data, "VenueEmail", venueemail); SetText(data, "VenueAddress", venueaddress); SetText(data, "VenueContact", venuecontact); SetText(data, "VenuePhone", venuephone); MVCVenues add = new MVCVenues(data); venues.venues.Add(add); } } } nodes = docref.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { venues.venuesref.Add(new MVCVenues(node)); } //venues.venues.Sort(); venues.Bind(); ViewData.Model = venues; } return(View()); }
public ActionResult PageSetEvent(MVCEvents model) { string venuekey = Request.Form["VenueList"]; if (venuekey == null || venuekey.Trim().Length == 0) { venuekey = Request.Form["VenueKey"]; } string eventkey = Request.Form["EventKey"]; string eventname = Request.Form["EventName"]; string eventdate = Request.Form["EventDate"]; string eventaddress = Request.Form["EventAddress"]; string eventemail = Request.Form["EventEmail"]; string command = Request.Form["command"]; if (command == null) { command = ""; } else { command = command.Trim().ToLower(); } if (command == "remove" && venuekey != null && venuekey.Trim().Length > 0 && eventkey != null && eventkey.Trim().Length > 0) { MVCEvents theevent = new MVCEvents(); theevent.VenueKey = venuekey; theevent.EventKey = eventkey; SingingClubClient client = new SingingClubClient(); client.Open(); string result = client.GeneralStore("TSCEvents", "DELETE", theevent.GetDataXml()); if (result != null && Utility.IsNumber(result) && int.Parse(result) > 0) { string _EventsXml = client.GeneralStore("TSCEvents", "GET", (new MVCEvents()).GetDataXml()); client.Close(); XmlDocument EventsXml = new XmlDocument(); XmlDocument EventsXmlReference = new XmlDocument(); EventsXml.LoadXml(_EventsXml); EventsXmlReference.LoadXml(_EventsXml); SessionBag.Current.EventsXml = EventsXml; SessionBag.Current.EventsXmlReference = EventsXmlReference; } } EventsGrid events = new EventsGrid(); if (SessionBag.Current.EventsXml != null && SessionBag.Current.EventsXml is XmlDocument && SessionBag.Current.EventsXmlReference != null && SessionBag.Current.EventsXmlReference is XmlDocument && venuekey != null && eventkey != null && venuekey.Trim().Length > 0 && eventkey.Trim().Length > 0) { XmlDocument doc = SessionBag.Current.EventsXml as XmlDocument; XmlDocument docref = SessionBag.Current.EventsXmlReference as XmlDocument; XmlNodeList nodes = doc.SelectNodes("/Root/Data"); bool found = false; foreach (XmlNode node in nodes) { MVCEvents add = new MVCEvents(node); if (add.VenueKey == venuekey && add.EventKey == eventkey) { SetText(node, "EventName", eventname); SetDate(node, "EventDate", eventdate); SetText(node, "EventAddress", eventaddress); SetText(node, "EventEmail", eventemail); add = new MVCEvents(node); found = true; } events.events.Add(add); } if (found == false && command != "remove") { XmlNode root = doc.SelectSingleNode("/Root"); if (root != null) { XmlNode data = doc.CreateNode(XmlNodeType.Element, "Data", null); if (data != null) { root.AppendChild(data); SetText(data, "VenueKey", venuekey); SetText(data, "EventKey", eventkey); SetText(data, "EventName", eventname); SetDate(data, "EventDate", eventdate); SetText(data, "EventAddress", eventaddress); SetText(data, "EventEmail", eventemail); MVCEvents add = new MVCEvents(data); events.events.Add(add); } } } nodes = docref.SelectNodes("/Root/Data"); foreach (XmlNode node in nodes) { events.eventsref.Add(new MVCEvents(node)); } events.events.Sort(); events.events.Reverse(); events.Bind(); ViewData.Model = events; } return(View()); }