private void dgvMachine_SelectionChanged(object sender, EventArgs e)
        {
            if (dgvMachine.SelectedCells.Count > 0 && dgvMachine.SelectedCells[0].RowIndex >= 0)
            {
                var rowIndex = dgvMachine.SelectedCells[0].RowIndex;
                var row = dgvMachine.Rows[rowIndex];
                var machineId = int.Parse(row.Cells["ID"].Value.ToString());
                _selectedMachine = _machineService.GetMachineById(machineId);
                var name = row.Cells["Name"].Value.ToString();
                var machineGroup = _machineService.GetMachineGroupByMachineName(name);

                txtMachineName.Text = name;
                cbMachineGroup.Text = (machineGroup != null) ? machineGroup.Name : "";
            }
        }
 private void ResetForm()
 {
     txtMachineName.Text = "";
     cbMachineGroup.SelectedIndex = -1;
     _selectedMachine = null;
     dgvMachine.ClearSelection();
     dgvMachine.CurrentCell = null;
     dgvMachineGroup.ClearSelection();
     dgvMachineGroup.CurrentCell = null;
 }