Example #1
0
        private void SetState(TSCQueue queue, BindingList <TSCQueue> list)
        {
            bool bFound = false;

            if (ValidQueueKey(queue) == true)
            {
                foreach (TSCQueue s in list)
                {
                    if (ValidQueueKey(s) == true && s.KeyEquals(queue))
                    {
                        bFound = true;
                        if (s == queue)
                        {
                            queue.state = '=';
                        }
                        else
                        {
                            queue.state = 'U';
                        }
                    }
                }
            }
            else
            {
                queue.state = '?';
                return;
            }
            if (bFound == false)
            {
                queue.state = 'D';
            }
        }
Example #2
0
        private void AddQueue(BindingList <TSCQueue> sync_tscqueue, TSCQueue tscqueue)
        {
            foreach (TSCQueue q in gd_tscqueue)
            {
                if (q.SingerKey == tscqueue.SingerKey)
                {
                    TSCQueue nq = new TSCQueue();
                    nq.EventKey    = q.EventKey;
                    nq.SingerKey   = q.SingerKey;
                    nq.QueueRound  = _round;
                    nq.QueueOrder  = tscqueue.QueueOrder;
                    nq.QueueArtist = q.QueueArtist;
                    nq.QueueLink   = q.QueueLink;
                    nq.QueueState  = q.QueueState;
                    nq.QueueNote   = q.QueueNote;
                    nq.QueueSong   = q.QueueSong;
                    sync_tscqueue.Add(nq);
                    return;
                }
            }
            TSCQueue n = new TSCQueue();

            n.EventKey    = tscqueue.EventKey;
            n.SingerKey   = tscqueue.SingerKey;
            n.QueueRound  = _round;
            n.QueueOrder  = tscqueue.QueueOrder;
            n.QueueArtist = "";
            n.QueueLink   = "";
            n.QueueState  = "";
            n.QueueNote   = "";
            n.QueueSong   = "";
            sync_tscqueue.Add(n);
        }
Example #3
0
        private void SetState(TSCQueue queue, List <TSCQueue> list)
        {
            if (ValidQueueKey(queue) == false)
            {
                return;
            }
            bool bFound = false;

            foreach (TSCQueue s in list)
            {
                if (s.KeyEquals(queue))
                {
                    bFound = true;
                    if (s == queue)
                    {
                        queue.state = '=';
                    }
                    else
                    {
                        queue.state = 'U';
                    }
                }
            }
            if (bFound == false)
            {
                queue.state = 'I';
            }
        }
Example #4
0
 public bool Equals(TSCQueue a)
 {
     if ((object)a == null)
     {
         return(false);
     }
     return(FieldsEqual(this, a));
 }
Example #5
0
 private void Reload()
 {
     if (cmbEvent.Text != null && cmbEvent.Text.Trim().Length > 0)
     {
         TSCQueue templateQueue = new TSCQueue();
         templateQueue.EventKey   = cmbEvent.Text;
         templateQueue.QueueRound = 1;
         controlTag.queueXml      = scc.GetTable("TSCQueue", templateQueue.EventKey);
     }
 }
Example #6
0
 private bool ValidQueueKey(TSCQueue queue)
 {
     if (_queuerForm != null && queue.SingerKey != null && queue.SingerKey.Trim().Length > 0)
     {
         queue.EventKey   = _queuerForm.cmb_events.Text;
         queue.QueueRound = _round;
         return(queue.EventKey != null && queue.SingerKey != null && queue.QueueRound >= 0 && queue.EventKey.Trim().Length > 0 && queue.SingerKey.Trim().Length > 0);
     }
     return(false);
 }
Example #7
0
 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);
 }
