To Be Continued

main
itjustworks1 2026-04-22 14:25:28 +10:00
parent cca23316cc
commit 114de77f0d
11 changed files with 25 additions and 9 deletions

View File

@ -113,5 +113,9 @@ public partial class EmployeeEditingWindowViewModel : ViewModelBase
{ {
_currentWindow = window; _currentWindow = window;
_currentWindow.ConfirmButton.Content = _isEditing ? "Изменить" : "Добавить"; _currentWindow.ConfirmButton.Content = _isEditing ? "Изменить" : "Добавить";
if (_isEditing)
{
}
} }
} }

View File

@ -72,10 +72,6 @@ public partial class EquipmentEditingWindowViewModel : ViewModelBase
_equipment = _equipmentVisualFactory.CreateFromEquipment(equipment); _equipment = _equipmentVisualFactory.CreateFromEquipment(equipment);
_equipment.CurrentEmployee = repo.GetById(equipment.CurrentEmployeeId); _equipment.CurrentEmployee = repo.GetById(equipment.CurrentEmployeeId);
} }
using (var repo = _serviceProvider.GetService<EmployeeRepository>())
{
Employees = new ObservableCollection<Employee>(repo.GetAll());
}
if (_isEditing) if (_isEditing)
{ {
@ -84,10 +80,17 @@ public partial class EquipmentEditingWindowViewModel : ViewModelBase
Date = _equipment.Date; Date = _equipment.Date;
Cost = _equipment.Cost; Cost = _equipment.Cost;
IsWrittenOff = _equipment.IsWrittenOff; IsWrittenOff = _equipment.IsWrittenOff;
CurrentEmployee = Employees.FirstOrDefault(o => o.Id == equipment.CurrentEmployeeId); CurrentEmployee = _equipment.CurrentEmployee;
Employees = new ObservableCollection<Employee>();
Employees.Add(CurrentEmployee);
} }
else else
{ {
using (var repo = _serviceProvider.GetService<EmployeeRepository>())
{
Employees = new ObservableCollection<Employee>(repo.GetAll());
}
CurrentEmployee = Employees[0]; CurrentEmployee = Employees[0];
Date = DateTimeOffset.Now; Date = DateTimeOffset.Now;
} }
@ -96,5 +99,13 @@ public partial class EquipmentEditingWindowViewModel : ViewModelBase
{ {
_currentWindow = window; _currentWindow = window;
_currentWindow.OkButton.Content = _isEditing ? "Изменить" : "Добавить"; _currentWindow.OkButton.Content = _isEditing ? "Изменить" : "Добавить";
if (_isEditing)
{
_currentWindow.CurrentEmployeeBox.IsVisible = false;
}
else
{
_currentWindow.CurrentEmployeeLabel.IsVisible = false;
}
} }
} }

View File

@ -38,13 +38,14 @@
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Label Content="Текущий ответственный: "></Label> <Label Content="Текущий ответственный: "></Label>
<ComboBox ItemsSource="{Binding Employees}" SelectedItem="{Binding CurrentEmployee}"> <ComboBox x:Name="CurrentEmployeeBox" ItemsSource="{Binding Employees}" SelectedItem="{Binding CurrentEmployee}">
<ComboBox.ItemTemplate> <ComboBox.ItemTemplate>
<DataTemplate> <DataTemplate>
<Label Content="{Binding FullName}"></Label> <Label Content="{Binding FullName}"></Label>
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>
</ComboBox> </ComboBox>
<Label x:Name="CurrentEmployeeLabel" Content="{Binding CurrentEmployee.FullName}"></Label>
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("AvaloniaApplication14_Inventory_300326")] [assembly: System.Reflection.AssemblyCompanyAttribute("AvaloniaApplication14_Inventory_300326")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+70111810c1836182b0f37d93a7e8b2e96bbb6f90")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cca23316ccaf6ff854c560608fe74ea070bdd85a")]
[assembly: System.Reflection.AssemblyProductAttribute("AvaloniaApplication14_Inventory_300326")] [assembly: System.Reflection.AssemblyProductAttribute("AvaloniaApplication14_Inventory_300326")]
[assembly: System.Reflection.AssemblyTitleAttribute("AvaloniaApplication14_Inventory_300326")] [assembly: System.Reflection.AssemblyTitleAttribute("AvaloniaApplication14_Inventory_300326")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
9dbe6ffb36df0983dc0fb68e296275034be5aec8e886a3b04e3c9808d6290db8 63e3e38dd183c9ac63856099ca701d49eeb37cffc3fb48b85df28a550d81ee4f

View File

@ -1 +1 @@
17763141913838317 17763836796197075