Esempio n. 1
0
        public void Delete(SpecialistLicense license)
        {
            foreach (var remark in license.LicenseRemark)
            {
                _casEnvironment.NewKeeper.Delete(remark);
            }
            foreach (var caa in license.CaaLicense)
            {
                _casEnvironment.NewKeeper.Delete(caa);
            }
            foreach (var detail in license.LicenseDetails)
            {
                _casEnvironment.NewKeeper.Delete(detail);
            }
            foreach (var rating in license.LicenseRatings)
            {
                _casEnvironment.NewKeeper.Delete(rating);
            }
            foreach (var instrumentRating in license.SpecialistInstrumentRatings)
            {
                _casEnvironment.NewKeeper.Delete(instrumentRating);
            }

            _casEnvironment.NewKeeper.Delete(license);
        }
Esempio n. 2
0
        private void Control_Deleted(object sender, EventArgs e)
        {
            var control = sender as EmployeeLicenceGeneralControl;

            var dialogResult = MessageBox.Show("Do you really want to delete license?", "Deleting confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);

            if (dialogResult == DialogResult.Yes)
            {
                var license = control.License;
                if (control.License.ItemId > 0)
                {
                    GlobalObjects.PersonnelCore.Delete(license);
                }

                flowLayoutPanelGeneralControl.Controls.Remove(control);
                control.Deleted -= Control_Deleted;
                control.Dispose();

                if (flowLayoutPanelGeneralControl.Controls.Count == 0)
                {
                    var newLicense = new SpecialistLicense {
                        SpecialistId = _currentItem.ItemId
                    };
                    _currentItem.Licenses.Add(newLicense);
                    AddLicenseGeneralControl(newLicense, false);
                }
            }
        }
Esempio n. 3
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            var newLicense = new SpecialistLicense {
                SpecialistId = _currentItem.ItemId
            };

            _currentItem.Licenses.Add(newLicense);
            AddLicenseGeneralControl(newLicense);
        }
Esempio n. 4
0
        private void AddLicenseGeneralControl(SpecialistLicense license, bool showLink = true)
        {
            var control = new EmployeeLicenceGeneralControl {
                ShowLinkDelete = showLink
            };

            control.UpdateControl(license, _currentItem.PersonnelCategory, _aircraftModels);
            control.Deleted += Control_Deleted;
            flowLayoutPanelGeneralControl.Controls.Add(control);
        }
Esempio n. 5
0
        public void UpdateControl(SpecialistLicense license, PersonnelCategory personnelCategory, List <AircraftModel> aircraftModels)
        {
            _license = license;
            UpdateLicenceCombobox(personnelCategory);

            //CAA
            var licenseCaa = _license.CaaLicense.FirstOrDefault(c => c.CaaType == CaaType.Licence);

            if (licenseCaa != null)
            {
                employeeLicenceLicenseCaaControl.UpdateControl(licenseCaa);
            }
            else
            {
                var newCaaLicense = new SpecialistCAA {
                    CaaType = CaaType.Licence
                };
                employeeLicenceLicenseCaaControl.UpdateControl(newCaaLicense);
                _license.CaaLicense.Add(newCaaLicense);
            }

            foreach (var caa in _license.CaaLicense.Where(c => c.CaaType == CaaType.Other))
            {
                AddCaaControl(caa);
            }

            //Detail
            foreach (var licenseDetail in _license.LicenseDetails)
            {
                AddDetailControl(licenseDetail);
            }

            //Rating
            foreach (var licenseRating in _license.LicenseRatings)
            {
                AddRatingControl(licenseRating);
            }

            //InstrumentRating
            foreach (var instrumentRating in _license.SpecialistInstrumentRatings)
            {
                AddInstrumentRatingControl(instrumentRating);
            }

            //Remark
            foreach (var instrumentRating in _license.LicenseRemark)
            {
                AddRemarkControl(instrumentRating);
            }

            comboBoxCategory.Items.Clear();
            foreach (var aircraftModel in aircraftModels)
            {
                comboBoxCategory.Items.Add(aircraftModel);
            }

            comboBoxCategory.Items.Add(AircraftModel.Unknown);


            flowLayoutPanelCaa.Enabled = _license.Confirmation;


            UpdateInformation();
        }
Esempio n. 6
0
        public void UpdateControl(Specialist currentItem, List <AircraftModel> aircraftModels)
        {
            if (currentItem == null)
            {
                return;
            }

            _currentItem    = currentItem;
            _aircraftModels = aircraftModels;

            var ints = new object[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };

            comboBoxPersonnel.Items.Clear();
            foreach (var o in PersonnelCategory.Items)
            {
                comboBoxPersonnel.Items.Add(o);
            }

            comboBoxClass.Items.Clear();
            comboBoxClass.Items.AddRange(ints);
            comboBoxGrade.Items.Clear();
            comboBoxGrade.Items.AddRange(ints);

            comboBoxClass.SelectedItem     = _currentItem.ClassNumber;
            comboBoxGrade.SelectedItem     = _currentItem.GradeNumber;
            dateTimePickerClassIssue.Value = _currentItem.ClassIssueDate;
            dateTimePickerGradeIssue.Value = _currentItem.GradeIssueDate;
            comboBoxPersonnel.SelectedItem = _currentItem.PersonnelCategory;

            if (_currentItem.Licenses.Count > 0)
            {
                flowLayoutPanelGeneralControl.Controls.Clear();
                foreach (var license in _currentItem.Licenses)
                {
                    AddLicenseGeneralControl(license);
                }
            }
            else
            {
                var newLicense = new SpecialistLicense {
                    SpecialistId = _currentItem.ItemId
                };
                _currentItem.Licenses.Add(newLicense);
                employeeLicenceGeneralControl.UpdateControl(newLicense, _currentItem.PersonnelCategory, aircraftModels);
            }

            //Detail
            if (_currentItem.LicenseDetails.Count > 0)
            {
                flowLayoutPanelOtherDetail.Controls.Clear();
            }

            foreach (var licenseDetail in _currentItem.LicenseDetails)
            {
                AddDetailControl(licenseDetail);
            }

            //Remark
            if (_currentItem.LicenseRemark.Count > 0)
            {
                flowLayoutPanelRemark.Controls.Clear();
            }

            foreach (var instrumentRating in _currentItem.LicenseRemark)
            {
                AddRemarkControl(instrumentRating);
            }
        }