Example #8
0
        private void btnNotHere_Click(object sender, EventArgs e)
        {
            if (txtNowSinging.Tag != null && controlTag != null)
            {
                TSCQueue q = txtNowSinging.Tag as TSCQueue;
                if (q != null)
                {
                    switch (q.QueueRound)
                    {
                    case 1:
                        if (controlTag.queueControl1 != null)
                        {
                            controlTag.queueControl1.SetNotHere(q);
                        }
                        break;

                    case 2:
                        if (controlTag.queueControl2 != null)
                        {
                            controlTag.queueControl2.SetNotHere(q);
                        }
                        break;

                    case 3:
                        if (controlTag.queueControl3 != null)
                        {
                            controlTag.queueControl3.SetNotHere(q);
                        }
                        break;

                    case 4:
                        if (controlTag.queueControl4 != null)
                        {
                            controlTag.queueControl4.SetNotHere(q);
                        }
                        break;

                    case 5:
                        if (controlTag.queueControl5 != null)
                        {
                            controlTag.queueControl5.SetNotHere(q);
                        }
                        break;

                    case 6:
                        if (controlTag.queueControl6 != null)
                        {
                            controlTag.queueControl6.SetNotHere(q);
                        }
                        break;
                    }
                }
            }
        }
Example #9
0
 public bool KeyEquals(TSCQueue a)
 {
     if ((object)a == null)
     {
         return(false);
     }
     return(
         (a.EventKey.Trim().ToLower() == EventKey.Trim().ToLower()) &&
         (a.QueueRound == QueueRound) &&
         (a.SingerKey.Trim().ToLower() == SingerKey.Trim().ToLower())
         );
 }
