Example #1
0
        private void NieuwDocument()
        {
            var validationErrors = "";

            DocumentTypeLabel.Background  = Brushes.Transparent;
            VoorWieLabel.Background       = Brushes.Transparent;
            CorrespondentLabel.Background = Brushes.Transparent;

            // process document
            var documentTypeIdString = DocumentTypeDropdown.SelectedValue?.ToString() ?? "";

            if (string.IsNullOrEmpty(documentTypeIdString))
            {
                validationErrors            += "Document type is verplicht\n";
                DocumentTypeLabel.Background = Brushes.Red;
            }

            var personIdString = VoorWieDropdown.SelectedValue?.ToString() ?? "";

            if (string.IsNullOrEmpty(personIdString))
            {
                validationErrors       += "'Voor wie' is verplicht\n";
                VoorWieLabel.Background = Brushes.Red;
            }

            var correspondentIdString = CorrespondentDropdown.SelectedValue?.ToString() ?? "";

            if (string.IsNullOrEmpty(correspondentIdString))
            {
                validationErrors += "Correspondent is verplicht\n";
                CorrespondentLabel.Background = Brushes.Red;
            }

            if (!string.IsNullOrEmpty(validationErrors))
            {
                ValidationErrorsLabel.Content = validationErrors;
                return;
            }

            var command = new NewScanCommand
            {
                Filename        = FileName,
                DocumentTypeId  = new Guid(documentTypeIdString),
                PersonId        = personIdString,
                CorrespondentId = new Guid(correspondentIdString),
                Datum           = DatumOntvangenDatePicker.SelectedDate ?? DateTime.Today,
                Description     = DescriptionTextbox.Text,
                CustomFields    = customFields
            };

            NewScanHandler.Handle(command);

            Close();
        }
Example #2
0
        private void ScanToevoegenAanBestaandDocument()
        {
            var documentIdString = DocumentsDropdown.SelectedValue?.ToString() ?? "";

            if (string.IsNullOrEmpty(documentIdString))
            {
                DocumentsLabel.Background     = Brushes.Red;
                ValidationErrorsLabel.Content = "Gelieve een document te selecteren";
            }

            var command = new NewScanCommand
            {
                Filename   = FileName,
                DocumentId = new Guid(documentIdString),
            };

            NewScanHandler.Handle(command);

            Close();
        }