private void linkLabelAddNew_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var newSpecialistTraining = new SpecialistTraining(); _currentItem.SpecialistTrainings.Add(newSpecialistTraining); AddTrainingControl(newSpecialistTraining, _aircraftModels); }
public void UpdateInformation(SpecialistTraining training, List <Supplier> suppliers, List <AircraftModel> aircraftModels, IEnumerable <EmployeeLicenceGeneralControl> employeeLicenceControl) { _training = training; var categoryId = 0; foreach (var variableControl in employeeLicenceControl) { categoryId = variableControl.EmployeeLicenceTypeId; variableControl.LisenceChanged += VariableControl_LisenceChanged; } comboBoxAircraftModel.Items.Clear(); comboBoxAircraftModel.Items.AddRange(aircraftModels.ToArray()); comboBoxAircraftModel.Items.Add(AircraftModel.Unknown); comboBoxAircraftModel.SelectedItem = training.AircraftType; comboBoxSupplier.Items.Clear(); comboBoxSupplier.Items.AddRange(suppliers.ToArray()); comboBoxTrainingType.Items.Clear(); comboBoxTrainingType.Items.AddRange(TrainingType.Items.ToArray()); if (GlobalObjects.CasEnvironment != null) { lookupComboboxSubject.LoadObjectsFunc = GlobalObjects.CasEnvironment.GetEmployeeSubject; } lookupComboboxSubject.FilterParam1 = categoryId; lookupComboboxSubject.Type = typeof(EmployeeSubject); lookupComboboxSubject.SelectedItem = _training.EmployeeSubject; Program.MainDispatcher.ProcessControl(lookupComboboxSubject); comboBoxTrainingType.SelectedItem = _training.TrainingType; comboBoxSupplier.SelectedItem = _training.Supplier; checkBoxClose.Checked = _training.IsClosed; textBoxDescription.Text = _training.Description; textBoxCost.Text = _training.Cost.ToString(); textBoxHiddenRemarks.Text = _training.HiddenRemark; textBoxManHours.Text = _training.ManHours.ToString(); textBoxRemarks.Text = _training.Remarks; documentControl1.CurrentDocument = _training.Document; documentControl1.Added += DocumentControl1_Added; if (training.Threshold != null) { dateTimePickerEffDate.Value = _training.Threshold.EffectiveDate; lifelengthViewer_FirstPerformance.Lifelength = _training.Threshold.FirstPerformanceSinceEffectiveDate; lifelengthViewer_FirstNotify.Lifelength = _training.Threshold.FirstNotification; lifelengthViewerRptInterval.Lifelength = _training.Threshold.RepeatInterval; lifelengthViewerRptNotify.Lifelength = _training.Threshold.RepeatNotification; } }
private void AddTrainingControl(SpecialistTraining training, List <AircraftModel> aircraftModels) { var control = new EmployeeTrainingControl(); control.UpdateInformation(training, _suppliers, aircraftModels, _employeeLicenceControl); control.Deleted += Control_Deleted; flowLayoutPanelPerformances.Controls.Remove(linkLabelAddNew); flowLayoutPanelPerformances.Controls.Add(control); flowLayoutPanelPerformances.Controls.Add(linkLabelAddNew); }