Example #10
0
 private void LoadNext(XmlDocument doc, int iround)
 {
     try
     {
         if (doc != null)
         {
             XmlNode nodedata = doc.SelectSingleNode("/Root/Data");
             if (nodedata != null)
             {
                 XmlNode         noderound   = nodedata.SelectSingleNode("QueueRound[@round='" + iround.ToString() + "']");
                 string          eventkey    = Utility.GetXmlString(nodedata, "EventKey");
                 XmlNodeList     nodesingers = noderound.SelectNodes("SingerKey");
                 List <TSCQueue> tscqueues   = new List <TSCQueue>();
                 if (nodesingers != null)
                 {
                     foreach (XmlNode singer in nodesingers)
                     {
                         TSCQueue tscqueue = new TSCQueue();
                         tscqueue.EventKey    = eventkey;
                         tscqueue.QueueRound  = iround;
                         tscqueue.SingerKey   = Utility.GetXmlString(singer, "key", true);
                         tscqueue.QueueOrder  = Utility.GetXmlInteger(singer, "QueueOrder");
                         tscqueue.QueueSong   = Utility.GetXmlString(singer, "QueueSong");
                         tscqueue.QueueArtist = Utility.GetXmlString(singer, "QueueArtist");
                         tscqueue.QueueNote   = Utility.GetXmlString(singer, "QueueNote");
                         tscqueue.QueueLink   = Utility.GetXmlString(singer, "QueueLink");
                         tscqueue.QueueState  = Utility.GetXmlString(singer, "QueueState");
                         tscqueues.Add(tscqueue);
                     }
                 }
                 tscqueues.Sort();
                 foreach (TSCQueue tscqueue in tscqueues)
                 {
                     if (tscqueue.QueueState != null && (tscqueue.QueueState.Trim().Length == 0 || tscqueue.QueueState.Trim().ToLower() == "pending"))
                     {
                         if (NextUp.Count < 2)
                         {
                             NextUp.Add(tscqueue);
                         }
                         else
                         {
                             break;
                         }
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #11
0
        private void LoadTSCQueue(XmlDocument doc, int iround)
        {
            gd_tscqueue = new BindingList <TSCQueue>();
            List <TSCQueue> gd_sort = new List <TSCQueue>();

            db_tscqueue = new List <TSCQueue>();
            if (doc != null)
            {
                XmlNode nodedata = doc.SelectSingleNode("/Root/Data");
                if (nodedata != null)
                {
                    XmlNode     noderound = nodedata.SelectSingleNode("QueueRound[@round='" + iround.ToString() + "']");
                    XmlNodeList nodelist  = noderound.SelectNodes("SingerKey");
                    foreach (XmlNode node in nodelist)
                    {
                        TSCQueue tscqueue = new TSCQueue();
                        tscqueue.EventKey    = Utility.GetXmlString(nodedata, "EventKey");
                        tscqueue.SingerKey   = Utility.GetXmlString(node, "key", true);
                        tscqueue.QueueRound  = iround;
                        tscqueue.QueueOrder  = Utility.GetXmlInteger(node, "QueueOrder");
                        tscqueue.QueueSong   = Utility.GetXmlString(node, "QueueSong");
                        tscqueue.QueueArtist = Utility.GetXmlString(node, "QueueArtist");
                        tscqueue.QueueNote   = Utility.GetXmlString(node, "QueueNote");
                        tscqueue.QueueLink   = Utility.GetXmlString(node, "QueueLink");
                        tscqueue.QueueState  = Utility.GetXmlString(node, "QueueState");
                        gd_sort.Add(tscqueue);
                    }
                    foreach (TSCQueue tscqueue in gd_sort)
                    {
                        db_tscqueue.Add(new TSCQueue(tscqueue));
                    }
                }
            }
            else
            {
            }
            gd_sort.Sort();
            foreach (TSCQueue t in gd_sort)
            {
                gd_tscqueue.Add(t);
            }
            dataGridViewQueue.DataSource = gd_tscqueue;
            dataGridViewQueue.Columns["EventKey"].DataPropertyName    = "EventKey";
            dataGridViewQueue.Columns["SingerKey"].DataPropertyName   = "SingerKey";
            dataGridViewQueue.Columns["QueueRound"].DataPropertyName  = "QueueRound";
            dataGridViewQueue.Columns["QueueOrder"].DataPropertyName  = "QueueOrder";
            dataGridViewQueue.Columns["QueueSong"].DataPropertyName   = "QueueSong";
            dataGridViewQueue.Columns["QueueArtist"].DataPropertyName = "QueueArtist";
            dataGridViewQueue.Columns["QueueNote"].DataPropertyName   = "QueueNote";
            dataGridViewQueue.Columns["QueueLink"].DataPropertyName   = "QueueLink";
            dataGridViewQueue.Columns["QueueState"].DataPropertyName  = "QueueState";
            SetHeaders();
        }
Example #12
0
 public TSCQueue(TSCQueue tscqueue)
     : this()
 {
     EventKey    = new string(tscqueue.EventKey.ToArray());
     SingerKey   = new string(tscqueue.SingerKey.ToArray());
     QueueRound  = tscqueue.QueueRound;
     QueueOrder  = tscqueue.QueueOrder;
     QueueSong   = new string(tscqueue.QueueSong.ToArray());
     QueueArtist = new string(tscqueue.QueueArtist.ToArray());
     QueueNote   = new string(tscqueue.QueueNote.ToArray());
     QueueLink   = new string(tscqueue.QueueLink.ToArray());
     QueueState  = new string(tscqueue.QueueState.ToArray());
 }
Example #13
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            TSCQueue a = obj as TSCQueue;

            if (a == null)
            {
                return(false);
            }
            return(FieldsEqual(this, a));
        }
Example #14
0
        int IComparable.CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            TSCQueue q = obj as TSCQueue;

            if (q == null)
            {
                return(1);
            }
            return(QueueOrder.CompareTo(q.QueueOrder));
        }
Example #15
0
 private static bool FieldsEqual(TSCQueue a, TSCQueue b)
 {
     return(
         (a.EventKey == b.EventKey) &&
         (a.SingerKey == b.SingerKey) &&
         (a.QueueRound == b.QueueRound) &&
         (a.QueueOrder == b.QueueOrder) &&
         (a.QueueSong == b.QueueSong) &&
         (a.QueueArtist == b.QueueArtist) &&
         (a.QueueNote == b.QueueNote) &&
         (a.QueueLink == b.QueueLink) &&
         (a.QueueState == b.QueueState) &&
         (true)
         );
 }
Example #16
0
 public void SetNotHere(TSCQueue q)
 {
     if (gd_tscqueue != null && gd_tscqueue.Count > 0)
     {
         for (int ix = 0; ix < gd_tscqueue.Count; ix++)
         {
             TSCQueue tq = gd_tscqueue[ix];
             if (tq.KeyEquals(q))
             {
                 SetNotHere(ix);
                 break;
             }
         }
     }
 }
Example #17
0
        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);
                }
            }
        }
