Ver 1.4.1
This commit is contained in:
@@ -12,6 +12,15 @@ namespace WpfApp1
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Patronymic { get; set; }
|
public string Patronymic { get; set; }
|
||||||
public string Speciality { get; set; }
|
public string Speciality { get; set; }
|
||||||
|
public string ShortFIO
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string n = !string.IsNullOrEmpty(Name) ? $"{Name[0]}." : "";
|
||||||
|
string p = !string.IsNullOrEmpty(Patronymic) ? $"{Patronymic[0]}." : "";
|
||||||
|
return $"{Surname} {n}{p}";
|
||||||
|
}
|
||||||
|
}
|
||||||
public Coach() { }
|
public Coach() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,18 @@
|
|||||||
<TextBox x:Name="txtClientName" IsReadOnly="True" Background="#3D3D3D"/>
|
<TextBox x:Name="txtClientName" IsReadOnly="True" Background="#3D3D3D"/>
|
||||||
|
|
||||||
<TextBlock Text="Специальность" Margin="0,10,0,5"/>
|
<TextBlock Text="Специальность" Margin="0,10,0,5"/>
|
||||||
<ComboBox x:Name="cbSpeciality" SelectionChanged="cbSpeciality_SelectionChanged" DisplayMemberPath="Speciality"/>
|
<ComboBox x:Name="cbSpeciality" SelectionChanged="cbSpeciality_SelectionChanged">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
|
||||||
|
<TextBlock Text="{Binding}" Foreground="White" Padding="2" />
|
||||||
|
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<TextBlock Text="Тренер" Margin="0,10,0,5"/>
|
<TextBlock Text="Тренер" Margin="0,10,0,5"/>
|
||||||
<ComboBox x:Name="cbCoach" DisplayMemberPath="Surname"/>
|
<ComboBox x:Name="cbCoach" DisplayMemberPath="ShortFIO"/>
|
||||||
|
|
||||||
<TextBlock Text="Дата" Margin="0,10,0,5"/>
|
<TextBlock Text="Дата" Margin="0,10,0,5"/>
|
||||||
<DatePicker x:Name="dpDate"/>
|
<DatePicker x:Name="dpDate"/>
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace WpfApp1
|
|||||||
{
|
{
|
||||||
private Client _currentClient;
|
private Client _currentClient;
|
||||||
private List<Coach> _allCoaches = new List<Coach>();
|
private List<Coach> _allCoaches = new List<Coach>();
|
||||||
private const string CoachesFilePath = "Data/coaches.json";
|
private const string CoachesFilePath = "C:\\Users\\student1\\source\\repos\\UP01TASK2\\WpfApp1\\WpfApp1\\Data\\coaches.json";
|
||||||
|
|
||||||
private void LoadCoachesData()
|
private void LoadCoachesData()
|
||||||
{
|
{
|
||||||
@@ -34,9 +34,8 @@ namespace WpfApp1
|
|||||||
|
|
||||||
_allCoaches = JsonSerializer.Deserialize<List<Coach>>(json, options) ?? new List<Coach>();
|
_allCoaches = JsonSerializer.Deserialize<List<Coach>>(json, options) ?? new List<Coach>();
|
||||||
|
|
||||||
// Заполняем ComboBox специальностей
|
|
||||||
cbSpeciality.ItemsSource = _allCoaches
|
cbSpeciality.ItemsSource = _allCoaches
|
||||||
.Select(c => c.Speciality)
|
.Select(c => c.Speciality )
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user