|
|
|
@ -6,7 +6,6 @@ using Microsoft.EntityFrameworkCore;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Collections.ObjectModel;
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Gremlin.MVVM
|
|
|
|
namespace Gremlin.MVVM
|
|
|
|
@ -18,6 +17,9 @@ namespace Gremlin.MVVM
|
|
|
|
private ObservableCollection<ContactViewModel> contacts;
|
|
|
|
private ObservableCollection<ContactViewModel> contacts;
|
|
|
|
private QuoteViewModel quoteVM;
|
|
|
|
private QuoteViewModel quoteVM;
|
|
|
|
private string searchContact;
|
|
|
|
private string searchContact;
|
|
|
|
|
|
|
|
private bool quoteReady;
|
|
|
|
|
|
|
|
private bool texCreated;
|
|
|
|
|
|
|
|
private bool pdfCreated;
|
|
|
|
|
|
|
|
|
|
|
|
public string SearchContact {
|
|
|
|
public string SearchContact {
|
|
|
|
get => searchContact;
|
|
|
|
get => searchContact;
|
|
|
|
@ -25,42 +27,18 @@ namespace Gremlin.MVVM
|
|
|
|
searchContact = value;
|
|
|
|
searchContact = value;
|
|
|
|
NotifyOfPropertyChange(() => SearchContact);
|
|
|
|
NotifyOfPropertyChange(() => SearchContact);
|
|
|
|
Contacts = GetContactsVM(searchContact);
|
|
|
|
Contacts = GetContactsVM(searchContact);
|
|
|
|
|
|
|
|
QuoteReady = CheckQuoteReady();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public ContactViewModel ContactVM {
|
|
|
|
public ContactViewModel ContactVM { get => contactVM; set { contactVM = value; NotifyOfPropertyChange(() => ContactVM); } }
|
|
|
|
get => contactVM;
|
|
|
|
public QuoteViewModel QuoteVM { get => quoteVM; set { quoteVM = value; NotifyOfPropertyChange(() => QuoteVM); QuoteReady = CheckQuoteReady(); } }
|
|
|
|
set {
|
|
|
|
|
|
|
|
contactVM = value;
|
|
|
|
|
|
|
|
NotifyOfPropertyChange(() => ContactVM);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public QuoteViewModel QuoteVM {
|
|
|
|
|
|
|
|
get => quoteVM;
|
|
|
|
|
|
|
|
set {
|
|
|
|
|
|
|
|
quoteVM = value;
|
|
|
|
|
|
|
|
NotifyOfPropertyChange(() => QuoteVM);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ContactViewModel SelectedContact {
|
|
|
|
public ContactViewModel SelectedContact { get => selectedContact; set { selectedContact = value; NotifyOfPropertyChange(() => SelectedContact); QuoteVM.Recipient = value; NotifyOfPropertyChange(() => QuoteVM.Recipient); } }
|
|
|
|
get => selectedContact;
|
|
|
|
public ObservableCollection<ContactViewModel> Contacts { get => contacts; set { contacts = value; NotifyOfPropertyChange(() => Contacts); } }
|
|
|
|
set {
|
|
|
|
public bool QuoteReady { get => quoteReady; set { quoteReady = value; NotifyOfPropertyChange(() => QuoteReady); } }
|
|
|
|
selectedContact = value;
|
|
|
|
public bool TexCreated { get => texCreated; set { texCreated = value; NotifyOfPropertyChange(() => TexCreated); } }
|
|
|
|
NotifyOfPropertyChange(() => SelectedContact);
|
|
|
|
public bool PDFCreated { get => pdfCreated; set { pdfCreated = value; NotifyOfPropertyChange(() => PDFCreated); } }
|
|
|
|
QuoteVM.Recipient = value;
|
|
|
|
|
|
|
|
NotifyOfPropertyChange(() => QuoteVM.Recipient);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<ContactViewModel> Contacts {
|
|
|
|
|
|
|
|
get => contacts;
|
|
|
|
|
|
|
|
set {
|
|
|
|
|
|
|
|
contacts = value;
|
|
|
|
|
|
|
|
NotifyOfPropertyChange(() => Contacts);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ShellViewModel()
|
|
|
|
public ShellViewModel()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -97,15 +75,36 @@ namespace Gremlin.MVVM
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private bool CheckQuoteReady()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return QuoteVM.LineItemsVM.Count != 0 && QuoteVM.Recipient.LastName != "lastName";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void CreateTex()
|
|
|
|
public void CreateTex()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TexHandler.CreateTexAndOpen(QuoteVM);
|
|
|
|
if (QuoteVM.LineItemsVM.Count == 0)
|
|
|
|
Debug.WriteLine(quoteVM.TotalListprice);
|
|
|
|
{
|
|
|
|
|
|
|
|
ErrorHandler.ShowErrorMessage("Das Angebot enthält keine LineItems.\nBitte zuerst ein Angebot einfügen.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (QuoteVM.Recipient.LastName != "lastName")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int texFileLength = TexHandler.CreateTexAndOpen(QuoteVM);
|
|
|
|
|
|
|
|
ErrorHandler.ShowInfoMessage($"Es wurde ein texFile mit {texFileLength} Zeichen erstellt.");
|
|
|
|
|
|
|
|
TexCreated = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ErrorHandler.ShowErrorMessage("Bitte wähle zuerst einen Kunden aus!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void CreatePDF()
|
|
|
|
public void CreatePDF()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PDFHandler.CreatePDF(QuoteVM);
|
|
|
|
PDFCreated = PDFHandler.CreatePDF(QuoteVM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void OpenPDF()
|
|
|
|
public void OpenPDF()
|
|
|
|
|