Example #18
0
        public void Save()
        {
            int recordsadded   = 0;
            int recordschanged = 0;
            int recordsremoved = 0;

            if (IsValid())
            {
                foreach (TSCQueue queue in gd_tscqueue)
                {
                    SetState(queue, db_tscqueue);
                }
                foreach (TSCQueue queue in db_tscqueue)
                {
                    SetState(queue, gd_tscqueue);
                }
                foreach (TSCQueue queue in gd_tscqueue)
                {
                    if (queue.state == 'I')
                    {
                        string xml    = queue.GetDataXml();
                        string result = _scc.GeneralStore("TSCQueue", _queuerForm.controlTag.queueXml, queue.EventKey, "INSERT", xml);
                        if (!(result != null && IsNumber(result) && int.Parse(result) > 0))
                        {
                            MessageBox.Show("Save error: " + QueueKey(queue) + " - " + result);
                        }
                        else
                        {
                            recordsadded++;
                        }
                    }
                    else if (queue.state == 'U')
                    {
                        string xml    = queue.GetDataXml();
                        string result = _scc.GeneralStore("TSCQueue", _queuerForm.controlTag.queueXml, queue.EventKey, "UPDATE", xml);
                        if (!(result != null && IsNumber(result) && int.Parse(result) > 0))
                        {
                            MessageBox.Show("Save error: " + QueueKey(queue) + " - " + result);
                        }
                        else
                        {
                            recordschanged++;
                        }
                    }
                }
                foreach (TSCQueue queue in db_tscqueue)
                {
                    if (queue.state == 'D')
                    {
                        string xml    = queue.GetDataXml();
                        string result = _scc.GeneralStore("TSCQueue", _queuerForm.controlTag.queueXml, queue.EventKey, "DELETE", xml);
                        if (!(result != null && IsNumber(result) && int.Parse(result) > 0))
                        {
                            MessageBox.Show("Delete error: " + QueueKey(queue) + " - " + result);
                        }
                        else
                        {
                            recordsremoved++;
                        }
                    }
                }
                if (_queuerForm != null && (recordsadded > 0 || recordschanged > 0 || recordsremoved > 0))
                {
                    db_tscqueue.Clear();
                    gd_tscqueue.Clear();
                    TSCQueue templateQueue = new TSCQueue();
                    templateQueue.EventKey          = _queuerForm.cmb_events.Text;
                    templateQueue.QueueRound        = _round;
                    _queuerForm.controlTag.queueXml = _scc.GetTable("TSCQueue", templateQueue.EventKey);
                    LoadTSCQueue(_queuerForm.controlTag.queueXml, 1);

                    RefreshGrid();
                    if (_queuerForm != null)
                    {
                        _queuerForm.controlTag.RefreshQueue(gd_tscqueue);
                        if (_queuerForm.controlTag != null)
                        {
                            _queuerForm.controlTag.SetNext();
                        }
                        _queuerForm.SetNext();
                    }
                }
            }
        }
Example #19
0
 private string QueueKey(TSCQueue queue)
 {
     return(string.Format("[{0}]-[{1}]-{2}", queue.EventKey, queue.SingerKey, queue.QueueRound.ToString()));
 }