Esempio n. 1
0
        private void buttonMainAdaugaParticipare_Click(object sender, EventArgs e)
        {
            int         id            = Int32.Parse(dataGridViewParticipanti.SelectedCells[0].Value.ToString());
            string      nume          = textBoxMainNume.Text;
            int         varsta        = Int32.Parse(numericUpDownVarsta.Value.ToString());
            int         nrParticipari = Int32.Parse(dataGridViewParticipanti.SelectedCells[3].Value.ToString());
            Participant participant   = new Participant(id, nume, varsta, nrParticipari);
            String      proba         = comboBoxMainProba.GetItemText(comboBoxMainProba.SelectedItem);

            try
            {
                controller.AdaugaParticipare(participant, proba);
                MessageBox.Show("Participare adaugata cu succes!");
            }
            catch (ServiceException se)
            {
                MessageBox.Show(se.Message);
            }
            comboBoxMainProba.SelectedItem      = null;
            buttonMainAdaugaParticipant.Enabled = false;
            buttonMainAdaugaParticipare.Enabled = false;
            comboBoxMainProba.SelectedItem      = null;
            dataGridViewParticipanti.Invoke(new Action(() => dataGridViewParticipanti.ClearSelection()));
            textBoxMainNume.Text = "";
        }