private void btnUpdate_Click(object sender, EventArgs e) { try { using (player_crud previewPL = new player_crud()) { previewPL.objstate = (int)Enums.Checked.Update; previewPL.lblFormName.Text = "Игрок: Редактирование"; previewPL.txtid_player.Text = DataGridPlayers.CurrentRow.Cells[0].Value.ToString(); previewPL.txtFirstname.Text = DataGridPlayers.CurrentRow.Cells[1].Value.ToString(); previewPL.txtLastname.Text = DataGridPlayers.CurrentRow.Cells[2].Value.ToString(); previewPL.txtJersey.Text = DataGridPlayers.CurrentRow.Cells[3].Value.ToString(); previewPL.txtCountry.Text = DataGridPlayers.CurrentRow.Cells[4].Value.ToString(); previewPL.txtBirthday.Text = DataGridPlayers.CurrentRow.Cells[5].FormattedValue.ToString(); previewPL.cmbPosition.Text = DataGridPlayers.CurrentRow.Cells[6].Value.ToString(); previewPL.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { LoadData(); } }
private void btnAdd_Click(object sender, EventArgs e) { using (player_crud previewPL = new player_crud()) { previewPL.txtid_player.Visible = false; previewPL.lblId_team.Visible = false; previewPL.objstate = (int)Enums.Checked.Insert; previewPL.lblFormName.Text = "Игрок: Добавление"; previewPL.ShowDialog(); } LoadData(); }