using System; using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; using BeWo.View.Detail; using BeWo.View.Detail.Report; using BeWo.ViewModel; using BS.Shared.DataContracts; namespace BeWo.View.Controls { /// /// Interaction logic for DienstplanerControl.xaml /// public partial class DPCtrlEmployeeTooltip : UserControl { public DPCtrlEmployeeTooltip(EmployeeDC employeeDC, List contractDCs, bool isVertretung) { InitializeComponent(); if(employeeDC != null) { TxtMitarbeiter.Text = employeeDC.LastNameFirstName; var separator = new Separator(); foreach (var contract in contractDCs) { var sep1 = new Separator(); var sep2 = new Separator(); var txtType1 = new TextBlock(); var txtType2 = new TextBlock(); var txtArbeit1 = new TextBlock(); var txtArbeit2 = new TextBlock(); var txtVertretung1 = new TextBlock(); var txtVertretung2 = new TextBlock(); txtType1.Text = "Beschäftigungsart:"; txtType2.Text = $"{contract.EmploymentType?.Name}"; txtArbeit1.Text = "Vereinbarte Regelarbeitszeit:"; if (contract.MonthlyTotalHours != null) { txtArbeit2.Text = $"{contract.MonthlyTotalHours.Value:0.00} Std/Monat"; } else if (contract.WeeklyTotalHours != null) { txtArbeit2.Text = $"{contract.WeeklyTotalHours.Value:0.00} Std/Woche"; } else { txtArbeit2.Text = $"k.A."; } txtVertretung1.Text = "Vertretung:"; txtVertretung2.Text = isVertretung ? "Ja" : "Nein"; RootGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); RootGrid.Children.Add(sep1); Grid.SetRow(sep1, RootGrid.RowDefinitions.Count - 1); Grid.SetColumnSpan(sep1, 3); RootGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); RootGrid.Children.Add(txtType1); RootGrid.Children.Add(txtType2); Grid.SetRow(txtType1, RootGrid.RowDefinitions.Count - 1); Grid.SetRow(txtType2, RootGrid.RowDefinitions.Count - 1); Grid.SetColumn(txtType2, 2); RootGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); RootGrid.Children.Add(txtArbeit1); RootGrid.Children.Add(txtArbeit2); Grid.SetRow(txtArbeit1, RootGrid.RowDefinitions.Count - 1); Grid.SetRow(txtArbeit2, RootGrid.RowDefinitions.Count - 1); Grid.SetColumn(txtArbeit2, 2); RootGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); RootGrid.Children.Add(sep2); Grid.SetRow(sep2, RootGrid.RowDefinitions.Count - 1); Grid.SetColumnSpan(sep2, 3); RootGrid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); RootGrid.Children.Add(txtVertretung1); RootGrid.Children.Add(txtVertretung2); Grid.SetRow(txtVertretung1, RootGrid.RowDefinitions.Count - 1); Grid.SetRow(txtVertretung2, RootGrid.RowDefinitions.Count - 1); Grid.SetColumn(txtVertretung2, 2); } } } } }