示例#1
0
        public void finalizeSpeedSkatingEvent(SpeedSkatingEvent CurrSpeedSkatingEvent)
        {
            medalistID[0]        = Convert.ToInt32(null);
            medalistID[1]        = Convert.ToInt32(null);
            medalistID[2]        = Convert.ToInt32(null);
            medalistcountryID[0] = Convert.ToInt32(null);
            medalistcountryID[1] = Convert.ToInt32(null);
            medalistcountryID[2] = Convert.ToInt32(null);
            string        selectstring = "Select top 3 Athlete.ID, Athlete.countryID from Athlete INNER JOIN SpeedSkatingTimes on Athlete.ID = SpeedSkatingTimes.ParticipantID where SpeedSkatingTimes.EventID = " + CurrSpeedSkatingEvent.giveEventkId() + " order by SpeedSkatingTimes.Time";
            SqlDataReader reader;
            SqlConnection conn = new SqlConnection("Data Source=LAPTOP-TGJJO15J\\sqlexpress;Initial Catalog=WinterOlympics;Integrated Security=TRUE;MultipleActiveResultSets=True");

            conn.Open();
            SqlCommand cmd = new SqlCommand(selectstring, conn);

            reader = cmd.ExecuteReader();
            int i = 0;

            while (reader.Read())
            {
                medalistID[i]        = Convert.ToInt32(reader[0]);
                medalistcountryID[i] = Convert.ToInt32(reader[1]);
                i++;
            }

            updateAthleteMedalCount();
            updateCountryMedalCount();
            updateEventMedalWinners(Convert.ToInt32(CurrSpeedSkatingEvent.giveEventkId()));
        }
示例#2
0
        public void enterAthleteTime(Athlete currAthlete, SpeedSkatingEvent currEvent)
        {
            SqlConnection conn         = new SqlConnection("Data Source=LAPTOP-TGJJO15J\\sqlexpress;Initial Catalog=WinterOlympics;Integrated Security=TRUE;MultipleActiveResultSets=True");
            string        timestring   = "00:" + minutes + ":" + seconds + ":" + milliseconds;
            string        updatestring = "update SpeedSkatingTimes set Time = '" + timestring + "' where EventID = " + currEvent.giveEventkId() + " and ParticipantID = " + currAthlete.giveAthleteID() + ";";

            conn.Open();
            SqlCommand cmd = new SqlCommand(updatestring, conn);

            cmd.ExecuteNonQuery();
            conn.Close();
        }