diff --git a/Gremlin/MVVM/ViewModels/LineItemViewModel.cs b/Gremlin/MVVM/ViewModels/LineItemViewModel.cs index d06bd47..3e59350 100644 --- a/Gremlin/MVVM/ViewModels/LineItemViewModel.cs +++ b/Gremlin/MVVM/ViewModels/LineItemViewModel.cs @@ -19,7 +19,7 @@ namespace Gremlin.MVVM public decimal CalcTotalNet { get; private set; } public decimal ListPrice { get; private set; } - internal static ObservableCollection ReadLineItemsFromClipboard () + internal static ObservableCollection ReadLineItemsFromClipboard() { if (Clipboard.GetText() != "") { diff --git a/Gremlin/MVVM/ViewModels/QuoteViewModel.cs b/Gremlin/MVVM/ViewModels/QuoteViewModel.cs index 612bbe7..5c4b82a 100644 --- a/Gremlin/MVVM/ViewModels/QuoteViewModel.cs +++ b/Gremlin/MVVM/ViewModels/QuoteViewModel.cs @@ -1,6 +1,5 @@ using Caliburn.Micro; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; @@ -10,9 +9,9 @@ namespace Gremlin.MVVM { private string _quoteType = "ein Analysegerät"; private string _quotePath; - private List _lineItemsVM; - private ContactViewModel _recipient; - private ContactViewModel _salesRep; + private ObservableCollection _lineItemsVM = new(); + private ContactViewModel _recipient = new(); + private ContactViewModel _salesRep = new(); private string _quoteNumber; private int _warranty = 12; private int _validity = 60; @@ -41,7 +40,7 @@ namespace Gremlin.MVVM public bool? UseMailTemplate { get => _useMailTemplate; internal set { _useMailTemplate = value; NotifyOfPropertyChange(() => UseMailTemplate); } } public bool? ShowDiscounts { get => _showDiscounts; internal set { _showDiscounts = value; NotifyOfPropertyChange(() => ShowDiscounts); } } - public List LineItemsViewModel { get => _lineItemsVM; internal set { _lineItemsVM = value; NotifyOfPropertyChange(() => LineItemsViewModel); } } + public ObservableCollection LineItemsViewModel { get => _lineItemsVM; internal set { _lineItemsVM = value; NotifyOfPropertyChange(() => LineItemsViewModel); } } public ContactViewModel Recipient { get => _recipient; internal set { _recipient = value; NotifyOfPropertyChange(() => Recipient); } } public ContactViewModel SalesRep { get => _salesRep; internal set { _salesRep = value; NotifyOfPropertyChange(() => SalesRep); } } public decimal TotalListprice { get => _totalListprice; internal set { _totalListprice = value; NotifyOfPropertyChange(() => TotalListprice); } } @@ -137,7 +136,18 @@ namespace Gremlin.MVVM public void GenerateQuoteNumber() { Random random = new(); - QuoteNumber = $"DE-83PE89-{DateTime.Now:My}-{random.Next(999999)}"; + QuoteNumber = SalesRep.LastName switch + { + "Woitschetzki" => $"DE-83PE89-{DateTime.Now:My}-{random.Next(999999)}", + "Welsch" => $"DE-83RE32-{DateTime.Now:My}-{random.Next(999999)}", + _ => $"DE-XXYYXX-{DateTime.Now:My}-{random.Next(999999)}", + }; + } + + + public void ReadLineItems() + { + LineItemsViewModel = LineItemViewModel.ReadLineItemsFromClipboard(); } } } diff --git a/Gremlin/MVVM/ViewModels/ShellViewModel.cs b/Gremlin/MVVM/ViewModels/ShellViewModel.cs index 71afcb4..88da737 100644 --- a/Gremlin/MVVM/ViewModels/ShellViewModel.cs +++ b/Gremlin/MVVM/ViewModels/ShellViewModel.cs @@ -1,16 +1,12 @@ -using System.Collections.Generic; - -namespace Gremlin.MVVM +namespace Gremlin.MVVM { public class ShellViewModel { public QuoteViewModel QuoteVM { get; set; } - public List LineVMs { get; set; } public ShellViewModel() { QuoteVM = new QuoteViewModel(); - LineVMs = QuoteVM.LineItemsViewModel; } } } diff --git a/Gremlin/MVVM/Views/LineItemView.xaml b/Gremlin/MVVM/Views/LineItemView.xaml deleted file mode 100644 index 345ff91..0000000 --- a/Gremlin/MVVM/Views/LineItemView.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - diff --git a/Gremlin/MVVM/Views/LineItemView.xaml.cs b/Gremlin/MVVM/Views/LineItemView.xaml.cs deleted file mode 100644 index 0d1bf1f..0000000 --- a/Gremlin/MVVM/Views/LineItemView.xaml.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Windows.Controls; - -namespace Gremlin.MVVM -{ - public partial class LineItemView : UserControl - { - public LineItemView() - { - InitializeComponent(); - } - } -} diff --git a/Gremlin/MVVM/Views/QuoteView.xaml b/Gremlin/MVVM/Views/QuoteView.xaml index b2a2cf8..f772bff 100644 --- a/Gremlin/MVVM/Views/QuoteView.xaml +++ b/Gremlin/MVVM/Views/QuoteView.xaml @@ -45,7 +45,13 @@ -