private void btnNewMotorcycle_Click(object sender, EventArgs e) { this.Opacity = 0; var bikeForm = new BikeForm(null, Mode.MODE_CREATE); bikeForm.ShowDialog(this); this.Opacity = 1; }
private void btnModify_Click(object sender, EventArgs e) { int selectedRowIndex = dgvListBike.CurrentRow.Index; DataGridViewRow row = dgvListBike.Rows[selectedRowIndex]; var id = (long)row.Cells[0].Value; var bike = dataSource.Single(i => i.ID == id); this.Opacity = 0; var bikeForm = new BikeForm(bike, Mode.MODE_EDITING); bikeForm.ShowDialog(this); btnSearch_Click(null, null); this.Opacity = 1; }
private void btnSearch_Click(object sender, EventArgs e) { var chassis = txtChassis.Text; var engine = txtEngine.Text; bike = bikeDAL.SearchBike(engine, chassis); if (bike == null) { lblID.Text = ""; MessageBox.Show("Bike not found", "Alert", MessageBoxButtons.OK); } else { lblID.Text = bike.ID + ""; var bikeForm = new BikeForm(bike, Mode.MODE_READ_ONLY); bikeForm.ShowDialog(this); } }