Esempio n. 1
0
        private void TxtStartNumber_TextChanged(object sender, TextChangedEventArgs e)
        {
            uint startNumber = 0U;

            try { startNumber = uint.Parse(txtStartNumber.Text); } catch (Exception) { }
            RaceParticipant participant = _race.GetParticipant(startNumber);

            if (participant != null)
            {
                txtParticipant.Text = participant.Fullname;
                RunResult rr = _currentRaceRun.GetResultList().FirstOrDefault(r => r.Participant == participant);
                if (rr != null)
                {
                    cmbDisqualifyReason.Text    = rr.GetDisqualifyText();
                    txtDisqualify.Text          = rr.GetDisqualifyGoal();
                    cmbDisqualify.SelectedValue = rr.ResultCode;
                }
                else
                {
                    txtDisqualify.Text          = "";
                    cmbDisqualify.SelectedValue = null;
                }
            }
            else
            {
                txtParticipant.Text = "";
            }
        }
Esempio n. 2
0
        public void RunResultExtension()
        {
            string s1 = RaceHorologyLib.RunResultExtension.JoinDisqualifyText("Vorbei am Tor", "12");

            Assert.AreEqual("Vorbei am Tor 12", s1);

            {
                string r, g;
                RaceHorologyLib.RunResultExtension.SplitDisqualifyText("Vorbei am Tor 12", out r, out g);
                Assert.AreEqual("Vorbei am Tor", r);
                Assert.AreEqual("12", g);
            }
            {
                string r, g;
                RaceHorologyLib.RunResultExtension.SplitDisqualifyText("Vorbei am Tor 12 aaa", out r, out g);
                Assert.AreEqual("Vorbei am Tor 12 aaa", r);
                Assert.AreEqual("", g);
            }
            {
                string r, g;
                RaceHorologyLib.RunResultExtension.SplitDisqualifyText("12", out r, out g);
                Assert.AreEqual("", r);
                Assert.AreEqual("12", g);
            }
            {
                string r, g;
                RaceHorologyLib.RunResultExtension.SplitDisqualifyText("Vorbei am Tor 12 aaa 13", out r, out g);
                Assert.AreEqual("Vorbei am Tor 12 aaa", r);
                Assert.AreEqual("13", g);
            }

            RunResult rr = new RunResult(null);

            rr.DisqualText = "Vorbei am Tor 12";
            Assert.AreEqual("Vorbei am Tor", rr.GetDisqualifyText());
            Assert.AreEqual("12", rr.GetDisqualifyGoal());

            // Error Conditions
            {
                string r, g;
                RaceHorologyLib.RunResultExtension.SplitDisqualifyText("", out r, out g);
                Assert.AreEqual("", r);
                Assert.AreEqual("", g);
            }
            {
                string r, g;
                RaceHorologyLib.RunResultExtension.SplitDisqualifyText(null, out r, out g);
                Assert.AreEqual("", r);
                Assert.AreEqual("", g);
            }
        }