Compare commits
No commits in common. "aeb0013a062acd378099c740807360d515c81abe" and "69e11179169a76d62cd0fe7694460e08d81c7480" have entirely different histories.
aeb0013a06
...
69e1117916
|
|
@ -75,39 +75,12 @@ public class EmployeeRepository : BaseRepository<Employee>, IDisposable
|
||||||
|
|
||||||
public override bool Update(Employee item)
|
public override bool Update(Employee item)
|
||||||
{
|
{
|
||||||
string sql = "UPDATE TechInventory.Employees SET FullName=@FullName, PositionId=@PositionId WHERE Id=@Id;";
|
throw new NotImplementedException();
|
||||||
try
|
|
||||||
{
|
|
||||||
using var mc = new MySqlCommand(sql, connection);
|
|
||||||
mc.Parameters.AddWithValue("@Id", item.Id);
|
|
||||||
mc.Parameters.AddWithValue("@FullName", item.FullName);
|
|
||||||
mc.Parameters.AddWithValue("@PositionId", item.PositionId);
|
|
||||||
mc.ExecuteNonQuery();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Add(Employee item)
|
public override bool Add(Employee item)
|
||||||
{
|
{
|
||||||
string sql = "INSERT INTO TechInventory.Employees (FullName, PositionId) VALUES(@FullName, @PositionId);";
|
throw new NotImplementedException();
|
||||||
try
|
|
||||||
{
|
|
||||||
using var mc = new MySqlCommand(sql, connection);
|
|
||||||
mc.Parameters.AddWithValue("@FullName", item.FullName);
|
|
||||||
mc.Parameters.AddWithValue("@PositionId", item.PositionId);
|
|
||||||
mc.ExecuteNonQuery();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
|
||||||
|
|
@ -58,48 +58,11 @@ public class EquipmentRepository : BaseRepository<Equipment>, IDisposable
|
||||||
|
|
||||||
public override bool Update(Equipment item)
|
public override bool Update(Equipment item)
|
||||||
{
|
{
|
||||||
string sql = "UPDATE TechInventory.Equipment SET InvNumber=@InvNum, Name=@Name, PurchaseDate=@Date, Cost=@Cost, IsWrittenOff=@IsWrittenOff, CurrentEmployeeId=@CurrentEmployeeId WHERE Id=@Id;";
|
throw new NotImplementedException();
|
||||||
try
|
|
||||||
{
|
|
||||||
using var mc = new MySqlCommand(sql, connection);
|
|
||||||
mc.Parameters.AddWithValue("@Id", item.Id);
|
|
||||||
mc.Parameters.AddWithValue("@InvNum", item.InvNumber);
|
|
||||||
mc.Parameters.AddWithValue("@Name", item.Name);
|
|
||||||
mc.Parameters.AddWithValue("@Date", item.Date);
|
|
||||||
mc.Parameters.AddWithValue("@Cost", item.Cost);
|
|
||||||
mc.Parameters.AddWithValue("@IsWrittenOff", item.IsWrittenOff?1:0);
|
|
||||||
mc.Parameters.AddWithValue("@CurrentEmployeeId", item.CurrentEmployeeId);
|
|
||||||
mc.ExecuteNonQuery();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Add(Equipment item)
|
public override bool Add(Equipment item)
|
||||||
{
|
{
|
||||||
string sql = "INSERT INTO TechInventory.Equipment (InvNumber, Name, PurchaseDate, Cost, IsWrittenOff, CurrentEmployeeId) VALUES(@InvNum, @Name, @Date, @Cost, @IsWrittenOff, @CurrentEmployeeId)";
|
throw new NotImplementedException();
|
||||||
try
|
|
||||||
{
|
|
||||||
var mc = new MySqlCommand(sql, connection);
|
|
||||||
mc.Parameters.AddWithValue("@InvNum", item.InvNumber);
|
|
||||||
mc.Parameters.AddWithValue("@Name", item.Name);
|
|
||||||
mc.Parameters.AddWithValue("@Date", item.Date);
|
|
||||||
mc.Parameters.AddWithValue("@Cost", item.Cost);
|
|
||||||
mc.Parameters.AddWithValue("@IsWrittenOff", item.IsWrittenOff);
|
|
||||||
mc.Parameters.AddWithValue("@CurrentEmployeeId", item.CurrentEmployeeId);
|
|
||||||
mc.ExecuteNonQuery();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine(e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,15 +1,6 @@
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
namespace AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||||
|
|
||||||
namespace AvaloniaApplication14_Inventory_300326.Models.Factories;
|
public class EmployeesFactory
|
||||||
|
{
|
||||||
|
|
||||||
public static class EmployeesFactory
|
|
||||||
{
|
|
||||||
public static Employee CreateFromEmployeeVisual(EmployeeVisual employee)
|
|
||||||
{
|
|
||||||
Employee newEmployee = new Employee();
|
|
||||||
newEmployee.Id = employee.Id;
|
|
||||||
newEmployee.FullName = employee.FullName;
|
|
||||||
newEmployee.PositionId = employee.Position.Id;
|
|
||||||
return newEmployee;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -13,8 +13,7 @@ public static class EquipmentFactory
|
||||||
result.Name = visual.Name;
|
result.Name = visual.Name;
|
||||||
result.Date = DateOnly.FromDateTime(visual.Date.Value.DateTime);
|
result.Date = DateOnly.FromDateTime(visual.Date.Value.DateTime);
|
||||||
result.Cost = visual.Cost;
|
result.Cost = visual.Cost;
|
||||||
result.IsWrittenOff = visual.IsWrittenOff;
|
result.IsWrittenOff = visual.IsWrittenOff != "Нет";
|
||||||
result.Id = visual.Id;
|
|
||||||
result.CurrentEmployeeId = visual.CurrentEmployee.Id;
|
result.CurrentEmployeeId = visual.CurrentEmployee.Id;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@ public static class EquipmentVisualFactory
|
||||||
result.Name = equipment.Name;
|
result.Name = equipment.Name;
|
||||||
result.Date = new DateTimeOffset(equipment.Date.ToDateTime(TimeOnly.MinValue));
|
result.Date = new DateTimeOffset(equipment.Date.ToDateTime(TimeOnly.MinValue));
|
||||||
result.Cost = equipment.Cost;
|
result.Cost = equipment.Cost;
|
||||||
result.IsWrittenOff = equipment.IsWrittenOff;
|
result.IsWrittenOff = equipment.IsWrittenOff?"Да":"Нет";
|
||||||
result.IsWrittenOffString = equipment.IsWrittenOff ? "Да" : "Нет";
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,6 @@ namespace AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||||
|
|
||||||
public class Employee : DBObj
|
public class Employee : DBObj
|
||||||
{
|
{
|
||||||
public string FullName { get; set; } = "";
|
public string FullName { get; set; }
|
||||||
public int PositionId { get; set; }
|
public int PositionId { get; set; }
|
||||||
|
|
||||||
public bool IsNew()
|
|
||||||
{
|
|
||||||
return FullName == "" && PositionId == 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,23 +4,11 @@ namespace AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||||
|
|
||||||
public class Equipment : DBObj
|
public class Equipment : DBObj
|
||||||
{
|
{
|
||||||
public string InvNumber { get; set; } = "";
|
public string InvNumber { get; set; }
|
||||||
public string Name { get; set; } = "";
|
public string Name { get; set; }
|
||||||
public DateOnly Date { get; set; } = DateOnly.FromDateTime(DateTime.Now);
|
public DateOnly Date { get; set; }
|
||||||
public decimal Cost { get; set; } = 0;
|
public decimal Cost { get; set; }
|
||||||
public bool IsWrittenOff {get; set;} = false;
|
public bool IsWrittenOff {get; set;}
|
||||||
public int CurrentEmployeeId { get; set; } = 0;
|
public int CurrentEmployeeId { get; set; }
|
||||||
|
|
||||||
public bool IsNew()
|
|
||||||
{
|
|
||||||
if (InvNumber == "" && Name == "" && Date == DateOnly.FromDateTime(DateTime.Now) && Cost == 0 && !IsWrittenOff && CurrentEmployeeId == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -9,8 +9,7 @@ public class EquipmentVisual
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public DateTimeOffset? Date { get; set; }
|
public DateTimeOffset? Date { get; set; }
|
||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
public bool IsWrittenOff { get; set; }
|
public string IsWrittenOff { get; set; }
|
||||||
public string IsWrittenOffString { get; set; }
|
|
||||||
public Employee CurrentEmployee { get; set; }
|
public Employee CurrentEmployee { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,66 +1,6 @@
|
||||||
using System;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.DataBase;
|
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
|
||||||
using AvaloniaApplication14_Inventory_300326.Views;
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace AvaloniaApplication14_Inventory_300326.ViewModels;
|
namespace AvaloniaApplication14_Inventory_300326.ViewModels;
|
||||||
|
|
||||||
public partial class EmployeeEditingWindowViewModel : ViewModelBase
|
public class EmployeeEditingWindowViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private EmployeeEditingWindow _currentWindow;
|
|
||||||
private IServiceProvider _serviceProvider;
|
|
||||||
private bool _isEditing;
|
|
||||||
private Employee _employee;
|
|
||||||
|
|
||||||
[ObservableProperty] private string _name;
|
|
||||||
[ObservableProperty] private ObservableCollection<Position> _positions;
|
|
||||||
[ObservableProperty] private Position _selectedPosition;
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Cancel()
|
|
||||||
{
|
|
||||||
_currentWindow.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Confirm()
|
|
||||||
{
|
|
||||||
_employee.FullName = Name;
|
|
||||||
_employee.PositionId = SelectedPosition.Id;
|
|
||||||
using (var repo = _serviceProvider.GetService<EmployeeRepository>())
|
|
||||||
{
|
|
||||||
if (_isEditing)
|
|
||||||
{
|
|
||||||
repo.Update(_employee);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
repo.Add(_employee);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_currentWindow.Close();
|
|
||||||
}
|
|
||||||
public EmployeeEditingWindowViewModel(IServiceProvider serviceProvider, Employee employee)
|
|
||||||
{
|
|
||||||
_isEditing=!employee.IsNew();
|
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
_employee = employee;
|
|
||||||
using (var repo = _serviceProvider.GetService<PositionRepository>())
|
|
||||||
{
|
|
||||||
Positions = new ObservableCollection<Position>(repo.GetAll());
|
|
||||||
}
|
|
||||||
|
|
||||||
Name = employee.FullName;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetScreen(EmployeeEditingWindow window)
|
|
||||||
{
|
|
||||||
_currentWindow = window;
|
|
||||||
_currentWindow.ConfirmButton.Content = _isEditing ? "Изменить" : "Добавить";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,85 +1,29 @@
|
||||||
using System;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.DataBase;
|
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
using AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||||
using AvaloniaApplication14_Inventory_300326.Views;
|
using AvaloniaApplication14_Inventory_300326.Views;
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||||||
using CommunityToolkit.Mvvm.Input;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace AvaloniaApplication14_Inventory_300326.ViewModels;
|
namespace AvaloniaApplication14_Inventory_300326.ViewModels;
|
||||||
|
|
||||||
public partial class EquipmentEditingWindowViewModel : ViewModelBase
|
public partial class EquipmentEditingWindowViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
private EquipmentEditingWindow _currentWindow;
|
private EquipmentEditingWindow _currentWindow;
|
||||||
private bool _isEditing;
|
[ObservableProperty] private EquipmentVisual _equipment;
|
||||||
private EquipmentVisual _equipment;
|
|
||||||
private IServiceProvider _serviceProvider;
|
|
||||||
|
|
||||||
[ObservableProperty] private string _name;
|
public EquipmentEditingWindowViewModel(Equipment equipment)
|
||||||
[ObservableProperty] private string _invNumber;
|
|
||||||
[ObservableProperty] private DateTimeOffset? _date;
|
|
||||||
[ObservableProperty] private decimal _cost;
|
|
||||||
[ObservableProperty] private bool _isWrittenOff;
|
|
||||||
[ObservableProperty] private Employee _currentEmployee;
|
|
||||||
[ObservableProperty] private ObservableCollection<Employee> _employees;
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Confrm()
|
|
||||||
{
|
{
|
||||||
_equipment.InvNumber = InvNumber;
|
Equipment = EquipmentVisualFactory.CreateFromEquipment(equipment);
|
||||||
_equipment.Date = Date;
|
|
||||||
_equipment.Cost = Cost;
|
|
||||||
_equipment.IsWrittenOff = IsWrittenOff;
|
|
||||||
_equipment.CurrentEmployee = CurrentEmployee;
|
|
||||||
_equipment.Name = Name;
|
|
||||||
|
|
||||||
using (var repo = _serviceProvider.GetService<EquipmentRepository>())
|
|
||||||
{
|
|
||||||
if (_isEditing)
|
|
||||||
{
|
|
||||||
repo.Update(EquipmentFactory.CreateFromVisual(_equipment));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
repo.Add(EquipmentFactory.CreateFromVisual(_equipment));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_currentWindow.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private void Close()
|
|
||||||
{
|
|
||||||
_currentWindow.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public EquipmentEditingWindowViewModel(IServiceProvider serviceProvider, Equipment equipment)
|
|
||||||
{
|
|
||||||
_serviceProvider = serviceProvider;
|
|
||||||
_isEditing = !equipment.IsNew();
|
|
||||||
using (var repo = _serviceProvider.GetService<EmployeeRepository>())
|
|
||||||
{
|
|
||||||
_equipment = EquipmentVisualFactory.CreateFromEquipment(equipment);
|
|
||||||
_equipment.CurrentEmployee = repo.GetById(equipment.CurrentEmployeeId);
|
|
||||||
}
|
|
||||||
Name = _equipment.Name;
|
|
||||||
InvNumber = _equipment.InvNumber;
|
|
||||||
Date = _equipment.Date;
|
|
||||||
Cost = _equipment.Cost;
|
|
||||||
IsWrittenOff = _equipment.IsWrittenOff;
|
|
||||||
using (var repo = _serviceProvider.GetService<EmployeeRepository>())
|
|
||||||
{
|
|
||||||
Employees = new ObservableCollection<Employee>(repo.GetAll());
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentEmployee = Employees.FirstOrDefault(o => o.Id == equipment.CurrentEmployeeId);
|
|
||||||
}
|
}
|
||||||
public void SetWindow(EquipmentEditingWindow window)
|
public void SetWindow(EquipmentEditingWindow window)
|
||||||
{
|
{
|
||||||
_currentWindow = window;
|
_currentWindow = window;
|
||||||
_currentWindow.OkButton.Content = _isEditing ? "Изменить" : "Добавить";
|
if (Equipment == EquipmentVisualFactory.CreateFromEquipment(new Equipment()))
|
||||||
|
{
|
||||||
|
_currentWindow.OkButton.Content = "Изменить";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_currentWindow.OkButton.Content = "Добавить";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3,13 +3,11 @@ using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.LogicalTree;
|
using Avalonia.LogicalTree;
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.DataBase;
|
using AvaloniaApplication14_Inventory_300326.Models.DataBase;
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.Factories;
|
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
using AvaloniaApplication14_Inventory_300326.Models.Factoryes;
|
||||||
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
using AvaloniaApplication14_Inventory_300326.Models.Models;
|
||||||
using AvaloniaApplication14_Inventory_300326.Views;
|
using AvaloniaApplication14_Inventory_300326.Views;
|
||||||
|
|
@ -33,37 +31,6 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||||
[ObservableProperty] private EmployeeVisual _selectedEmployeeVisual;
|
[ObservableProperty] private EmployeeVisual _selectedEmployeeVisual;
|
||||||
[ObservableProperty] private Position _selectedPosition;
|
[ObservableProperty] private Position _selectedPosition;
|
||||||
|
|
||||||
|
|
||||||
[RelayCommand]
|
|
||||||
private async Task AddEntity()
|
|
||||||
{
|
|
||||||
switch (SelectedEntity.Id)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
|
|
||||||
var equipment = new Equipment();
|
|
||||||
var EquipmentVm = ActivatorUtilities.CreateInstance<EquipmentEditingWindowViewModel>(_serviceProvider, equipment);
|
|
||||||
var EquipmentWin = ActivatorUtilities.CreateInstance<EquipmentEditingWindow>(_serviceProvider, EquipmentVm);
|
|
||||||
await EquipmentWin.ShowDialog(_currentWindow);
|
|
||||||
ShowTeches();
|
|
||||||
GetTeches();
|
|
||||||
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
|
|
||||||
var employee = new Employee();
|
|
||||||
var EmployeeVm = ActivatorUtilities.CreateInstance<EmployeeEditingWindowViewModel>(_serviceProvider, employee);
|
|
||||||
var EmployeeWin = ActivatorUtilities.CreateInstance<EmployeeEditingWindow>(_serviceProvider, EmployeeVm);
|
|
||||||
await EmployeeWin.ShowDialog(_currentWindow);
|
|
||||||
ShowEmployees();
|
|
||||||
GetEmployees();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void OnSelectedEntityChanged(Entity value)
|
partial void OnSelectedEntityChanged(Entity value)
|
||||||
{
|
{
|
||||||
if (_currentWindow != null)
|
if (_currentWindow != null)
|
||||||
|
|
@ -168,22 +135,16 @@ public partial class MainWindowViewModel : ViewModelBase
|
||||||
_currentWindow.ScrollViewerDataGridPos.IsVisible = true;
|
_currentWindow.ScrollViewerDataGridPos.IsVisible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DoubleTappedTechDataGrid()
|
private void DoubleTappedTechDataGrid()
|
||||||
{
|
{
|
||||||
var vm = ActivatorUtilities.CreateInstance<EquipmentEditingWindowViewModel>(_serviceProvider, EquipmentFactory.CreateFromVisual(SelectedEquipmentVisual));
|
var vm = ActivatorUtilities.CreateInstance<EquipmentEditingWindowViewModel>(_serviceProvider, EquipmentFactory.CreateFromVisual(SelectedEquipmentVisual));
|
||||||
var win = ActivatorUtilities.CreateInstance<EquipmentEditingWindow>(_serviceProvider, vm);
|
var win = ActivatorUtilities.CreateInstance<EquipmentEditingWindow>(_serviceProvider, vm);
|
||||||
await win.ShowDialog(_currentWindow);
|
win.ShowDialog(_currentWindow);
|
||||||
ShowTeches();
|
|
||||||
GetTeches();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task DoubleTappedEmployeeDataGrid()
|
private void DoubleTappedEmployeeDataGrid()
|
||||||
{
|
{
|
||||||
var EmployeeVm = ActivatorUtilities.CreateInstance<EmployeeEditingWindowViewModel>(_serviceProvider, EmployeesFactory.CreateFromEmployeeVisual(SelectedEmployeeVisual));
|
|
||||||
var EmployeeWin = ActivatorUtilities.CreateInstance<EmployeeEditingWindow>(_serviceProvider, EmployeeVm);
|
|
||||||
await EmployeeWin.ShowDialog(_currentWindow);
|
|
||||||
ShowEmployees();
|
|
||||||
GetEmployees();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DoubleTappedPositionDataGrid()
|
private void DoubleTappedPositionDataGrid()
|
||||||
|
|
|
||||||
|
|
@ -2,33 +2,13 @@
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
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"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="AvaloniaApplication14_Inventory_300326.Views.EmployeeEditingWindow"
|
x:Class="AvaloniaApplication14_Inventory_300326.Views.EmployeeEditingWindow"
|
||||||
Title="EmployeeWindow"
|
Title="EmployeeEditingWindow">
|
||||||
x:DataType="vm:EmployeeEditingWindowViewModel"
|
|
||||||
SizeToContent="WidthAndHeight"
|
|
||||||
WindowStartupLocation="CenterOwner">
|
|
||||||
|
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<TextBox Watermark="ФИО"></TextBox>
|
||||||
<Label Content="Фамилия Имя отчество: "></Label>
|
<ComboBox></ComboBox>
|
||||||
<TextBox Watermark="ФИО" Text="{Binding Name}"></TextBox>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<Label Content="Должность: "></Label>
|
|
||||||
<ComboBox ItemsSource="{Binding Positions}" SelectedItem="{Binding SelectedPosition}">
|
|
||||||
<ComboBox.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Label Content="{Binding Name}"></Label>
|
|
||||||
</DataTemplate>
|
|
||||||
</ComboBox.ItemTemplate>
|
|
||||||
</ComboBox>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<Button x:Name="ConfirmButton" Command="{Binding ConfirmCommand}"></Button>
|
|
||||||
<Button Content="Назад" Command="{Binding CancelCommand}"></Button>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Markup.Xaml;
|
using Avalonia.Markup.Xaml;
|
||||||
using AvaloniaApplication14_Inventory_300326.ViewModels;
|
|
||||||
|
|
||||||
namespace AvaloniaApplication14_Inventory_300326.Views;
|
namespace AvaloniaApplication14_Inventory_300326.Views;
|
||||||
|
|
||||||
public partial class EmployeeEditingWindow : Window
|
public partial class EmployeeEditingWindow : Window
|
||||||
{
|
{
|
||||||
public EmployeeEditingWindow(EmployeeEditingWindowViewModel viewModel)
|
public EmployeeEditingWindow()
|
||||||
{
|
{
|
||||||
DataContext = viewModel;
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
viewModel.SetScreen(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -6,50 +6,42 @@
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="AvaloniaApplication14_Inventory_300326.Views.EquipmentEditingWindow"
|
x:Class="AvaloniaApplication14_Inventory_300326.Views.EquipmentEditingWindow"
|
||||||
x:DataType="vm:EquipmentEditingWindowViewModel"
|
x:DataType="vm:EquipmentEditingWindowViewModel"
|
||||||
Title="EquipmentEditingWindow"
|
Title="EquipmentEditingWindow">
|
||||||
SizeToContent="WidthAndHeight"
|
|
||||||
WindowStartupLocation="CenterOwner">
|
|
||||||
<StackPanel HorizontalAlignment="Left">
|
<StackPanel HorizontalAlignment="Left">
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Инвентарный номер: "></Label>
|
<Label Content="Инвентарный номер: "></Label>
|
||||||
<TextBox Text="{Binding InvNumber}"></TextBox>
|
<TextBox Text="{Binding Equipment.InvNumber}"></TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Название: "></Label>
|
<Label Content="Название: "></Label>
|
||||||
<TextBox Text="{Binding Name}"></TextBox>
|
<TextBox Text="{Binding Equipment.Name}"></TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Дата приобретения: "></Label>
|
<Label Content="Дата приобретения: "></Label>
|
||||||
<DatePicker SelectedDate="{Binding Date}"></DatePicker>
|
<DatePicker SelectedDate="{Binding Equipment.Date}"></DatePicker>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Цена: "></Label>
|
<Label Content="Цена: "></Label>
|
||||||
<TextBox Text="{Binding Cost}"></TextBox>
|
<TextBox></TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Списано ли: "></Label>
|
<Label Content="Списано ли: "></Label>
|
||||||
<CheckBox IsChecked="{Binding IsWrittenOff}"></CheckBox>
|
<TextBox></TextBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Label Content="Текущий ответственный: "></Label>
|
<Label Content="Текущий ответственный: "></Label>
|
||||||
<ComboBox ItemsSource="{Binding Employees}" SelectedItem="{Binding CurrentEmployee}">
|
<ComboBox></ComboBox>
|
||||||
<ComboBox.ItemTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<Label Content="{Binding FullName}"></Label>
|
|
||||||
</DataTemplate>
|
|
||||||
</ComboBox.ItemTemplate>
|
|
||||||
</ComboBox>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<Button x:Name="OkButton" Command="{Binding ConfrmCommand}"></Button>
|
<Button x:Name="OkButton"></Button>
|
||||||
<Button Content="Отменить" Command="{Binding CloseCommand}"></Button>
|
<Button Content="Отменить"></Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ComboBox.ItemTemplate>
|
</ComboBox.ItemTemplate>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
<Button Content="Добавить" Margin="10,0,0,0" Command="{Binding AddEntityCommand}"></Button>
|
<Button Content="Добавить" Margin="10,0,0,0"></Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ScrollViewer Grid.Row="1" x:Name="ScrollViewerDataGridTech">
|
<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}" SelectedItem="{Binding SelectedEquipmentVisual}" IsReadOnly="True">
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<DataGridTextColumn Header="Название" Binding="{Binding Name}"></DataGridTextColumn>
|
<DataGridTextColumn Header="Название" Binding="{Binding Name}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="Дата приобретения" Binding="{Binding Date}"></DataGridTextColumn>
|
<DataGridTextColumn Header="Дата приобретения" Binding="{Binding Date}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="Стоимость" Binding="{Binding Cost}"></DataGridTextColumn>
|
<DataGridTextColumn Header="Стоимость" Binding="{Binding Cost}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="Списано ли" Binding="{Binding IsWrittenOffString}"></DataGridTextColumn>
|
<DataGridTextColumn Header="Списано ли" Binding="{Binding IsWrittenOff}"></DataGridTextColumn>
|
||||||
<DataGridTextColumn Header="Текущий ответственный" Binding="{Binding CurrentEmployee.FullName}"></DataGridTextColumn>
|
<DataGridTextColumn Header="Текущий ответственный" Binding="{Binding CurrentEmployee.FullName}"></DataGridTextColumn>
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -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+147ed9b1e85ec232bec24cd3ec30a7c4c274fb3a")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+211c219a7b912ccb4d85ae18d8c9a6ea6db420d4")]
|
||||||
[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")]
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
8a899368f07641840a01d1306cc38ae23bb799c2cc2003defe76e2e5a69b0e4b
|
454401d59e479b388b4887324f8782d3eb2b2898eabb3e94f09f42fd002f2e16
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue