first edit

This commit is contained in:
Курнат Андрей
2026-01-31 16:11:36 +03:00
commit f0e11d6379
148 changed files with 6986 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class BookViewModel:ViewModelBase
{
#region Constructor
public BookViewModel(ILimsService limsService,BookSet bookSet=null)
{
_limsService = limsService;
if (bookSet != null) _bookSet = bookSet;
else _bookSet = new BookSet();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly BookSet _bookSet;
#endregion //Fields
#region Properties
public string? Number
{
get => _bookSet.Number;
set { _bookSet.Number = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_bookSet.Id == 0) await _limsService.Books.AddAsync(_bookSet);
else await _limsService.Books.UpdateAsync(_bookSet);
}
public async Task Remove()
{
await _limsService.Books.RemoveAsync(_bookSet);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class BooksViewModel:ViewModelBase
{
#region Constructor
public BooksViewModel(ILimsService limsService,IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
_limsService.Books.SetChanged += OnBooksChanged;
LoadDataAsync();
}
#endregion //Constructor
#region Events
private async void OnBooksChanged()
{
await LoadDataAsync();
}
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly IDialogService _dialogService;
private bool _isLoading;
private BookViewModel _currentBook;
#endregion //Fields
#region Properties
public ObservableCollection<BookViewModel> AllBooks { get; set; } = new();
public BookViewModel CurrentBook
{
get=>_currentBook;
set { _currentBook = value; OnPropertyChanged(); }
}
public bool IsLoading
{
get => _isLoading;
set { _isLoading = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
public async Task LoadDataAsync()
{
IsLoading = true;
try
{
// Параллельная загрузка данных из разных доменов через подсервисы
var booksTask = await _limsService.Books.GetAllAsync();
AllBooks = new ObservableCollection<BookViewModel>(booksTask.Select(s => new BookViewModel(_limsService, s)));
OnPropertyChanged(nameof(AllBooks));
}
finally
{
IsLoading = false;
}
}
private void Add()
{
_dialogService.ShowDialog(new BookViewModel(_limsService));
}
private void Edit()
{
_dialogService.ShowDialog(CurrentBook);
}
private async Task DelAsync()
{
await CurrentBook.Remove();
AllBooks.Remove(CurrentBook);
OnPropertyChanged(nameof(AllBooks));
}
#endregion //Methods
#region Commands
public ICommand AddCommand =>new RelayCommand(p=> Add());
public ICommand EditCommand => new RelayCommand(p => Edit(),p=>CurrentBook!=null);
public ICommand DelCommand => new AsyncRelayCommand(DelAsync, ()=>CurrentBook != null);
#endregion //Commands
}
}

View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class DeviceViewModel : ViewModelBase
{
#region Constructor
public DeviceViewModel(ILimsService limsService, DivisionSet division, DeviceSet device = null)
{
_limsService = limsService;
if (device != null) _device = device;
else _device = new DeviceSet() { DivisionId = division.Id };
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly DeviceSet _device;
#endregion //Fields
#region Properties
public string? Tip
{
get => _device.Tip;
set { _device.Tip = value; OnPropertyChanged(); }
}
public int Id => _device.Id;
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_device.Id == 0) await _limsService.Devices.AddAsync(_device);
else await _limsService.Devices.UpdateAsync(_device);
}
public async Task Remove()
{
await _limsService.Devices.RemoveAsync(_device);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class DivisionViewModel : ViewModelBase
{
#region Constructor
public DivisionViewModel(ILimsService limsService, DivisionSet division = null)
{
_limsService = limsService;
if (division != null) _division = division;
else _division = new DivisionSet();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly DivisionSet _division;
#endregion //Fields
#region Properties
public int? Kdl
{
get => _division.Kdl;
set { _division.Kdl = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_division.Id == 0) await _limsService.Divisions.AddAsync(_division);
else await _limsService.Divisions.UpdateAsync(_division);
}
public async Task Remove()
{
await _limsService.Divisions.RemoveAsync(_division);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class DivisionsViewModel : ViewModelBase
{
#region Constructor
public DivisionsViewModel(ILimsService limsService, IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
_limsService.Divisions.SetChanged += OnDivisionsChanged;
LoadDataAsync();
}
#endregion //Constructor
#region Events
private async void OnDivisionsChanged()
{
await LoadDataAsync();
}
#endregion //Events
#region Fields
private readonly IDialogService _dialogService;
private readonly ILimsService _limsService;
private bool _isLoading;
private DivisionViewModel _currentDivision;
#endregion //Fields
#region Properties
public ObservableCollection<DivisionViewModel> AllDivisions { get; set; } = new();
public DivisionViewModel CurrentDivision
{
get => _currentDivision;
set { _currentDivision = value; OnPropertyChanged(); }
}
public bool IsLoading
{
get => _isLoading;
set { _isLoading = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
public async Task LoadDataAsync()
{
IsLoading = true;
try
{
// Параллельная загрузка данных из разных доменов через подсервисы
var divisionsTask = await _limsService.Divisions.GetAllAsync();
AllDivisions = new ObservableCollection<DivisionViewModel>(divisionsTask.Select(s => new DivisionViewModel(_limsService, s)));
OnPropertyChanged(nameof(AllDivisions));
}
finally
{
IsLoading = false;
}
}
private void Add()
{
_dialogService.ShowDialog(new DivisionViewModel(_limsService));
}
private void Edit()
{
_dialogService.ShowDialog(CurrentDivision);
}
private async Task DelAsync()
{
await CurrentDivision.Remove();
AllDivisions.Remove(CurrentDivision);
OnPropertyChanged(nameof(AllDivisions));
}
#endregion //Methods
#region Commands
public ICommand AddCommand => new RelayCommand(p => Add());
public ICommand EditCommand => new RelayCommand(p => Edit(), p => CurrentDivision != null);
public ICommand DelCommand => new AsyncRelayCommand(DelAsync, () => CurrentDivision != null);
#endregion //Commands
}
}

View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.MVVM.Base;
using XLIMS.SP.Views;
namespace XLIMS.SP.ViewModels
{
public class MainViewModel : ViewModelBase, IActivityViewModel
{
#region Constructor
public MainViewModel(ILimsService limsService, IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly IDialogService _dialogService;
#endregion //Fields
#region Properties
public string Title => "Словари";
public object View => new MainView();
#endregion //Properties
#region Methods
#endregion //Methods
#region Commands
#endregion //Commands
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class PersonalViewModel : ViewModelBase
{
#region Constructor
public PersonalViewModel(ILimsService limsService, PersonalSet personal = null)
{
_limsService = limsService;
if (personal != null) _personal = personal;
else _personal = new PersonalSet();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly PersonalSet _personal;
#endregion //Fields
#region Properties
public string? Person
{
get => _personal.Person;
set { _personal.Person = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_personal.Id == 0) await _limsService.Personals.AddAsync(_personal);
else await _limsService.Personals.UpdateAsync(_personal);
}
public async Task Remove()
{
await _limsService.Personals.RemoveAsync(_personal);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class PersonalsViewModel : ViewModelBase
{
#region Constructor
public PersonalsViewModel(ILimsService limsService, IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
_limsService.Personals.SetChanged += OnPersonalsChanged;
LoadDataAsync();
}
#endregion //Constructor
#region Events
private async void OnPersonalsChanged()
{
await LoadDataAsync();
}
#endregion //Events
#region Fields
private readonly IDialogService _dialogService;
private readonly ILimsService _limsService;
private bool _isLoading;
private PersonalViewModel _currentPersonal;
#endregion //Fields
#region Properties
public ObservableCollection<PersonalViewModel> AllPersonals { get; set; } = new();
public PersonalViewModel CurrentPersonal
{
get => _currentPersonal;
set { _currentPersonal = value; OnPropertyChanged(); }
}
public bool IsLoading
{
get => _isLoading;
set { _isLoading = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
public async Task LoadDataAsync()
{
IsLoading = true;
try
{
// Параллельная загрузка данных из разных доменов через подсервисы
var personalsTask = await _limsService.Personals.GetAllAsync();
AllPersonals = new ObservableCollection<PersonalViewModel>(personalsTask.Select(s => new PersonalViewModel(_limsService, s)));
OnPropertyChanged(nameof(AllPersonals));
}
finally
{
IsLoading = false;
}
}
private void Add()
{
_dialogService.ShowDialog(new PersonalViewModel(_limsService));
}
private void Edit()
{
_dialogService.ShowDialog(CurrentPersonal);
}
private async Task DelAsync()
{
await CurrentPersonal.Remove();
AllPersonals.Remove(CurrentPersonal);
OnPropertyChanged(nameof(AllPersonals));
}
#endregion //Methods
#region Commands
public ICommand AddCommand => new RelayCommand(p => Add());
public ICommand EditCommand => new RelayCommand(p => Edit(), p => CurrentPersonal != null);
public ICommand DelCommand => new AsyncRelayCommand(DelAsync, () => CurrentPersonal != null);
#endregion //Commands
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class SpnmtpViewModel:ViewModelBase
{
#region Constructor
public SpnmtpViewModel(ILimsService limsService, Spnmtp spnmtp = null)
{
_limsService = limsService;
if (spnmtp != null) _spnmtp = spnmtp;
else _spnmtp = new Spnmtp();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly Spnmtp _spnmtp;
#endregion //Fields
#region Properties
public string? Nmtp
{
get => _spnmtp.Nmtp;
set { _spnmtp.Nmtp = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_spnmtp.Id == 0) await _limsService.Spnmtps.AddAsync(_spnmtp);
else await _limsService.Spnmtps.UpdateAsync(_spnmtp);
}
public async Task Remove()
{
await _limsService.Spnmtps.RemoveAsync(_spnmtp);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class SpnmtpsViewModel:ViewModelBase
{
#region Constructor
public SpnmtpsViewModel(ILimsService limsService, IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
_limsService.Spnmtps.SetChanged += OnSpnmtpsChanged;
LoadDataAsync();
}
#endregion //Constructor
#region Events
private async void OnSpnmtpsChanged()
{
await LoadDataAsync();
}
#endregion //Events
#region Fields
private readonly IDialogService _dialogService;
private readonly ILimsService _limsService;
private bool _isLoading;
private SpnmtpViewModel _currentSpnmtp;
#endregion //Fields
#region Properties
public ObservableCollection<SpnmtpViewModel> AllSpnmtps { get; set; } = new();
public SpnmtpViewModel CurrentSpnmtp
{
get => _currentSpnmtp;
set { _currentSpnmtp = value; OnPropertyChanged(); }
}
public bool IsLoading
{
get => _isLoading;
set { _isLoading = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
public async Task LoadDataAsync()
{
IsLoading = true;
try
{
// Параллельная загрузка данных из разных доменов через подсервисы
var spnmtpsTask = await _limsService.Spnmtps.GetAllAsync();
AllSpnmtps = new ObservableCollection<SpnmtpViewModel>(spnmtpsTask.Select(s => new SpnmtpViewModel(_limsService, s)));
OnPropertyChanged(nameof(AllSpnmtps));
}
finally
{
IsLoading = false;
}
}
private void Add()
{
_dialogService.ShowDialog(new SpnmtpViewModel(_limsService));
}
private void Edit()
{
_dialogService.ShowDialog(CurrentSpnmtp);
}
private async Task DelAsync()
{
await CurrentSpnmtp.Remove();
AllSpnmtps.Remove(CurrentSpnmtp);
OnPropertyChanged(nameof(AllSpnmtps));
}
#endregion //Methods
#region Commands
public ICommand AddCommand => new RelayCommand(p => Add());
public ICommand EditCommand => new RelayCommand(p => Edit(), p => CurrentSpnmtp != null);
public ICommand DelCommand => new AsyncRelayCommand(DelAsync, () => CurrentSpnmtp != null);
#endregion //Commands
}
}

View File

@@ -0,0 +1,54 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.DATA.Models;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class SpoiViewModel:ViewModelBase
{
#region Constructor
public SpoiViewModel(ILimsService limsService, Spoi spoi = null)
{
_limsService = limsService;
if (spoi != null) _spoi = spoi;
else _spoi = new Spoi();
}
#endregion //Constructor
#region Events
#endregion //Events
#region Fields
private readonly ILimsService _limsService;
private readonly Spoi _spoi;
#endregion //Fields
#region Properties
public string? Nmoi
{
get => _spoi.Nmoi;
set { _spoi.Nmoi = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
private async Task SaveAsync()
{
if (_spoi.Id == 0) await _limsService.Spois.AddAsync(_spoi);
else await _limsService.Spois.UpdateAsync(_spoi);
}
public async Task Remove()
{
await _limsService.Spois.RemoveAsync(_spoi);
}
#endregion //Methods
#region Commands
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
#endregion //Commands
}
}

View File

@@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using XLIMS.CONTRACT;
using XLIMS.MVVM.Base;
namespace XLIMS.SP.ViewModels
{
public class SpoisViewModel:ViewModelBase
{
#region Constructor
public SpoisViewModel(ILimsService limsService,IDialogService dialogService)
{
_limsService = limsService;
_dialogService = dialogService;
_limsService.Spois.SetChanged += OnSpoisChanged;
LoadDataAsync();
}
#endregion //Constructor
#region Events
private async void OnSpoisChanged()
{
await LoadDataAsync();
}
#endregion //Events
#region Fields
private readonly IDialogService _dialogService;
private readonly ILimsService _limsService;
private bool _isLoading;
private SpoiViewModel _currentSpoi;
#endregion //Fields
#region Properties
public ObservableCollection<SpoiViewModel> AllSpois { get; set; } = new();
public SpoiViewModel CurrentSpoi
{
get => _currentSpoi;
set { _currentSpoi = value; OnPropertyChanged(); }
}
public bool IsLoading
{
get => _isLoading;
set { _isLoading = value; OnPropertyChanged(); }
}
#endregion //Properties
#region Methods
public async Task LoadDataAsync()
{
IsLoading = true;
try
{
// Параллельная загрузка данных из разных доменов через подсервисы
var spoisTask = await _limsService.Spois.GetAllAsync();
AllSpois = new ObservableCollection<SpoiViewModel>(spoisTask.Select(s => new SpoiViewModel(_limsService, s)));
OnPropertyChanged(nameof(AllSpois));
}
finally
{
IsLoading = false;
}
}
private void Add()
{
_dialogService.ShowDialog(new SpoiViewModel(_limsService));
}
private void Edit()
{
_dialogService.ShowDialog(CurrentSpoi);
}
private async Task DelAsync()
{
await CurrentSpoi.Remove();
AllSpois.Remove(CurrentSpoi);
OnPropertyChanged(nameof(AllSpois));
}
#endregion //Methods
#region Commands
public ICommand AddCommand => new RelayCommand(p => Add());
public ICommand EditCommand => new RelayCommand(p => Edit(), p => CurrentSpoi != null);
public ICommand DelCommand => new AsyncRelayCommand(DelAsync, () => CurrentSpoi != null);
#endregion //Commands
}
}