private XmlDocument GetQueue(int Round) { if (_queuerForm != null && _queuerForm.cmb_events.Text != null && _queuerForm.cmb_events.Text.Trim().Length > 0) { TSCQueue q = new TSCQueue(); q.EventKey = _queuerForm.cmb_events.Text; q.QueueRound = Round; return(_scc.GetTable("TSCQueue", q.EventKey)); } return(null); }
private void contextMenuStripSave_Click(object sender, EventArgs e) { int recordsadded = 0; int recordschanged = 0; int recordsremoved = 0; if (IsValid()) { foreach (TSCVenues venue in gd_tscvenues) { SetState(venue, db_tscvenues); } foreach (TSCVenues venue in db_tscvenues) { SetState(venue, gd_tscvenues); } foreach (TSCVenues venue in gd_tscvenues) { if (venue.state == 'I') { string xml = venue.GetDataXml(); string result = _scc.GeneralStore("TSCVenues", _queuerForm.controlTag.venuesXml, "INSERT", xml); if (!(result != null && IsNumber(result) && int.Parse(result) > 0)) { MessageBox.Show("Save error: " + venue.VenueKey + " - " + result); } else { recordsadded++; } } else if (venue.state == 'U') { string xml = venue.GetDataXml(); string result = _scc.GeneralStore("TSCVenues", _queuerForm.controlTag.venuesXml, "UPDATE", xml); if (!(result != null && IsNumber(result) && int.Parse(result) > 0)) { MessageBox.Show("Save error: " + venue.VenueKey + " - " + result); } else { recordschanged++; } } } foreach (TSCVenues venue in db_tscvenues) { if (venue.state == 'D') { string xml = venue.GetDataXml(); string result = _scc.GeneralStore("TSCVenues", _queuerForm.controlTag.venuesXml, "DELETE", xml); if (!(result != null && IsNumber(result) && int.Parse(result) > 0)) { MessageBox.Show("Delete error: " + venue.VenueKey + " - " + result); } else { recordsremoved++; } } } if (recordsadded > 0 || recordschanged > 0 || recordsremoved > 0) { db_tscvenues.Clear(); gd_tscvenues.Clear(); if (_queuerForm != null) { _queuerForm.controlTag.venuesXml = _scc.GetTable("TSCVenues", ""); LoadTSCVenues(_queuerForm.controlTag.venuesXml); RefreshGrid(); _queuerForm.ReloadVenues(); } } } }
private void SingerHistory_Load(object sender, EventArgs e) { if (_scc != null) { try { TSCQueue template = new TSCQueue(); template.SingerKey = _singer; template.QueueRound = -1; string singerxml = template.GetDataXml(); /*XmlDocument d = new XmlDocument(); * d.LoadXml(singerxml); * XmlNodeList keys = d.SelectNodes("/Root/Data/KEYS/COLUMN_NAME"); * if (keys != null && keys.Count == 3) * { * keys[0].InnerText = "SingerKey"; * keys[2].InnerText = "EventKey"; * } * singerxml = d.OuterXml;*/ XmlDocument doc = _scc.GetTable("TSCQueue", template.EventKey); Dictionary <string, SingerHistoryStore> singerhistory = new Dictionary <string, SingerHistoryStore>(); if (doc != null) { XmlNodeList nodelist = doc.SelectNodes("/Root/Data"); foreach (XmlNode node in nodelist) { string tscevent = Utility.GetXmlString(node, "EventKey"); string singer = Utility.GetXmlString(node, "SingerKey"); string status = Utility.GetXmlString(node, "QueueState"); string song = Utility.GetXmlString(node, "QueueSong"); string artist = Utility.GetXmlString(node, "QueueArtist"); string note = Utility.GetXmlString(node, "QueueNote"); string link = Utility.GetXmlString(node, "QueueLink"); if ((singer != null && singer.Trim().Length > 0 && status != null && status.Trim().ToLower() == "finished" && ((song != null && song.Trim().Length > 0) || (link != null && link.Trim().Length > 0)))) { SingerHistoryRecord singerrecord = new SingerHistoryRecord(tscevent, singer, song, artist, note, link); if (singerhistory.ContainsKey(singer) == true) { singerhistory[singer].history.Add(singerrecord); } else { SingerHistoryStore shs = new SingerHistoryStore(singer); shs.history.Add(singerrecord); singerhistory.Add(singer, shs); } } } } if (singerhistory.Count > 0) { var list = singerhistory.Keys.ToList(); list.Sort(); foreach (var key in list) { if (singerhistory[key].history.Count > 0) { foreach (SingerHistoryRecord shr in singerhistory[key].history) { int irow = dataGridViewHistory.Rows.Add(); dataGridViewHistory.Rows[irow].Cells["TSCEvent"].Value = shr.TSCEvent; dataGridViewHistory.Rows[irow].Cells["Singer"].Value = shr.SingerKey; dataGridViewHistory.Rows[irow].Cells["Song"].Value = shr.Song; dataGridViewHistory.Rows[irow].Cells["Artist"].Value = shr.Artist; dataGridViewHistory.Rows[irow].Cells["Note"].Value = shr.Note; dataGridViewHistory.Rows[irow].Cells["Link"].Value = shr.Link; } } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private XmlDocument InitVenues() { return(scc.GetTable("TSCVenues", "")); }