edit forms

This commit is contained in:
Strati 2018-08-19 15:58:02 +02:00
parent 4df43fde54
commit 7a35ec3b98
4 changed files with 33 additions and 8 deletions

View File

@ -18,16 +18,20 @@
<ColumnDefinition Width="455*"/>
</Grid.ColumnDefinitions>
<Label Content="Add new exam" HorizontalAlignment="Left" VerticalAlignment="Top" Height="45" Width="433" FontFamily="Tahoma" FontSize="24" Margin="0.4,-3,0,0" Grid.Column="1" Grid.RowSpan="2"/>
<Label Content="Date" Margin="0,115.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Description" Margin="0,163.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="44" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Date of &#xD;&#xA;consultation" Margin="0,115.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="77" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Description" Margin="0,391.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="44" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Patient" Margin="0,23.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontSize="24" FontFamily="Tahoma" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtDescription" HorizontalAlignment="Left" Height="34" Margin="137,163.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtDescription" HorizontalAlignment="Left" Height="69" Margin="137,391.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxPatients" HorizontalAlignment="Left" Margin="0.4,23.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.Column="1"/>
<ComboBox x:Name="ComboBoxStrains" HorizontalAlignment="Left" Margin="0.4,212.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.Column="1" Height="34"/>
<Label Content="Strain" Margin="0,212.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="41" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxStrains" HorizontalAlignment="Left" Margin="137,206.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.ColumnSpan="2"/>
<Label Content="Strain" Margin="0,199.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="41" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Doctor" Margin="0,68.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontSize="24" FontFamily="Tahoma" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxDoctors" HorizontalAlignment="Left" Margin="0.4,68.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.Column="1"/>
<DatePicker x:Name="dateboxExamDate" HorizontalAlignment="Left" Margin="137,115.4,0,0" Grid.Row="1" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="433" Height="34"/>
<Button x:Name="btnAddExam" Content="ADD EXAM" HorizontalAlignment="Left" Margin="136,371.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Click="btnAddFoodPlace_Click" Grid.ColumnSpan="2" Height="44" FontSize="20"/>
<DatePicker x:Name="dateboxExamDate" HorizontalAlignment="Left" Margin="137,115.4,0,0" Grid.Row="1" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="433" Height="77"/>
<Button x:Name="btnAddExam" Content="ADD EXAM" HorizontalAlignment="Left" Margin="137,479.4,0,-0.2" Grid.Row="1" VerticalAlignment="Top" Width="433" Click="btnAddFoodPlace_Click" Grid.ColumnSpan="2" Height="44" FontSize="20"/>
<Label Content="Foodplace" Margin="0,251.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="44" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Date at&#xD;&#xA;foodplace" Margin="0,300.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="77" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<DatePicker x:Name="dateboxFoodplaceDate" HorizontalAlignment="Left" Margin="137,300.4,0,0" Grid.Row="1" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="433" Height="77"/>
<ComboBox x:Name="ComboBoxFoodPlace" HorizontalAlignment="Left" Margin="137,256.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.ColumnSpan="2"/>
</Grid>
</Page>

View File

@ -48,6 +48,13 @@ namespace WpfWebClient
ComboBoxStrains.ItemsSource = strainlist;
ComboBoxStrains.DisplayMemberPath = "Name";
// Retrieve all foodplaces and save them into "fplist"
List<WpfWebClient.ServiceReferenceEHEC.FoodPlace> fplist = new List<ServiceReferenceEHEC.FoodPlace>(client.GetFoodPlaces());
// Display all foodplaces with name in Combobox
ComboBoxFoodPlace.ItemsSource = fplist;
ComboBoxFoodPlace.DisplayMemberPath = "Name";
client.Close();
}
@ -65,6 +72,17 @@ namespace WpfWebClient
client.WriteExam(exam);
PatientAtFoodPlace patf = new PatientAtFoodPlace();
patf.FoodPlace = (FoodPlace)ComboBoxFoodPlace.SelectedValue;
patf.Patient = (Person)ComboBoxPatients.SelectedValue;
patf.PatientID = ComboBoxPatients.SelectedIndex;
patf.VistingDate = dateboxFoodplaceDate.SelectedDate.Value;
client.WriteRelation(patf);
// Show success msgbox
System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);

View File

@ -33,6 +33,7 @@ namespace WpfWebClient
// Display all cities with name in Combobox
ComboBoxFPCities.ItemsSource = citylist;
ComboBoxFPCities.DisplayMemberPath = "Name";
}
private void btnAddFoodPlace_Click(object sender, RoutedEventArgs e)
@ -43,9 +44,10 @@ namespace WpfWebClient
FoodPlace fp = new FoodPlace();
fp.Name = txtFoodPlaceName.Text;
fp.Streetname = txtFoodPlaceStreetName.Text;
fp.Streetnumber = txtFoodPlaceHouseNumber.Text;
fp.Name = txtFoodPlaceName.Text;
fp.Description = txtFoodPlaceDescription.Text;
fp.City = (City)ComboBoxFPCities.SelectedValue;

View File

@ -62,6 +62,7 @@
<Compile Include="FoodplaceForm.xaml.cs">
<DependentUpon>FoodplaceForm.xaml</DependentUpon>
</Compile>
<Compile Include="Helper\GenerateTestData.cs" />
<Compile Include="Home.xaml.cs">
<DependentUpon>Home.xaml</DependentUpon>
</Compile>