예제 #1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            var info = GetCandidateInfo();

            _candidateRepository.Update(info);

            SharedViewLogic.LoadCandidatesTree(_treeView, _candidateRepository);

            if (_dgvCandidates.SelectedRows.Count > 0)
            {
                _dgvCandidates.SelectedRows[0].Tag = info;
            }

            Close();
        }
예제 #2
0
        private void BtnGenerate_Click(object sender, EventArgs e)
        {
            var info = _candidateRepository.Get(_info.FirstName, _info.LastName);

            if (info == null)
            {
                Helper.Logger.Error($"Podaci o kandidatu: {_info.FirstName} {_info.LastName} ne mogu biti nadjeni");
                MessageBox.Show($"Podaci o kandidatu: {_info.FirstName} {_info.LastName} ne mogu biti nadjeni");
                Close();

                return;
            }

            var exam = new ExamInfo
            {
                Id       = Guid.NewGuid().ToString("N"),
                Category = txtCategory.Text.Trim(),
                TakenOn  = dtpTakenOn.Value,
                IncludesTrafficRegulationsTest = chxIncludesTrafficRegulationTest.Checked,
                IncludesFirstAidTest           = chxIncludesFirstAidTest.Checked,
                IncludesDrivingTest            = chxIncludesDrivingTest.Checked,
                Day        = cbxExamDay.SelectedItem.ToString(),
                Location   = txtLocation.Text.Trim(),
                Instructor = _instructorRepository.Get(cbxInstructors.SelectedItem.ToString())
            };

            info.Exams.Add(exam);

            Helper.CreateExamForm(Helper.GetPdfTemplateLocation(), _info, exam);

            _candidateRepository.Update(info);


            SharedViewLogic.LoadCandidatesTree(_treeCandidates, _candidateRepository);

            var selectedNode = _treeCandidates.Nodes.Find(info.LastName.First().ToString(), false).FirstOrDefault();

            SharedViewLogic.LoadCandidatesGrid(_dgvCandidates, selectedNode?.Nodes ?? (IEnumerable)Enumerable.Empty <TreeNode>());
            SharedViewLogic.LoadExamHistory(info.Exams ?? Enumerable.Empty <ExamInfo>(), _dgvExamHistory);

            Close();
        }
        private void ButtonEdit_OnClick(object sender, RoutedEventArgs e)
        {
            var document = DataContext as CandidateInfo;

            _repository.Update(document);
        }