Пример #1
0
        private void mojeDrużynyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            CompetitionsTeamsForm competitionsTeamsForm = new CompetitionsTeamsForm(this);

            competitionsTeamsForm.SetWindow("druzyny");
            competitionsTeamsForm.Show();
        }
        private void ResultView_CellClick(object sender, DataGridViewCellEventArgs e)       //kiedy klikam komorke w gridview moich zawodow/druzyn
        {
            var loggedUserType   = LoggedUserUtility.getCurrentUserType();
            var loggedContestant = LoggedUserUtility.getLoggedContestant();

            if (CompetitionBox.Text == "Lista zawodów")
            {
                DataGridViewTextBoxCell IDcell = (DataGridViewTextBoxCell)CompetitionView.Rows[e.RowIndex].Cells[3];      //cells[3] -> bierzemy dane z kolumny ID
                competitionId = Convert.ToInt32(IDcell.Value);


                CompetitionsTeamsForm competitionsTeamsForm = new CompetitionsTeamsForm(this);
                competitionsTeamsForm.SetWindow("wyścigi", competitionId);

                competitionsTeamsForm.ConfirmButton.Visible = false;
                competitionsTeamsForm.Show();
            }
            else if (CompetitionBox.Text == "Lista wyścigów")
            {
                DataGridViewCell        clickedCell = (DataGridViewCell)CompetitionView.Rows[e.RowIndex].Cells[e.ColumnIndex];
                DataGridViewTextBoxCell raceIdCell  = (DataGridViewTextBoxCell)CompetitionView.Rows[e.RowIndex].Cells[3];  //teamId w 3 kolumnie
                //na podstawie competitionId otworz wyscigi
                if (loggedUserType == LoggedUserUtility.userType.organiser || loggedUserType == LoggedUserUtility.userType.supervisor)
                {
                    CreateDeleteEditForm createDeleteEditForm = new CreateDeleteEditForm(this);
                    if (clickedCell.Value == "Dodaj trasę")
                    {
                        createDeleteEditForm.ModifiedRaceId = Convert.ToInt32(raceIdCell.Value);
                        createDeleteEditForm.SetCreateForm("Podaj trasę wyścigów", "", "", "", "Trasa", "", "", "");
                        createDeleteEditForm.dropDownTracks();
                        createDeleteEditForm.Show();
                    }
                }
                else if (loggedUserType == LoggedUserUtility.userType.captain || loggedUserType == LoggedUserUtility.userType.contestant)
                {
                    if (clickedCell.Value == "Akceptuj")
                    {
                        ContestantDataUtility.acceptRaceInvitation(loggedContestant.id_zawodnik, Convert.ToInt32(raceIdCell.Value));
                        fillWithRaces(CompetitionView, loggedContestant.id_zawodnik, competitionId);
                    }
                }
            }
            else if (CompetitionBox.Text == "Lista drużyn")
            {
                DataGridViewCell        clickedCell = (DataGridViewCell)CompetitionView.Rows[e.RowIndex].Cells[e.ColumnIndex];
                DataGridViewTextBoxCell teamIdCell  = (DataGridViewTextBoxCell)CompetitionView.Rows[e.RowIndex].Cells[3];  //teamId w 3 kolumnie
                if (clickedCell.Value == "Akceptuj")
                {
                    ContestantDataUtility.acceptTeamInvitation(loggedContestant.id_zawodnik, Convert.ToInt32(teamIdCell.Value));
                    fillWithInvitations(CompetitionView, loggedContestant.id_zawodnik);
                }
            }
        }