Example #1
0
        private void tournamentDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            //10.11.12
            int id = Convert.ToInt32(tournamentDataGridView.CurrentRow.Cells[0].Value);

            if (e.ColumnIndex == 10)
            {
                //Info
                tournament loct = context.tournaments.Find(id);
                using (TournamentRaceInfoForm frm = new TournamentRaceInfoForm(loct))
                {
                    frm.ShowDialog();
                }
            }
            if (e.ColumnIndex == 11)
            {
                if (loggedUser == "Admin")
                {
                    //Delete
                    if (dbm.DeleteRaceFromTournament(id))
                    {
                        MessageBox.Show("Deleted", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Error", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    tournamentDataGridView.DataSource = dbm.GetTournamentView(seasonYear);
                }
                else
                {
                    MessageBox.Show("Access Denied", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #2
0
 public TournamentRaceInfoForm(tournament t)
 {
     InitializeComponent();
     raceLocationLbl.Text = t.race1.location;
     raceDateLbl.Text     = t.race1.race_day.ToShortDateString();
     raceLapsLbl.Text     = t.race1.laps.ToString();
     raceWinnerLbl.Text   = t.result1.driver1.name + ' ' + t.result1.driver1.family_name;
     raceSecondLbl.Text   = t.result1.driver3.name + ' ' + t.result1.driver3.family_name;
     raceThirdLbl.Text    = t.result1.driver4.name + ' ' + t.result1.driver4.family_name;
     try
     {
         trackPictureBox.Image    = Image.FromFile("../../Photos/" + raceLocationLbl.Text + ".png");
         trackPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
     }
     catch (Exception)
     {
         //MessageBox.Show("No Track Sceme", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     try
     {
         winnerPictureBox.Image    = Image.FromFile("../../Photos/" + t.result1.driver1.family_name + ".jpg");
         winnerPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
     }
     catch (Exception)
     {
         //MessageBox.Show("No Winner Photo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     try
     {
         secondPictureBox.Image    = Image.FromFile("../../Photos/" + t.result1.driver3.family_name + ".jpg");
         secondPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
     }
     catch (Exception)
     {
         //MessageBox.Show("No Second Place Photo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     try
     {
         thirdPictureBox.Image    = Image.FromFile("../../Photos/" + t.result1.driver4.family_name + ".jpg");
         thirdPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
     }
     catch (Exception)
     {
         //MessageBox.Show("No Third Place Photo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     this.Text = "Race --- " + raceLocationLbl.Text;
 }