/// <summary> /// Wyświetlenie informacji o skoczku /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonJumperShow_Click(object sender, EventArgs e) { var selectedJumperIndex = Int32.Parse(dataGridViewJumpers.SelectedRows[0].Cells[0].Value.ToString()); var showJumper = _jumpers.GetById(selectedJumperIndex); var country = _countries.GetById(showJumper.CountryId); MessageBox.Show("Kraj skoczka to: " + country.Name); }
/// <summary> /// Edycja danych skoczka /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonJumperUpdate_Click(object sender, EventArgs e) { var selectedJumperIndex = Int32.Parse(dataGridViewJumpers.SelectedRows[0].Cells[0].Value.ToString()); var updateJumper = _jumpers.GetById(selectedJumperIndex); textBoxUpdateJumperId.Text = updateJumper.Id.ToString(); textBoxUpdateJumperFirstName.Text = updateJumper.FirstName; textBoxUpdateJumperLastName.Text = updateJumper.LastName; dateTimePickerUpdateJumper.Text = updateJumper.Birthdate.ToShortDateString(); textBoxUpdateCountryId.Text = updateJumper.CountryId.ToString(); }
/// <summary> /// Usunięcie skoczka z bazy danych /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonJumperDelete_Click(object sender, EventArgs e) { var selectedJumperIndex = Int32.Parse(dataGridViewJumpers.SelectedRows[0].Cells[0].Value.ToString()); var deleteJumper = _jumpers.GetById(selectedJumperIndex); _jumpers.DeleteById(deleteJumper.Id); _jumpers.Save(); LoadJumpers(); }