예제 #1
0
 public bool Equals(OnDeck a)
 {
     if ((object)a == null)
     {
         return(false);
     }
     return(FieldsEqual(this, a));
 }
예제 #2
0
 public static bool FieldsEqual(OnDeck a, OnDeck b)
 {
     return(
         (a.SingerKey == b.SingerKey) &&
         (a.QueueRound == b.QueueRound) &&
         (a.QueueOrder == b.QueueOrder) &&
         (true)
         );
 }
예제 #3
0
 public bool KeyEquals(OnDeck a)
 {
     if ((object)a == null)
     {
         return(false);
     }
     return(
         (a.SingerKey.Trim().ToLower() == SingerKey.Trim().ToLower())
         );
 }
예제 #4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            OnDeck a = obj as OnDeck;

            if (a == null)
            {
                return(false);
            }
            return(FieldsEqual(this, a));
        }
예제 #5
0
        int IComparable.CompareTo(Object obj)
        {
            int    result = 0;
            OnDeck a      = obj as OnDeck;

            if (a != null)
            {
                result = a.QueueRound.CompareTo(this.QueueRound);
                if (result == 0)
                {
                    result = a.QueueOrder.CompareTo(this.QueueOrder);
                }
            }
            return(result);
        }
예제 #6
0
        public ActionResult Index()
        {
            string   venuekey = SessionBag.Current.VenueKey as string;
            string   eventkey = SessionBag.Current.EventKey as string;
            RootData rd       = new RootData(venuekey, eventkey);

            if (venuekey != null && venuekey.Trim().Length > 0)
            {
                XmlDocument doc  = SessionBag.Current.VenuesXml as XmlDocument;
                XmlNode     node = doc.SelectSingleNode(string.Format("/Root/Data[VenueKey='{0}']", venuekey));
                if (node != null)
                {
                    rd.VenueName = Utility.GetXmlString(node, "VenueName");
                }
            }
            if (eventkey != null && eventkey.Trim().Length > 0)
            {
                XmlDocument doc  = SessionBag.Current.EventsXml as XmlDocument;
                XmlNode     node = doc.SelectSingleNode(string.Format("/Root/Data[EventKey='{0}']", eventkey));
                if (node != null)
                {
                    rd.EventName = Utility.GetXmlString(node, "EventName");
                }
                List <SelectListItem> list  = new List <SelectListItem>();
                XmlNodeList           nodes = doc.SelectNodes("/Root/Data");
                if (nodes != null)
                {
                    foreach (XmlNode n in nodes)
                    {
                        string   vkey = Utility.GetXmlString(n, "VenueKey");
                        string   ekey = Utility.GetXmlString(n, "EventKey");
                        DateTime dt   = Utility.GetXmlDateTime(n, "EventDate");
                        if (ekey.Length > 0)
                        {
                            SelectListItem si = new SelectListItem {
                                Text = ekey, Value = Utility.SortableDate(dt) + "\t" + ekey + "\t" + vkey
                            };
                            list.Add(si);
                            if (ekey == eventkey)
                            {
                                si.Selected = true;
                            }
                        }
                    }
                }
                list.Sort((a, b) => a.Value.CompareTo(b.Value));
                list.Reverse();

                doc = SessionBag.Current.RoundXml as XmlDocument;
                if (doc != null)
                {
                    List <OnDeck> ondeck = new List <OnDeck>();
                    nodes = doc.SelectNodes("/Root/Data");
                    foreach (XmlNode n in nodes)
                    {
                        string sste = Utility.GetXmlString(n, "QueueState");
                        if (sste == "" || sste.Trim().ToLower() == "pending")
                        {
                            ondeck.Add(new OnDeck(Utility.GetXmlString(n, "SingerKey"), Utility.GetXmlInteger(n, "QueueRound"), Utility.GetXmlInteger(n, "QueueOrder")));
                        }
                    }
                    ondeck.Sort();
                    ondeck.Reverse();
                    List <SelectListItem> lod = new List <SelectListItem>();
                    int iondeck = 5;
                    if (ondeck.Count < iondeck)
                    {
                        iondeck = ondeck.Count();
                    }
                    for (int i = 0; i < iondeck; i++)
                    {
                        OnDeck         od   = ondeck[i];
                        SelectListItem item = new SelectListItem();
                        item.Text  = string.Format("{0} - (Round {1})", od.SingerKey, od.QueueRound);
                        item.Value = od.SingerKey + "\t" + od.QueueRound.ToString();
                        lod.Add(item);
                    }
                    rd.OnDeckList = lod;
                }
                rd.EventList = list;
            }
            return(View(rd));
        }