private void ConditionControlDeleted(object sender, EventArgs e)
        {
            ModuleRecordControl control = (ModuleRecordControl)sender;
            ModuleRecord        cond    = control.ModuleRecord;

            if (cond.ItemId > 0 && MessageBox.Show("Do you really want to delete module record?", "Deleting confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                //если информация о состоянии сохранена в БД
                //и получен положительный ответ на ее удаление
                try
                {
                    GlobalObjects.CasEnvironment.NewKeeper.Delete(cond);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while removing data", ex);
                }

                flowLayoutPanelMain.Controls.Remove(control);
                control.Deleted -= ConditionControlDeleted;
                control.Dispose();
            }
            else if (cond.ItemId <= 0)
            {
                flowLayoutPanelMain.Controls.Remove(control);
                control.Deleted -= ConditionControlDeleted;
                control.Dispose();
            }
        }
        private void UpdateInformation()
        {
            textBoxName.Text = string.Empty;

            flowLayoutPanelMain.Controls.Clear();
            flowLayoutPanelMain.Controls.Add(panelAdd);

            if (_currentItem == null)
            {
                return;
            }

            textBoxName.Text = _currentItem.Category;

            // Освобождаем старые контролы
            flowLayoutPanelMain.Controls.Clear();

            if (_currentItem != null && _currentItem.ModuleRecords != null)
            {
                for (int i = 0; i < _currentItem.ModuleRecords.Count; i++)
                {
                    // Добавляем контрол для ввода данных по маслу
                    ModuleRecordControl c = new ModuleRecordControl(_currentItem.ModuleRecords[i]);
                    c.Deleted += ConditionControlDeleted;
                    if (i > 0)
                    {
                        c.ShowHeaders = false;
                    }
                    flowLayoutPanelMain.Controls.Add(c);
                }
            }

            flowLayoutPanelMain.Controls.Add(panelAdd);
        }
        private void linkLabelAddNew_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ModuleRecordControl performance =
                new ModuleRecordControl(new ModuleRecord {
                AircraftWorkerCategory = _currentItem
            });

            performance.Deleted += ConditionControlDeleted;
            if (flowLayoutPanelMain.Controls.Count > 1)
            {
                performance.ShowHeaders = false;
            }
            flowLayoutPanelMain.Controls.Remove(panelAdd);
            flowLayoutPanelMain.Controls.Add(performance);
            flowLayoutPanelMain.Controls.Add(panelAdd);
            performance.Focus();
        }