added ContactView

pull/1/head
Sascha Woitschetzki 2021-07-09 12:06:14 +07:00
parent 3aa4eb08e5
commit 93aaf2782f
7 changed files with 85 additions and 24 deletions

@ -7,19 +7,32 @@ using System.Text;
using System.Windows.Data;
using Microsoft.EntityFrameworkCore;
using Gremlin.GremlinData.EntityClasses;
using System.Diagnostics;
using Caliburn.Micro;
namespace Gremlin.MVVM
{
public class ContactViewModel : BaseViewModel
public class ContactViewModel : PropertyChangedBase
{
public byte Gender { get; private set; }
public string FirstName { get; private set; }
public string LastName { get; private set; }
public string EMail { get; private set; }
public string AccountName { get; private set; }
public string AccountStreet { get; private set; }
public uint AccountZIP { get; private set; }
public string AccountCity { get; private set; }
private byte _gender;
private string _firstName;
private string _lastName;
private string _eMail;
private string _accountName;
private string _accountStreet;
private uint _accountZIP;
private string _accountCity;
private ObservableCollection<ContactViewModel> _allContactsVM;
public byte Gender { get => _gender; internal set { _gender = value; NotifyOfPropertyChange(() => Gender); } }
public string FirstName { get => _firstName; internal set { _firstName = value; NotifyOfPropertyChange(() => FirstName); } }
public string LastName { get => _lastName; internal set { _lastName = value; NotifyOfPropertyChange(() => LastName); } }
public string EMail { get => _eMail; internal set { _eMail = value; NotifyOfPropertyChange(() => EMail); } }
public string AccountName { get => _accountName; internal set { _accountName = value; NotifyOfPropertyChange(() => AccountName); } }
public string AccountStreet { get => _accountStreet; internal set { _accountStreet = value; NotifyOfPropertyChange(() => AccountStreet); } }
public uint AccountZIP { get => _accountZIP; internal set { _accountZIP = value; NotifyOfPropertyChange(() => AccountZIP); } }
public string AccountCity { get => _accountCity; internal set { _accountCity = value; NotifyOfPropertyChange(() => AccountCity); } }
public ObservableCollection<ContactViewModel> AllContactsVM { get => _allContactsVM; internal set { _allContactsVM = value; NotifyOfPropertyChange(() => AllContactsVM); } }
public ContactViewModel() { }
@ -120,6 +133,11 @@ namespace Gremlin.MVVM
}
}
public void LoadContacts()
{
AllContactsVM = GetAllContactsVM();
}
public static ObservableCollection<ContactViewModel> GetAllContactsVM()
{
try
@ -134,6 +152,7 @@ namespace Gremlin.MVVM
contactsVM.Add(ConvertContactToVM(contact));
}
Debug.WriteLine($"Es wurden {contactsVM.Count} Kontakte geladen.");
return contactsVM;
}
}

@ -3,10 +3,12 @@
public class ShellViewModel
{
public QuoteViewModel QuoteVM { get; set; }
public ContactViewModel ContactVM { get; set; }
public ShellViewModel()
{
QuoteVM = new QuoteViewModel();
QuoteVM = new();
ContactVM = new();
}
}
}

@ -0,0 +1,19 @@
<UserControl x:Class="Gremlin.MVVM.ContactView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0" Grid.Column="0" Height="Auto">
<Button x:Name="LoadContacts" Content="Kontakte laden" Margin="10,5,10,5"/>
</Grid>
<Grid Grid.Row="1" Grid.Column="0" Height="Auto">
<DataGrid x:Name="AllContactsVM" AutoGenerateColumns="True" Height="200" Width ="600" Margin="10,5,10,5" />
</Grid>
</Grid>
</UserControl>

@ -0,0 +1,12 @@
using System.Windows.Controls;
namespace Gremlin.MVVM
{
public partial class ContactView : UserControl
{
public ContactView()
{
InitializeComponent();
}
}
}

@ -1,20 +1,26 @@
<UserControl x:Class="Gremlin.MVVM.QuoteView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Height="Auto">
<!--Recepient-->
<Grid Grid.Row="0" Grid.Column="0" Height="Auto">
<TextBlock x:Name="Recipient" Margin="10,5,10,5" />
</Grid>
<!--QuoteDetails-->
<Grid Grid.Row="0" Grid.Column="1" Height="Auto">
<StackPanel>
<TextBlock x:Name="lblAngebotsname" Text="Angebotsname" Margin="10,5,10,5"/>
<TextBlock x:Name="lblAngebotsnummer" Text="Angebotsnummer" Margin="10,5,10,5"/>
@ -24,7 +30,7 @@
<TextBlock x:Name="lblOppID" Text="SAP Opp ID" Margin="10,5,10,5"/>
</StackPanel>
</Grid>
<Grid Grid.Column="1" Height="Auto">
<Grid Grid.Row="0" Grid.Column="2" Height="Auto">
<StackPanel>
<TextBox x:Name="QuoteType" Margin="10,5,10,5"/>
<TextBox x:Name="QuoteNumber" Margin="10,5,10,5"/>
@ -34,7 +40,7 @@
<TextBox x:Name="OppID" Margin="10,5,10,5"/>
</StackPanel>
</Grid>
<Grid Grid.Column="2" Height="Auto">
<Grid Grid.Row="0" Grid.Column="3" Height="Auto">
<StackPanel>
<CheckBox x:Name="ShowBrutto" Content="Bruttopreise anzeigen" Margin="10,5,10,5"/>
<CheckBox x:Name="SinglePrices" Content="Einzelpreise ausweisen" Margin="10,5,10,5"/>
@ -44,14 +50,16 @@
<CheckBox x:Name="MailTemplate" Content="Mail aus Template erstellen" Margin="10,5,10,5"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="1">
<Grid Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Height="Auto">
<StackPanel>
<Button x:Name="GenerateQuoteNumber" Content="Angebotsnummer generieren"/>
<Button x:Name="ReadLineItems" Content="Angebot aus PriceSurfer einfügen"/>
<Button x:Name="GenerateQuoteNumber" Content="Angebotsnummer generieren" Margin="10,5,10,5"/>
<Button x:Name="ReadLineItems" Content="Angebot aus PriceSurfer einfügen" Margin="10,5,10,5"/>
</StackPanel>
</Grid>
<StackPanel>
<DataGrid x:Name="LineItemsViewModel" AutoGenerateColumns="True" Height="600" Margin="10,5,10,5" />
</StackPanel>
<!--LineItems-->
<Grid Grid.Row="2" Grid.ColumnSpan="4" Height="Auto">
<DataGrid x:Name="LineItemsViewModel" AutoGenerateColumns="True" Height="Auto" Margin="10,5,10,5" />
</Grid>
</Grid>
</UserControl>

@ -4,6 +4,7 @@
xmlns:cal="http://www.caliburnproject.org"
xmlns:local="clr-namespace:Gremlin.MVVM">
<StackPanel Orientation="Vertical">
<local:ContactView cal:Bind.Model="{Binding ContactVM}" />
<local:QuoteView cal:Bind.Model="{Binding QuoteVM}" />
</StackPanel>
</UserControl>

@ -1,6 +1,6 @@
using System.Windows.Controls;
namespace Gremlin.MVVM.Views
namespace Gremlin.MVVM
{
public partial class ShellView : UserControl
{