private void NewInvoice()
        {
            if (Validator.ValidateAll().IsValid)
            {
                if (order.Id == 0)
                {
                    order = UnitOfWork.Orders.Add(order);
                }

                var vm = new InvoiceCreationViewModel(new UnitOfWorkFactory());
                vm.Init();
                var windowView = new InvoiceCreationView(vm);

                if (windowView.ShowDialog() ?? false)
                {
                    var    invoiceNumber = vm.InvoiceNumber;
                    var    amount        = double.Parse(vm.Amount);
                    string fileName;
                    try
                    {
                        fileName = FileAccess.CreateDocumentFromTemplate(order.Customer, invoiceNumber, Properties.Settings.Default.InvoiceTemplatePath);
                    }
                    catch (Win32Exception)
                    {
                        MessageBox.Show("Das Dokument konnte nicht erstellt werden. Eventuell haben Sie die Vorlage noch geöffnet.", "Ein Fehler ist aufgetreten");
                        return;
                    }

                    var document = new Document
                    {
                        IssueDate    = DateTime.Now,
                        Name         = invoiceNumber,
                        Tag          = "Rechnung",
                        RelativePath = fileName
                    };

                    document = UnitOfWork.Documents.Add(document);

                    var invoice = new Invoice
                    {
                        Amount        = amount,
                        InvoiceNumber = invoiceNumber,
                        IsPaid        = false,
                        Order         = order,
                        Document      = document
                    };

                    invoice = UnitOfWork.Invoices.Add(invoice);

                    UnitOfWork.Complete();

                    InvoiceList.Add(invoice);

                    if (vm.OpenAfterSave ?? false)
                    {
                        Open(fileName);
                    }
                }
            }
        }
        private void NewOrderConfirmation()
        {
            if (Validator.ValidateAll().IsValid)
            {
                if (order.Id == 0)
                {
                    order = UnitOfWork.Orders.Add(order);
                }

                var vm = new OrderConfirmationCreationViewModel(new UnitOfWorkFactory());
                vm.Init();
                var windowView = new OrderConfirmationCreationView(vm);

                if (windowView.ShowDialog() ?? false)
                {
                    var    orderConfNumber = vm.OrderConfNumber;
                    string fileName;

                    try
                    {
                        fileName = FileAccess.CreateDocumentFromTemplate(order.Customer, orderConfNumber, Properties.Settings.Default.ConfirmationTemplatePath);
                    }
                    catch (Win32Exception)
                    {
                        MessageBox.Show("Das Dokument konnte nicht erstellt werden. Eventuell haben Sie die Vorlage noch geöffnet.", "Ein Fehler ist aufgetreten");
                        return;
                    }

                    var document = new Document
                    {
                        IssueDate    = DateTime.Now,
                        Name         = orderConfNumber,
                        Tag          = "Auftragsbestätigung",
                        RelativePath = fileName
                    };

                    document = UnitOfWork.Documents.Add(document);

                    var orderConfirmation = new OrderConfirmation
                    {
                        OrderConfNumber = orderConfNumber,
                        Order           = order,
                        Document        = document
                    };

                    orderConfirmation = UnitOfWork.OrderConfirmations.Add(orderConfirmation);

                    UnitOfWork.Complete();

                    OrderConfirmationList.Add(orderConfirmation);
                    OnPropertyChanged(nameof(OrderConfToolTip));

                    if (vm.OpenAfterSave ?? false)
                    {
                        Open(fileName);
                    }
                }
            }
        }