private void simpleButtonAddRent_Click(object sender, EventArgs e) { var rf = new RentForm(); if (rf.ShowDialog() == DialogResult.Cancel) { return; } _rents.Add(rf.GetRent()); gridControlRents.DataSource = null; gridControlRents.DataSource = _rents; }
private void simpleButtonEditRent_Click(object sender, EventArgs e) { if (gridViewRents.SelectedRowsCount == 0) { MessageBox.Show(Resources.AddCarForm_simpleButtonEditRent_Click_Выберите_стоимость_аренды_для_редактирования_); return; } var idx = gridViewRents.GetSelectedRows()[0]; var rent = (Rent)gridViewRents.GetRow(idx); var df = new RentForm(rent); if (df.ShowDialog() == DialogResult.Cancel) { return; } df.GetRent(); gridControlRents.DataSource = null; gridControlRents.DataSource = _rents; }