public void registerAthleteForEvent(Athlete currAthlete) { string insertString = "Insert into SpeedSkatingTimes(EventID,ParticipantID) values(" + id + "," + currAthlete.giveAthleteID() + ");"; SqlConnection conn = new SqlConnection("Data Source=LAPTOP-TGJJO15J\\sqlexpress;Initial Catalog=WinterOlympics;Integrated Security=TRUE;MultipleActiveResultSets=True"); conn.Open(); SqlCommand cmd = new SqlCommand(insertString, conn); cmd.ExecuteNonQuery(); conn.Close(); }
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(); }
public void printSpeedSkatingEventsByAttributesToList(Athlete currAthlete, ListBox curr) { curr.Items.Clear(); string level = currAthlete.giveLevel(); string sex = currAthlete.giveSex(); 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("select ID, Name from Event where Type = 'Speed Skating' and Level = '" + level + "' and Sex = '" + sex + "' and ID not in (select ID from EventResults);", conn); reader = cmd.ExecuteReader(); while (reader.Read()) { curr.Items.Add(reader[0].ToString() + '\t' + reader[1].ToString()); } conn.Close(); }
public void enterSingleFinalScoreIntoDB(FigureSkatingEvent CurrFigureSkatingEvent, Athlete CurrAthlete) { 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 = " + CurrAthlete.giveAthleteID() + "; "; conn.Open(); SqlCommand cmd = new SqlCommand(updatestring, conn); cmd.ExecuteNonQuery(); conn.Close(); }
public void enterSingleScoresIntoDB(FigureSkatingEvent CurrFigureSkatingEvent, Athlete CurrAthlete) { 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 = " + CurrAthlete.giveAthleteID() + "; "; conn.Open(); SqlCommand cmd = new SqlCommand(updatestring, conn); cmd.ExecuteNonQuery(); conn.Close(); }