private void btnModifyLap_Click(object sender, EventArgs e) { try { if (!string.IsNullOrWhiteSpace(TimeVehicleID)) { if (dgvLapTimes.Rows.Count > 0) { string LapID = dgvLapTimes.Rows[dgvLapTimes.CurrentCell.RowIndex].Cells["LapID"].Value.ToString(); string LapType = dgvLapTimes.Rows[dgvLapTimes.CurrentCell.RowIndex].Cells["LapType"].Value.ToString(); string LapTime = dgvLapTimes.Rows[dgvLapTimes.CurrentCell.RowIndex].Cells["LapTime"].Value.ToString(); TimeManagement t = new TimeManagement(lblPerson.Text, lblDeviceName.Text, "Modify", LapID, EventID, TimeVehicleID, LapType, LapTime); t.ShowDialog(); // Refresh dgvLapTimes.Rows.Clear(); FillLaps(); } else { // Nothing to do here } } else { // Just do nothing } } catch (Exception exc) { MessageBox.Show(exc.Message); } }
private void btnAddTime_Click(object sender, EventArgs e) { try { if (dgvParticipancy.Rows.Count > 0 || !string.IsNullOrWhiteSpace(TimeVehicleID)) { TimeManagement t = new TimeManagement(lblPerson.Text, lblDeviceName.Text, "Add", "", EventID, TimeVehicleID, "", ""); t.ShowDialog(); dgvLapTimes.Rows.Clear(); FillLaps(); } else { MessageBox.Show("Valitse osallistuja!"); } } catch (Exception exc) { MessageBox.Show(exc.Message); } }