Exemple #1
0
        public void finalizeSingleFigureSkatingEvent(FigureSkatingEvent CurrFigureSkatingEvent)
        {
            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 FigureSkatingScores on Athlete.ID = FigureSkatingScores.ParticipantID where FigureSkatingScores.EventID = " + CurrFigureSkatingEvent.giveEventkId() + " order by FigureSkatingScores.Score DESC";
            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(CurrFigureSkatingEvent.giveEventkId()));
        }
        public void enterPairFinalScoreIntoDB(FigureSkatingEvent CurrFigureSkatingEvent, Pair CurrPair)
        {
            SqlConnection conn         = new SqlConnection("Data Source=LAPTOP-TGJJO15J\\sqlexpress;Initial Catalog=WinterOlympics;Integrated Security=TRUE;MultipleActiveResultSets=True");
            string        updatestring = "Update FigureSkatingScores Set Score = " + finalscore + "where EventID = " + CurrFigureSkatingEvent.giveEventkId() + " and ParticipantID = " + CurrPair.givePairID() + "; ";

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

            cmd.ExecuteNonQuery();
            conn.Close();
        }
        public void enterPairScoresIntoDB(FigureSkatingEvent CurrFigureSkatingEvent, Pair CurrPair)
        {
            SqlConnection conn         = new SqlConnection("Data Source=LAPTOP-TGJJO15J\\sqlexpress;Initial Catalog=WinterOlympics;Integrated Security=TRUE;MultipleActiveResultSets=True");
            string        updatestring = "Update FigureSkatingScores Set Judge1ID = " + idsandscores[0, 0] + ", Judge1Score = " + idsandscores[1, 0] + ", Judge2ID = " + idsandscores[0, 1] + ", Judge2Score = " + idsandscores[1, 1] + ", Judge3ID = " + idsandscores[0, 2] + ", Judge3Score = " + idsandscores[1, 2] + ", Judge4ID = " + idsandscores[0, 3] + ", Judge4Score = " + idsandscores[1, 3] + ", Judge5ID = " + idsandscores[0, 4] + ", Judge5Score = " + idsandscores[1, 4] + ", Judge6ID = " + idsandscores[0, 5] + ", Judge6Score = " + idsandscores[1, 5] + ", Judge7ID = " + idsandscores[0, 6] + ", Judge7Score = " + idsandscores[1, 6] + ", Judge8ID = " + idsandscores[0, 7] + ", Judge8Score = " + idsandscores[1, 7] + ", Judge9ID = " + idsandscores[0, 8] + ", Judge9Score = " + idsandscores[1, 8] + " where EventID = " + CurrFigureSkatingEvent.giveEventkId() + " and ParticipantID = " + CurrPair.givePairID() + "; ";

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

            cmd.ExecuteNonQuery();
            conn.Close();
        }
Exemple #4
0
        public void finalizePairFigureSkatingEvent(FigureSkatingEvent CurrFigureSkatingEvent)
        {
            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);
            secondmedalistID[0]  = Convert.ToInt32(null);
            secondmedalistID[1]  = Convert.ToInt32(null);
            secondmedalistID[2]  = Convert.ToInt32(null);
            pairmedalistID[0]    = Convert.ToInt32(null);
            pairmedalistID[1]    = Convert.ToInt32(null);
            pairmedalistID[2]    = Convert.ToInt32(null);

            string        selectstring = "Select Top 3 Athlete1.ID, Athlete2.ID, Athlete2.countryID, Pair.ID from FigureSkatingScores left join Pair on  Pair.ID = FigureSkatingScores.ParticipantID left join Athlete as Athlete1 on Athlete1.ID = Pair.Athlete1ID left join Athlete as Athlete2 on Athlete2.ID = Pair.Athlete2ID where FigureSkatingScores.ParticipantID not in (select ID from Athlete) and  FigureSkatingScores.EventID = " + CurrFigureSkatingEvent.giveEventkId() + "  order by Score DESC;";
            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]);
                secondmedalistID[i]  = Convert.ToInt32(reader[1]);
                medalistcountryID[i] = Convert.ToInt32(reader[2]);
                pairmedalistID[i]    = Convert.ToInt32(reader[3]);
                i++;
            }

            updateAthleteMedalCount();
            updateCountryMedalCount();
            for (int j = 0; j < 3; j++)
            {
                medalistID[j] = secondmedalistID[j];
            }
            updateAthleteMedalCount();
            for (int j = 0; j < 3; j++)
            {
                medalistID[j] = pairmedalistID[j];
            }
            updateEventMedalWinners(Convert.ToInt32(CurrFigureSkatingEvent.giveEventkId()));
        }