/// <summary> /// Open computer panel /// </summary> private void btnAddComputer_Click(object sender, EventArgs e) { try { FrmComputer frmComputer = new FrmComputer(this.user); this.Hide(); frmComputer.ShowDialog(); this.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Open computer panel to modify selected computer /// </summary> private void btnEdit_Click(object sender, EventArgs e) { try { if (this.dgvComputers.CurrentRow is null) { throw new Exception("No tienes ninguna computadora selecionada"); } Computer computer = (Computer)this.dgvComputers.CurrentRow.DataBoundItem; FrmComputer frmComputer = new FrmComputer(recepcionist, computer, ToDo.Edit); this.Hide(); frmComputer.ShowDialog(); this.Show(); this.ReloadData(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }