Beispiel #1
0
        private void SaveCanQualProc()
        {
            if (NewCanQual == null)
            {
                return;
            }

            var selectedQuals = QualificationsList.Where(c => c.IsSelected).ToList();

            foreach (var selectedQualification in selectedQuals)
            {
                try
                {
                    NewCanQual.ModelCopy.CandidateId     = SelectedCandidate.Model.CandidateId;
                    NewCanQual.ModelCopy.QualificationId = selectedQualification.Model.QualificationId;
                    NewCanQual.ModelCopy.IsAssigned      = true;

                    _repository.CanQualify.Add(NewCanQual.ModelCopy);
                    _selectedCandidate.CandidateQualifications.Add(new CanQualModel(NewCanQual.ModelCopy, _repository));
                }
                catch (Exception e)
                {
                    MessageBox.Show("An error occured during save. Reason: " + e.Message, "Candidate");
                }
            }

            SelectedCandidate = _selectedCandidate;
            ViewModelLocatorStatic.Locator.OpeningModule.SelectedOpening = ViewModelLocatorStatic.Locator.OpeningModule.SelectedOpening;
            _AddCanQualWindow.Close();
        }
Beispiel #2
0
        public void LoadQualificationsList() //this code is to filter the list of qualifications that a candidate can earn
        {
            QualificationsList.Clear();

            var qualifications = _repository.Qualification.GetRange().Select(c => new QualificationSelection(c));

            foreach (var qualificationSelection in qualifications)
            {
                QualificationsList.Add(qualificationSelection);
            }

            foreach (var item in SelectedCandidate.CandidateQualifications)
            {
                var toRemove =
                    QualificationsList.FirstOrDefault(c => c.Model.QualificationId == item.Model.QualificationId);
                QualificationsList.Remove(toRemove);
            }
        }