public bool Equals(OnDeck a) { if ((object)a == null) { return(false); } return(FieldsEqual(this, a)); }
public static bool FieldsEqual(OnDeck a, OnDeck b) { return( (a.SingerKey == b.SingerKey) && (a.QueueRound == b.QueueRound) && (a.QueueOrder == b.QueueOrder) && (true) ); }
public bool KeyEquals(OnDeck a) { if ((object)a == null) { return(false); } return( (a.SingerKey.Trim().ToLower() == SingerKey.Trim().ToLower()) ); }
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)); }
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); }
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)); }