add logic to the customer form

This commit is contained in:
Andreas Zweili 2018-08-30 22:01:57 +02:00
parent 9a05c51473
commit 64b93b8655
2 changed files with 30 additions and 3 deletions

View File

@ -13,7 +13,7 @@
<TextBox x:Name="TextBoxLastName" HorizontalAlignment="Left" Height="23" Margin="111,164,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="TextBoxStreetnumber" HorizontalAlignment="Left" Height="23" Margin="111,244,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<TextBox x:Name="TextBoxStreename" HorizontalAlignment="Left" Height="23" Margin="111,203,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>
<Button Content="Save" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" RenderTransformOrigin="2.21,19.718" Margin="111,322,0,0"/>
<Button Content="Save" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" RenderTransformOrigin="2.21,19.718" Margin="111,322,0,0" Click="Button_Click"/>
<ComboBox x:Name="DropDownCity" HorizontalAlignment="Left" Margin="111,281,0,0" VerticalAlignment="Top" Width="120"/>
<Label Content="Salutation" HorizontalAlignment="Left" Margin="24,24,0,0" VerticalAlignment="Top"/>
<Label Content="Gender" HorizontalAlignment="Left" Margin="24,67,0,0" VerticalAlignment="Top"/>

View File

@ -20,15 +20,42 @@ namespace WPFClient
/// </summary>
public partial class CustomerDetails : Window
{
public Person person { get; set; }
public Person Person { get; set; }
public List<City> Cities { get; set; }
public List<Gender> Genders { get; set; }
public List<Salutation> Salutations { get; set; }
public CustomerDetails()
{
InitializeComponent();
PlattformServiceClient client = new PlattformServiceClient();
// get the data from the service
this.Genders = client.GetGenders();
this.Salutations = client.GetSalutations();
this.Cities = client.GetCities();
// populate the dropdowns
this.DropDownCity.ItemSource = this.Cities;
this.DropDownCity.DisplayMemberPath = "Name";
this.DropDownGender.ItemSource = this.Genders;
this.DropDownGender.DisplayMemberPath = "Name";
this.DropDownSalutation.ItemSource = this.Salutations;
this.DropDownSalutation.DisplayMemberPath = "Name";
client.Close();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Person person = new Person();
person.Gender = (Gender)DropDownGender.SelectedValue;
person.Salutation = (Salutation)DropDownSalutation.SelectedValue;
person.City = (City)DropDownCity.SelectedValue;
person.FirstName = TextBoxFirstName.Text;
person.LastName = TextBoxLastName.Text;
person.Streetname = TextBoxStreetname.Text;
person.Streenumber = TextBoxStreetnumber.Text;
this.person = person;
}
}
}