Exemple #1
0
        private void Hozzaadas_Button_Click(object sender, EventArgs e)
        {
            SzelvenyElem elemToAdd = (SzelvenyElem)Lehetosegek_Listbox.SelectedItem;

            // Dummy elem esetén (segéd sor) ne tegyen semmit
            if (elemToAdd.oddId == "dummy")
            {
                return;
            }

            // Listbox frissítése
            playedList.Add(elemToAdd);
            Szelveny_ListBox.DataSource    = new List <SzelvenyElem>();
            Szelveny_ListBox.DataSource    = playedList;
            Szelveny_ListBox.DisplayMember = "fullDetail";
            Szelveny_ListBox.ValueMember   = "oddId";
        }
Exemple #2
0
        private void Merkozes_Listbox_SelectedIndexChanged(object sender, EventArgs e)
        {
            oddsList.Clear();
            Match selectedMatch = (Match)Merkozes_Listbox.SelectedItem;

            // Kategóriák
            foreach (XmlElement element in doc.DocumentElement)
            {
                if (element.GetAttribute("name") == selectedMatch.categoryName)
                {
                    // Meccsek
                    foreach (XmlElement match in element.FirstChild)
                    {
                        if (match.GetAttribute("id") == selectedMatch.id)
                        {
                            // Meccs gyermekeinek iterálása
                            foreach (XmlElement matchChild in match.ChildNodes)
                            {
                                if (matchChild.Name == "odds")
                                {
                                    // Fogadási lehetőségek iterálása
                                    foreach (XmlElement oddsChild in matchChild.ChildNodes)
                                    {
                                        if (oddsChild.GetAttribute("value") == "Match Winner")
                                        {
                                            SzelvenyElem dummyElem = new SzelvenyElem();
                                            dummyElem.oddId           = "dummy";
                                            dummyElem.oddNameAndValue = "Match Winner";
                                            oddsList.Add(dummyElem);
                                            // Match winner típusú fogadás iterálása
                                            foreach (XmlElement odd in oddsChild.FirstChild)
                                            {
                                                SzelvenyElem newElem = new SzelvenyElem();
                                                newElem.categoryName = selectedMatch.categoryName;
                                                newElem.matchId      = selectedMatch.id;
                                                newElem.localTeam    = selectedMatch.localTeam;
                                                newElem.visitorTeam  = selectedMatch.visitorTeam;
                                                newElem.time         = selectedMatch.time;
                                                newElem.oddType      = oddsChild.GetAttribute("value");
                                                newElem.oddName      = odd.GetAttribute("name");
                                                string oddReplaced = odd.GetAttribute("value").Replace('.', ',');
                                                newElem.oddValue        = oddReplaced;
                                                newElem.oddNameAndValue = odd.GetAttribute("name") + "-" + oddReplaced;
                                                newElem.oddId           = odd.GetAttribute("id");
                                                newElem.fullDetail      = newElem.oddType + "," + newElem.localTeam + "-" + newElem.visitorTeam + " at " + newElem.time + " Odd: " + newElem.oddNameAndValue;

                                                oddsList.Add(newElem);
                                            }
                                        }

                                        // Both Teams to score típusú fogaád iterálása
                                        if (oddsChild.GetAttribute("value") == "Both Teams To Score")
                                        {
                                            SzelvenyElem dummyElem = new SzelvenyElem();
                                            dummyElem.oddId           = "dummy";
                                            dummyElem.oddNameAndValue = "Both Teams To Score";
                                            oddsList.Add(dummyElem);
                                            foreach (XmlElement odd in oddsChild.FirstChild)
                                            {
                                                SzelvenyElem newElem = new SzelvenyElem();
                                                newElem.categoryName = selectedMatch.categoryName;
                                                newElem.matchId      = selectedMatch.id;
                                                newElem.localTeam    = selectedMatch.localTeam;
                                                newElem.visitorTeam  = selectedMatch.visitorTeam;
                                                newElem.time         = selectedMatch.time;
                                                newElem.oddType      = oddsChild.GetAttribute("value");
                                                newElem.oddName      = odd.GetAttribute("name");
                                                string oddReplaced = odd.GetAttribute("value").Replace('.', ',');
                                                newElem.oddValue        = oddReplaced;
                                                newElem.oddNameAndValue = odd.GetAttribute("name") + "-" + oddReplaced;
                                                newElem.oddId           = odd.GetAttribute("id");
                                                newElem.fullDetail      = newElem.oddType + "," + newElem.localTeam + "-" + newElem.visitorTeam + " at " + newElem.time + " Odd: " + newElem.oddNameAndValue;

                                                oddsList.Add(newElem);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // Listbox frissítése
            Lehetosegek_Listbox.DataSource    = new List <SzelvenyElem>();
            Lehetosegek_Listbox.DataSource    = oddsList;
            Lehetosegek_Listbox.DisplayMember = "oddNameAndValue";
            Lehetosegek_Listbox.ValueMember   = "oddId";
        }