Compare commits
No commits in common. "69e11179169a76d62cd0fe7694460e08d81c7480" and "780c9aad7c6af2565938cf22ec4549263f45beda" have entirely different histories.
69e1117916
...
780c9aad7c
|
|
@ -7,7 +7,6 @@
|
|||
<entry key="AvaloniaApplication14_Inventory_300326/Views/EmployeeEditingWindow.axaml" value="AvaloniaApplication14_Inventory_300326/AvaloniaApplication14_Inventory_300326.csproj" />
|
||||
<entry key="AvaloniaApplication14_Inventory_300326/Views/EquipmentEditingWindow.axaml" value="AvaloniaApplication14_Inventory_300326/AvaloniaApplication14_Inventory_300326.csproj" />
|
||||
<entry key="AvaloniaApplication14_Inventory_300326/Views/MainWindow.axaml" value="AvaloniaApplication14_Inventory_300326/AvaloniaApplication14_Inventory_300326.csproj" />
|
||||
<entry key="AvaloniaApplication14_Inventory_300326/Views/PositionEditingWindow.axaml" value="AvaloniaApplication14_Inventory_300326/AvaloniaApplication14_Inventory_300326.csproj" />
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
namespace AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||
|
||||
public class EmployeesFactory
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||
|
||||
namespace AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||
|
||||
public static class EmployeesVisualFactory
|
||||
{
|
||||
public static EmployeeVisual CreateFromEmployee(Employee employee)
|
||||
{
|
||||
var result = new EmployeeVisual();
|
||||
result.Id = employee.Id;
|
||||
result.FullName = employee.FullName;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||
|
||||
namespace AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||
|
||||
public static class EquipmentFactory
|
||||
{
|
||||
public static Equipment CreateFromVisual(EquipmentVisual visual)
|
||||
{
|
||||
var result = new Equipment();
|
||||
|
||||
result.InvNumber = visual.InvNumber;
|
||||
result.Name = visual.Name;
|
||||
result.Date = DateOnly.FromDateTime(visual.Date.Value.DateTime);
|
||||
result.Cost = visual.Cost;
|
||||
result.IsWrittenOff = visual.IsWrittenOff != "Нет";
|
||||
result.CurrentEmployeeId = visual.CurrentEmployee.Id;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
using System;
|
||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||
|
||||
namespace AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||
|
||||
public static class EquipmentVisualFactory
|
||||
{
|
||||
public static EquipmentVisual CreateFromEquipment(Equipment equipment)
|
||||
{
|
||||
var result = new EquipmentVisual();
|
||||
|
||||
result.Id = equipment.Id;
|
||||
result.InvNumber = equipment.InvNumber;
|
||||
result.Name = equipment.Name;
|
||||
result.Date = new DateTimeOffset(equipment.Date.ToDateTime(TimeOnly.MinValue));
|
||||
result.Cost = equipment.Cost;
|
||||
result.IsWrittenOff = equipment.IsWrittenOff?"Да":"Нет";
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,4 +6,9 @@ public class EmployeeVisual
|
|||
public string FullName { get; set; }
|
||||
public Position Position { get; set; }
|
||||
|
||||
public void CreateFromEmployee(Employee employee)
|
||||
{
|
||||
Id = employee.Id;
|
||||
FullName = employee.FullName;
|
||||
}
|
||||
}
|
||||
|
|
@ -10,5 +10,4 @@ public class Equipment : DBObj
|
|||
public decimal Cost { get; set; }
|
||||
public bool IsWrittenOff {get; set;}
|
||||
public int CurrentEmployeeId { get; set; }
|
||||
|
||||
}
|
||||
|
|
@ -7,9 +7,18 @@ public class EquipmentVisual
|
|||
public int Id { get; set; }
|
||||
public string InvNumber { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTimeOffset? Date { get; set; }
|
||||
public DateOnly Date { get; set; }
|
||||
public decimal Cost { get; set; }
|
||||
public string IsWrittenOff {get; set;}
|
||||
public Employee CurrentEmployee { get; set; }
|
||||
|
||||
public void CreateFromEquipment(Equipment equipment)
|
||||
{
|
||||
Id = equipment.Id;
|
||||
InvNumber = equipment.InvNumber;
|
||||
Name = equipment.Name;
|
||||
Date = equipment.Date;
|
||||
Cost = equipment.Cost;
|
||||
IsWrittenOff = equipment.IsWrittenOff?"Да":"Нет";
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@ sealed class Program
|
|||
service.AddTransient<EmployeeRepository>();
|
||||
service.AddTransient<EquipmentRepository>();
|
||||
service.AddTransient<PositionRepository>();
|
||||
service.AddTransient<EquipmentEditingWindow>();
|
||||
|
||||
}).Build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,29 +1,6 @@
|
|||
using AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||
using AvaloniaApplication14_Inventory_300326.Views;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace AvaloniaApplication14_Inventory_300326.ViewModels;
|
||||
|
||||
public partial class EquipmentEditingWindowViewModel : ViewModelBase
|
||||
public class EquipmentEditingWindowViewModel : ViewModelBase
|
||||
{
|
||||
private EquipmentEditingWindow _currentWindow;
|
||||
[ObservableProperty] private EquipmentVisual _equipment;
|
||||
|
||||
public EquipmentEditingWindowViewModel(Equipment equipment)
|
||||
{
|
||||
Equipment = EquipmentVisualFactory.CreateFromEquipment(equipment);
|
||||
}
|
||||
public void SetWindow(EquipmentEditingWindow window)
|
||||
{
|
||||
_currentWindow = window;
|
||||
if (Equipment == EquipmentVisualFactory.CreateFromEquipment(new Equipment()))
|
||||
{
|
||||
_currentWindow.OkButton.Content = "Изменить";
|
||||
}
|
||||
else
|
||||
{
|
||||
_currentWindow.OkButton.Content = "Добавить";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,7 +8,6 @@ using Avalonia.Data;
|
|||
using Avalonia.Input;
|
||||
using Avalonia.LogicalTree;
|
||||
using AvaloniaApplication14_Inventory_300326.Models.DataBase;
|
||||
using AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||
using AvaloniaApplication14_Inventory_300326.Views;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
|
@ -137,9 +136,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||
|
||||
private void DoubleTappedTechDataGrid()
|
||||
{
|
||||
var vm = ActivatorUtilities.CreateInstance<EquipmentEditingWindowViewModel>(_serviceProvider, EquipmentFactory.CreateFromVisual(SelectedEquipmentVisual));
|
||||
var win = ActivatorUtilities.CreateInstance<EquipmentEditingWindow>(_serviceProvider, vm);
|
||||
win.ShowDialog(_currentWindow);
|
||||
Console.WriteLine("DoubleTappedTechDataGrid");
|
||||
}
|
||||
|
||||
private void DoubleTappedEmployeeDataGrid()
|
||||
|
|
@ -160,7 +157,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||
EquipmentVisual eq = new EquipmentVisual();
|
||||
using (var empRepo = _serviceProvider.GetRequiredService<EmployeeRepository>())
|
||||
{
|
||||
eq = EquipmentVisualFactory.CreateFromEquipment(item);
|
||||
eq.CreateFromEquipment(item);
|
||||
eq.CurrentEmployee = empRepo.GetById(item.CurrentEmployeeId);
|
||||
}
|
||||
result.Add(eq);
|
||||
|
|
@ -176,7 +173,7 @@ public partial class MainWindowViewModel : ViewModelBase
|
|||
EmployeeVisual eve = new EmployeeVisual();
|
||||
using (var posRepo = _serviceProvider.GetRequiredService<PositionRepository>())
|
||||
{
|
||||
eve = EmployeesVisualFactory.CreateFromEmployee(item);
|
||||
eve.CreateFromEmployee(item);
|
||||
eve.Position = posRepo.GetById(item.PositionId);
|
||||
}
|
||||
result.Add(eve);
|
||||
|
|
|
|||
|
|
@ -2,46 +2,8 @@
|
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:vm="using:AvaloniaApplication14_Inventory_300326.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="AvaloniaApplication14_Inventory_300326.Views.EquipmentEditingWindow"
|
||||
x:DataType="vm:EquipmentEditingWindowViewModel"
|
||||
Title="EquipmentEditingWindow">
|
||||
<StackPanel HorizontalAlignment="Left">
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Инвентарный номер: "></Label>
|
||||
<TextBox Text="{Binding Equipment.InvNumber}"></TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Название: "></Label>
|
||||
<TextBox Text="{Binding Equipment.Name}"></TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Дата приобретения: "></Label>
|
||||
<DatePicker SelectedDate="{Binding Equipment.Date}"></DatePicker>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Цена: "></Label>
|
||||
<TextBox></TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Списано ли: "></Label>
|
||||
<TextBox></TextBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Label Content="Текущий ответственный: "></Label>
|
||||
<ComboBox></ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button x:Name="OkButton"></Button>
|
||||
<Button Content="Отменить"></Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using AvaloniaApplication14_Inventory_300326.ViewModels;
|
||||
|
||||
namespace AvaloniaApplication14_Inventory_300326.Views;
|
||||
|
||||
public partial class EquipmentEditingWindow : Window
|
||||
{
|
||||
public EquipmentEditingWindow(EquipmentEditingWindowViewModel viewModel)
|
||||
public EquipmentEditingWindow()
|
||||
{
|
||||
DataContext = viewModel;
|
||||
InitializeComponent();
|
||||
viewModel.SetWindow(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
<Button Content="Добавить" Margin="10,0,0,0"></Button>
|
||||
</StackPanel>
|
||||
<ScrollViewer Grid.Row="1" x:Name="ScrollViewerDataGridTech">
|
||||
<DataGrid x:Name="DataGridTech" ItemsSource="{Binding Techs}" SelectedItem="{Binding SelectedEquipmentVisual}" IsReadOnly="True">
|
||||
<DataGrid x:Name="DataGridTech" ItemsSource="{Binding Techs}" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Инвентарный номер" Binding="{Binding InvNumber}"></DataGridTextColumn>
|
||||
<DataGridTextColumn Header="Название" Binding="{Binding Name}"></DataGridTextColumn>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
|||
[assembly: System.Reflection.AssemblyCompanyAttribute("AvaloniaApplication14_Inventory_300326")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+211c219a7b912ccb4d85ae18d8c9a6ea6db420d4")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cbf2b3c1d343b3e775109533b3de5382ddf0d55c")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("AvaloniaApplication14_Inventory_300326")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("AvaloniaApplication14_Inventory_300326")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
454401d59e479b388b4887324f8782d3eb2b2898eabb3e94f09f42fd002f2e16
|
||||
579358abf2419881fdf5be6d074ce09167d36f918fb2742d80f5fe41cf044223
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
5bc4c528ec3f534aa8ca0cf3a075bf3146165660900677036c54b6cf77df99d8
|
||||
bf4cf4167d1af19dcdd79f28d74d6e280f089043cf069c74a3cde874464ff374
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue