added ContactView

pull/1/head
Sascha Woitschetzki 2021-07-09 12:06:14 +07:00
parent 683171cb1a
commit 130d32f0e5
7 changed files with 85 additions and 24 deletions

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

@ -3,10 +3,12 @@
public class ShellViewModel public class ShellViewModel
{ {
public QuoteViewModel QuoteVM { get; set; } public QuoteViewModel QuoteVM { get; set; }
public ContactViewModel ContactVM { get; set; }
public ShellViewModel() 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" <UserControl x:Class="Gremlin.MVVM.QuoteView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 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">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> </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> <StackPanel>
<TextBlock x:Name="lblAngebotsname" Text="Angebotsname" Margin="10,5,10,5"/> <TextBlock x:Name="lblAngebotsname" Text="Angebotsname" Margin="10,5,10,5"/>
<TextBlock x:Name="lblAngebotsnummer" Text="Angebotsnummer" 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"/> <TextBlock x:Name="lblOppID" Text="SAP Opp ID" Margin="10,5,10,5"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Grid.Column="1" Height="Auto"> <Grid Grid.Row="0" Grid.Column="2" Height="Auto">
<StackPanel> <StackPanel>
<TextBox x:Name="QuoteType" Margin="10,5,10,5"/> <TextBox x:Name="QuoteType" Margin="10,5,10,5"/>
<TextBox x:Name="QuoteNumber" 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"/> <TextBox x:Name="OppID" Margin="10,5,10,5"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Grid.Column="2" Height="Auto"> <Grid Grid.Row="0" Grid.Column="3" Height="Auto">
<StackPanel> <StackPanel>
<CheckBox x:Name="ShowBrutto" Content="Bruttopreise anzeigen" Margin="10,5,10,5"/> <CheckBox x:Name="ShowBrutto" Content="Bruttopreise anzeigen" Margin="10,5,10,5"/>
<CheckBox x:Name="SinglePrices" Content="Einzelpreise ausweisen" 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"/> <CheckBox x:Name="MailTemplate" Content="Mail aus Template erstellen" Margin="10,5,10,5"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
<Grid Grid.Row="1" Grid.Column="1"> <Grid Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Height="Auto">
<StackPanel> <StackPanel>
<Button x:Name="GenerateQuoteNumber" Content="Angebotsnummer generieren"/> <Button x:Name="GenerateQuoteNumber" Content="Angebotsnummer generieren" Margin="10,5,10,5"/>
<Button x:Name="ReadLineItems" Content="Angebot aus PriceSurfer einfügen"/> <Button x:Name="ReadLineItems" Content="Angebot aus PriceSurfer einfügen" Margin="10,5,10,5"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
<StackPanel>
<DataGrid x:Name="LineItemsViewModel" AutoGenerateColumns="True" Height="600" Margin="10,5,10,5" /> <!--LineItems-->
</StackPanel> <Grid Grid.Row="2" Grid.ColumnSpan="4" Height="Auto">
<DataGrid x:Name="LineItemsViewModel" AutoGenerateColumns="True" Height="Auto" Margin="10,5,10,5" />
</Grid>
</Grid> </Grid>
</UserControl> </UserControl>

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

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