first edit
This commit is contained in:
63
.gitattributes
vendored
Normal file
63
.gitattributes
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
###############################################################################
|
||||||
|
# Set default behavior to automatically normalize line endings.
|
||||||
|
###############################################################################
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set default behavior for command prompt diff.
|
||||||
|
#
|
||||||
|
# This is need for earlier builds of msysgit that does not have it on by
|
||||||
|
# default for csharp files.
|
||||||
|
# Note: This is only used by command line
|
||||||
|
###############################################################################
|
||||||
|
#*.cs diff=csharp
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Set the merge driver for project and solution files
|
||||||
|
#
|
||||||
|
# Merging from the command prompt will add diff markers to the files if there
|
||||||
|
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||||
|
# the diff markers are never inserted). Diff markers may cause the following
|
||||||
|
# file extensions to fail to load in VS. An alternative would be to treat
|
||||||
|
# these files as binary and thus will always conflict and require user
|
||||||
|
# intervention with every merge. To do so, just uncomment the entries below
|
||||||
|
###############################################################################
|
||||||
|
#*.sln merge=binary
|
||||||
|
#*.csproj merge=binary
|
||||||
|
#*.vbproj merge=binary
|
||||||
|
#*.vcxproj merge=binary
|
||||||
|
#*.vcproj merge=binary
|
||||||
|
#*.dbproj merge=binary
|
||||||
|
#*.fsproj merge=binary
|
||||||
|
#*.lsproj merge=binary
|
||||||
|
#*.wixproj merge=binary
|
||||||
|
#*.modelproj merge=binary
|
||||||
|
#*.sqlproj merge=binary
|
||||||
|
#*.wwaproj merge=binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# behavior for image files
|
||||||
|
#
|
||||||
|
# image files are treated as binary by default.
|
||||||
|
###############################################################################
|
||||||
|
#*.jpg binary
|
||||||
|
#*.png binary
|
||||||
|
#*.gif binary
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# diff behavior for common document formats
|
||||||
|
#
|
||||||
|
# Convert binary document formats to text before diffing them. This feature
|
||||||
|
# is only available from the command line. Turn it on by uncommenting the
|
||||||
|
# entries below.
|
||||||
|
###############################################################################
|
||||||
|
#*.doc diff=astextplain
|
||||||
|
#*.DOC diff=astextplain
|
||||||
|
#*.docx diff=astextplain
|
||||||
|
#*.DOCX diff=astextplain
|
||||||
|
#*.dot diff=astextplain
|
||||||
|
#*.DOT diff=astextplain
|
||||||
|
#*.pdf diff=astextplain
|
||||||
|
#*.PDF diff=astextplain
|
||||||
|
#*.rtf diff=astextplain
|
||||||
|
#*.RTF diff=astextplain
|
||||||
363
.gitignore
vendored
Normal file
363
.gitignore
vendored
Normal file
@@ -0,0 +1,363 @@
|
|||||||
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
##
|
||||||
|
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||||
|
|
||||||
|
# User-specific files
|
||||||
|
*.rsuser
|
||||||
|
*.suo
|
||||||
|
*.user
|
||||||
|
*.userosscache
|
||||||
|
*.sln.docstates
|
||||||
|
|
||||||
|
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||||
|
*.userprefs
|
||||||
|
|
||||||
|
# Mono auto generated files
|
||||||
|
mono_crash.*
|
||||||
|
|
||||||
|
# Build results
|
||||||
|
[Dd]ebug/
|
||||||
|
[Dd]ebugPublic/
|
||||||
|
[Rr]elease/
|
||||||
|
[Rr]eleases/
|
||||||
|
x64/
|
||||||
|
x86/
|
||||||
|
[Ww][Ii][Nn]32/
|
||||||
|
[Aa][Rr][Mm]/
|
||||||
|
[Aa][Rr][Mm]64/
|
||||||
|
bld/
|
||||||
|
[Bb]in/
|
||||||
|
[Oo]bj/
|
||||||
|
[Oo]ut/
|
||||||
|
[Ll]og/
|
||||||
|
[Ll]ogs/
|
||||||
|
|
||||||
|
# Visual Studio 2015/2017 cache/options directory
|
||||||
|
.vs/
|
||||||
|
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||||
|
#wwwroot/
|
||||||
|
|
||||||
|
# Visual Studio 2017 auto generated files
|
||||||
|
Generated\ Files/
|
||||||
|
|
||||||
|
# MSTest test Results
|
||||||
|
[Tt]est[Rr]esult*/
|
||||||
|
[Bb]uild[Ll]og.*
|
||||||
|
|
||||||
|
# NUnit
|
||||||
|
*.VisualState.xml
|
||||||
|
TestResult.xml
|
||||||
|
nunit-*.xml
|
||||||
|
|
||||||
|
# Build Results of an ATL Project
|
||||||
|
[Dd]ebugPS/
|
||||||
|
[Rr]eleasePS/
|
||||||
|
dlldata.c
|
||||||
|
|
||||||
|
# Benchmark Results
|
||||||
|
BenchmarkDotNet.Artifacts/
|
||||||
|
|
||||||
|
# .NET Core
|
||||||
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
|
artifacts/
|
||||||
|
|
||||||
|
# ASP.NET Scaffolding
|
||||||
|
ScaffoldingReadMe.txt
|
||||||
|
|
||||||
|
# StyleCop
|
||||||
|
StyleCopReport.xml
|
||||||
|
|
||||||
|
# Files built by Visual Studio
|
||||||
|
*_i.c
|
||||||
|
*_p.c
|
||||||
|
*_h.h
|
||||||
|
*.ilk
|
||||||
|
*.meta
|
||||||
|
*.obj
|
||||||
|
*.iobj
|
||||||
|
*.pch
|
||||||
|
*.pdb
|
||||||
|
*.ipdb
|
||||||
|
*.pgc
|
||||||
|
*.pgd
|
||||||
|
*.rsp
|
||||||
|
*.sbr
|
||||||
|
*.tlb
|
||||||
|
*.tli
|
||||||
|
*.tlh
|
||||||
|
*.tmp
|
||||||
|
*.tmp_proj
|
||||||
|
*_wpftmp.csproj
|
||||||
|
*.log
|
||||||
|
*.vspscc
|
||||||
|
*.vssscc
|
||||||
|
.builds
|
||||||
|
*.pidb
|
||||||
|
*.svclog
|
||||||
|
*.scc
|
||||||
|
|
||||||
|
# Chutzpah Test files
|
||||||
|
_Chutzpah*
|
||||||
|
|
||||||
|
# Visual C++ cache files
|
||||||
|
ipch/
|
||||||
|
*.aps
|
||||||
|
*.ncb
|
||||||
|
*.opendb
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
|
# Visual Studio profiler
|
||||||
|
*.psess
|
||||||
|
*.vsp
|
||||||
|
*.vspx
|
||||||
|
*.sap
|
||||||
|
|
||||||
|
# Visual Studio Trace Files
|
||||||
|
*.e2e
|
||||||
|
|
||||||
|
# TFS 2012 Local Workspace
|
||||||
|
$tf/
|
||||||
|
|
||||||
|
# Guidance Automation Toolkit
|
||||||
|
*.gpState
|
||||||
|
|
||||||
|
# ReSharper is a .NET coding add-in
|
||||||
|
_ReSharper*/
|
||||||
|
*.[Rr]e[Ss]harper
|
||||||
|
*.DotSettings.user
|
||||||
|
|
||||||
|
# TeamCity is a build add-in
|
||||||
|
_TeamCity*
|
||||||
|
|
||||||
|
# DotCover is a Code Coverage Tool
|
||||||
|
*.dotCover
|
||||||
|
|
||||||
|
# AxoCover is a Code Coverage Tool
|
||||||
|
.axoCover/*
|
||||||
|
!.axoCover/settings.json
|
||||||
|
|
||||||
|
# Coverlet is a free, cross platform Code Coverage Tool
|
||||||
|
coverage*.json
|
||||||
|
coverage*.xml
|
||||||
|
coverage*.info
|
||||||
|
|
||||||
|
# Visual Studio code coverage results
|
||||||
|
*.coverage
|
||||||
|
*.coveragexml
|
||||||
|
|
||||||
|
# NCrunch
|
||||||
|
_NCrunch_*
|
||||||
|
.*crunch*.local.xml
|
||||||
|
nCrunchTemp_*
|
||||||
|
|
||||||
|
# MightyMoose
|
||||||
|
*.mm.*
|
||||||
|
AutoTest.Net/
|
||||||
|
|
||||||
|
# Web workbench (sass)
|
||||||
|
.sass-cache/
|
||||||
|
|
||||||
|
# Installshield output folder
|
||||||
|
[Ee]xpress/
|
||||||
|
|
||||||
|
# DocProject is a documentation generator add-in
|
||||||
|
DocProject/buildhelp/
|
||||||
|
DocProject/Help/*.HxT
|
||||||
|
DocProject/Help/*.HxC
|
||||||
|
DocProject/Help/*.hhc
|
||||||
|
DocProject/Help/*.hhk
|
||||||
|
DocProject/Help/*.hhp
|
||||||
|
DocProject/Help/Html2
|
||||||
|
DocProject/Help/html
|
||||||
|
|
||||||
|
# Click-Once directory
|
||||||
|
publish/
|
||||||
|
|
||||||
|
# Publish Web Output
|
||||||
|
*.[Pp]ublish.xml
|
||||||
|
*.azurePubxml
|
||||||
|
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||||
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
|
*.pubxml
|
||||||
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
|
# NuGet Packages
|
||||||
|
*.nupkg
|
||||||
|
# NuGet Symbol Packages
|
||||||
|
*.snupkg
|
||||||
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
**/[Pp]ackages/*
|
||||||
|
# except build/, which is used as an MSBuild target.
|
||||||
|
!**/[Pp]ackages/build/
|
||||||
|
# Uncomment if necessary however generally it will be regenerated when needed
|
||||||
|
#!**/[Pp]ackages/repositories.config
|
||||||
|
# NuGet v3's project.json files produces more ignorable files
|
||||||
|
*.nuget.props
|
||||||
|
*.nuget.targets
|
||||||
|
|
||||||
|
# Microsoft Azure Build Output
|
||||||
|
csx/
|
||||||
|
*.build.csdef
|
||||||
|
|
||||||
|
# Microsoft Azure Emulator
|
||||||
|
ecf/
|
||||||
|
rcf/
|
||||||
|
|
||||||
|
# Windows Store app package directories and files
|
||||||
|
AppPackages/
|
||||||
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
*.appx
|
||||||
|
*.appxbundle
|
||||||
|
*.appxupload
|
||||||
|
|
||||||
|
# Visual Studio cache files
|
||||||
|
# files ending in .cache can be ignored
|
||||||
|
*.[Cc]ache
|
||||||
|
# but keep track of directories ending in .cache
|
||||||
|
!?*.[Cc]ache/
|
||||||
|
|
||||||
|
# Others
|
||||||
|
ClientBin/
|
||||||
|
~$*
|
||||||
|
*~
|
||||||
|
*.dbmdl
|
||||||
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
|
*.pfx
|
||||||
|
*.publishsettings
|
||||||
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Including strong name files can present a security risk
|
||||||
|
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||||
|
#*.snk
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
|
# RIA/Silverlight projects
|
||||||
|
Generated_Code/
|
||||||
|
|
||||||
|
# Backup & report files from converting an old project file
|
||||||
|
# to a newer Visual Studio version. Backup files are not needed,
|
||||||
|
# because we have git ;-)
|
||||||
|
_UpgradeReport_Files/
|
||||||
|
Backup*/
|
||||||
|
UpgradeLog*.XML
|
||||||
|
UpgradeLog*.htm
|
||||||
|
ServiceFabricBackup/
|
||||||
|
*.rptproj.bak
|
||||||
|
|
||||||
|
# SQL Server files
|
||||||
|
*.mdf
|
||||||
|
*.ldf
|
||||||
|
*.ndf
|
||||||
|
|
||||||
|
# Business Intelligence projects
|
||||||
|
*.rdl.data
|
||||||
|
*.bim.layout
|
||||||
|
*.bim_*.settings
|
||||||
|
*.rptproj.rsuser
|
||||||
|
*- [Bb]ackup.rdl
|
||||||
|
*- [Bb]ackup ([0-9]).rdl
|
||||||
|
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||||
|
|
||||||
|
# Microsoft Fakes
|
||||||
|
FakesAssemblies/
|
||||||
|
|
||||||
|
# GhostDoc plugin setting file
|
||||||
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
# Node.js Tools for Visual Studio
|
||||||
|
.ntvs_analysis.dat
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# Visual Studio 6 build log
|
||||||
|
*.plg
|
||||||
|
|
||||||
|
# Visual Studio 6 workspace options file
|
||||||
|
*.opt
|
||||||
|
|
||||||
|
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||||
|
*.vbw
|
||||||
|
|
||||||
|
# Visual Studio LightSwitch build output
|
||||||
|
**/*.HTMLClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/GeneratedArtifacts
|
||||||
|
**/*.DesktopClient/ModelManifest.xml
|
||||||
|
**/*.Server/GeneratedArtifacts
|
||||||
|
**/*.Server/ModelManifest.xml
|
||||||
|
_Pvt_Extensions
|
||||||
|
|
||||||
|
# Paket dependency manager
|
||||||
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
|
# FAKE - F# Make
|
||||||
|
.fake/
|
||||||
|
|
||||||
|
# CodeRush personal settings
|
||||||
|
.cr/personal
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Cake - Uncomment if you are using it
|
||||||
|
# tools/**
|
||||||
|
# !tools/packages.config
|
||||||
|
|
||||||
|
# Tabs Studio
|
||||||
|
*.tss
|
||||||
|
|
||||||
|
# Telerik's JustMock configuration file
|
||||||
|
*.jmconfig
|
||||||
|
|
||||||
|
# BizTalk build output
|
||||||
|
*.btp.cs
|
||||||
|
*.btm.cs
|
||||||
|
*.odx.cs
|
||||||
|
*.xsd.cs
|
||||||
|
|
||||||
|
# OpenCover UI analysis results
|
||||||
|
OpenCover/
|
||||||
|
|
||||||
|
# Azure Stream Analytics local run output
|
||||||
|
ASALocalRun/
|
||||||
|
|
||||||
|
# MSBuild Binary and Structured Log
|
||||||
|
*.binlog
|
||||||
|
|
||||||
|
# NVidia Nsight GPU debugger configuration file
|
||||||
|
*.nvuser
|
||||||
|
|
||||||
|
# MFractors (Xamarin productivity tool) working folder
|
||||||
|
.mfractor/
|
||||||
|
|
||||||
|
# Local History for Visual Studio
|
||||||
|
.localhistory/
|
||||||
|
|
||||||
|
# BeatPulse healthcheck temp database
|
||||||
|
healthchecksdb
|
||||||
|
|
||||||
|
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||||
|
MigrationBackup/
|
||||||
|
|
||||||
|
# Ionide (cross platform F# VS Code tools) working folder
|
||||||
|
.ionide/
|
||||||
|
|
||||||
|
# Fody - auto-generated XML schema
|
||||||
|
FodyWeavers.xsd
|
||||||
10
XLIMS.CONTRACT/AssemblyInfo.cs
Normal file
10
XLIMS.CONTRACT/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
13
XLIMS.CONTRACT/IActivityViewModel.cs
Normal file
13
XLIMS.CONTRACT/IActivityViewModel.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace XLIMS.CONTRACT
|
||||||
|
{
|
||||||
|
public interface IActivityViewModel
|
||||||
|
{
|
||||||
|
string Title { get; }
|
||||||
|
object View { get; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
12
XLIMS.CONTRACT/IDialogService.cs
Normal file
12
XLIMS.CONTRACT/IDialogService.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace XLIMS.CONTRACT;
|
||||||
|
|
||||||
|
public interface IDialogService
|
||||||
|
{
|
||||||
|
void ShowDialog<TViewModel>(TViewModel viewModel) where TViewModel : class;
|
||||||
|
|
||||||
|
// Если нужны модальные окна с результатом:
|
||||||
|
bool? ShowDialog<TViewModel>(TViewModel viewModel, out object? result)
|
||||||
|
where TViewModel : class;
|
||||||
|
//немодальные окна
|
||||||
|
void Show<TViewModel>(TViewModel viewModel) where TViewModel : class;
|
||||||
|
}
|
||||||
32
XLIMS.CONTRACT/IGenericRepository.cs
Normal file
32
XLIMS.CONTRACT/IGenericRepository.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
|
namespace XLIMS.CONTRACT
|
||||||
|
{
|
||||||
|
// Интерфейс generic-репозитория
|
||||||
|
public interface IGenericRepository<TEntity> where TEntity : class
|
||||||
|
{
|
||||||
|
Task<TEntity> GetByIdAsync(int id);
|
||||||
|
Task<IEnumerable<TEntity>> GetAllAsync();
|
||||||
|
Task<IEnumerable<TEntity>> WhereAsync(Expression<Func<TEntity, bool>> predicate);
|
||||||
|
IEnumerable<TEntity> Find(Expression<Func<TEntity, bool>> predicate);
|
||||||
|
Task<IEnumerable<TEntity>> FindAsync(Expression<Func<TEntity, bool>> predicate);
|
||||||
|
|
||||||
|
Task<TEntity> SingleOrDefaultAsync(Expression<Func<TEntity, bool>> predicate);
|
||||||
|
|
||||||
|
Task AddAsync(TEntity entity);
|
||||||
|
Task AddRangeAsync(IEnumerable<TEntity> entities);
|
||||||
|
|
||||||
|
Task UpdateAsync(TEntity entity);
|
||||||
|
Task UpdateRangeAsync(IEnumerable<TEntity> entities);
|
||||||
|
|
||||||
|
Task RemoveAsync(TEntity entity);
|
||||||
|
Task RemoveRangeAsync(IEnumerable<TEntity> entities);
|
||||||
|
|
||||||
|
Task<int> CountAsync(Expression<Func<TEntity, bool>> predicate = null);
|
||||||
|
|
||||||
|
event Action SetChanged;
|
||||||
|
|
||||||
|
Task<int> SaveChangesAsync();
|
||||||
|
int SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
24
XLIMS.CONTRACT/ILimsService.cs
Normal file
24
XLIMS.CONTRACT/ILimsService.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
namespace XLIMS.CONTRACT
|
||||||
|
{
|
||||||
|
public interface ILimsService
|
||||||
|
{
|
||||||
|
IGenericRepository<BookSet> Books { get; }
|
||||||
|
IGenericRepository<DataSet> Datas { get; }
|
||||||
|
IGenericRepository<DeviceSet> Devices { get; }
|
||||||
|
IGenericRepository<DivisionSet> Divisions { get; }
|
||||||
|
IGenericRepository<DocumentSet> Documents { get; }
|
||||||
|
IGenericRepository<PersonalSet> Personals { get; }
|
||||||
|
IGenericRepository<Spnmtp> Spnmtps { get; }
|
||||||
|
IGenericRepository<Spoi> Spois { get; }
|
||||||
|
IGenericRepository<Tip> Tips { get; }
|
||||||
|
IGenericRepository<Tprz> Tprzs { get; }
|
||||||
|
|
||||||
|
Task<int> SaveChangesAsync();
|
||||||
|
int SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
28
XLIMS.CONTRACT/XLIMS.CONTRACT.csproj
Normal file
28
XLIMS.CONTRACT/XLIMS.CONTRACT.csproj
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="IBookService.cs" />
|
||||||
|
<Compile Remove="IDataSetService.cs" />
|
||||||
|
<Compile Remove="IDeviceService.cs" />
|
||||||
|
<Compile Remove="IDivisionService.cs" />
|
||||||
|
<Compile Remove="IDocumentService.cs" />
|
||||||
|
<Compile Remove="ILimsService1.cs" />
|
||||||
|
<Compile Remove="IPersonalService.cs" />
|
||||||
|
<Compile Remove="ISpnmtpService.cs" />
|
||||||
|
<Compile Remove="ISpoiService.cs" />
|
||||||
|
<Compile Remove="ITipService.cs" />
|
||||||
|
<Compile Remove="ITprzService.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
10
XLIMS.CORE/AssemblyInfo.cs
Normal file
10
XLIMS.CORE/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
116
XLIMS.CORE/Helpers/ClosePsv.cs
Normal file
116
XLIMS.CORE/Helpers/ClosePsv.cs
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace XLIMS.CORE.Helpers
|
||||||
|
{
|
||||||
|
public class ClosePsv
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public ClosePsv(DocViewModel document, XLAB7Repository repository, int copies = 0)
|
||||||
|
{
|
||||||
|
if (copies == 0) _copies = 1;
|
||||||
|
else _copies = copies;
|
||||||
|
_document = document;
|
||||||
|
_repository = repository;
|
||||||
|
_fi = new FileInfo(@"Resources\DOCX\ClosePsv.docx");
|
||||||
|
_wordApp = new Microsoft.Office.Interop.Word.Application();
|
||||||
|
_wordDocument = _wordApp.Documents.Open(_fi.FullName);
|
||||||
|
_table = _wordDocument.Tables[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private Microsoft.Office.Interop.Word.Application _wordApp;
|
||||||
|
private Microsoft.Office.Interop.Word.Document _wordDocument;
|
||||||
|
private object _wFalse = false;
|
||||||
|
private object _wTrue = true;
|
||||||
|
private object _missing = null;
|
||||||
|
private FileInfo _fi;
|
||||||
|
private DocViewModel _document;
|
||||||
|
private Table _table;
|
||||||
|
private int _copies;
|
||||||
|
private XLAB7Repository _repository;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Mehtods
|
||||||
|
|
||||||
|
private void Replace(string text, string replacementText)
|
||||||
|
{
|
||||||
|
Find find = _wordApp.Selection.Find;
|
||||||
|
find.Text = text;
|
||||||
|
find.Replacement.Text = replacementText;
|
||||||
|
find.Execute(FindText: Type.Missing,
|
||||||
|
MatchCase: false,
|
||||||
|
MatchWholeWord: false,
|
||||||
|
MatchWildcards: false,
|
||||||
|
MatchSoundsLike: Type.Missing,
|
||||||
|
MatchAllWordForms: false,
|
||||||
|
Forward: true,
|
||||||
|
Wrap: Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue,
|
||||||
|
Format: false,
|
||||||
|
ReplaceWith: Type.Missing,
|
||||||
|
Replace: Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Print()
|
||||||
|
{
|
||||||
|
|
||||||
|
Replace("number", _document.Number);
|
||||||
|
Replace("div", _document.CurrentFRPD.NMFRPD);
|
||||||
|
Replace("date", ((DateTime)_document.Date).ToLongDateString());
|
||||||
|
Replace("count", _document.AllEKZMK.Count.ToString());
|
||||||
|
Replace("bad", _document.AllEKZMK.Count(o => o.GDN == false).ToString());
|
||||||
|
Replace("good", _document.AllEKZMK.Count(o => o.GDN == true).ToString());
|
||||||
|
Replace("person", _document.CurrentPRSNVY.PRFIO);
|
||||||
|
Replace("today", ((DateTime)_document.DateVY).ToLongDateString());
|
||||||
|
var i = 2;
|
||||||
|
var n = 1;
|
||||||
|
foreach (var data in _document.AllGroupsEKZMK)
|
||||||
|
{
|
||||||
|
_table.Rows.Add();
|
||||||
|
_table.Rows[i].Cells[1].Range.Text = n.ToString();
|
||||||
|
_table.Rows[i].Cells[2].Range.Text = data.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.IDTIPSNavigation.IDSPNMTPNavigation.NMTP;
|
||||||
|
_table.Rows[i].Cells[3].Range.Text = data.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.IDTIPSNavigation.TP;
|
||||||
|
_table.Rows[i].Cells[4].Range.Text = data.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.DPZN;
|
||||||
|
if (data.GroupEKZMK.Count() > 3)
|
||||||
|
{
|
||||||
|
_table.Rows[i].Cells[5].Range.Text = data.GroupEKZMK.Count().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var d in data.GroupEKZMK)
|
||||||
|
{
|
||||||
|
_table.Rows[i].Cells[5].Range.Text += d.CurrentEKZ.NNZV + ", ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_table.Rows[i].Cells[6].Range.Text = data.Count.ToString();
|
||||||
|
_table.Rows[i].Cells[7].Range.Text = data.GoodCount.ToString();
|
||||||
|
_table.Rows[i].Cells[8].Range.Text = data.BadCount.ToString();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_table.Rows[i].Cells[9].Range.Text = data.CurrentEKZMK.CurrentDMS.NND.ToString() + " от " + data.CurrentEKZMK.CurrentDMS.DTD.ToShortDateString();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
i++;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
_wordDocument.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, _copies);
|
||||||
|
_wordDocument.Close(_wFalse);
|
||||||
|
_wordApp.Quit();
|
||||||
|
}
|
||||||
|
#endregion //Mehtods
|
||||||
|
}
|
||||||
|
}
|
||||||
106
XLIMS.CORE/Helpers/Izv.cs
Normal file
106
XLIMS.CORE/Helpers/Izv.cs
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace XLIMS.CORE.Helpers
|
||||||
|
{
|
||||||
|
public class Izv
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public Izv(DMS document, XLAB7Repository repository, int copies = 1)
|
||||||
|
{
|
||||||
|
_document = document;
|
||||||
|
_repository = repository;
|
||||||
|
_copies = copies;
|
||||||
|
_docs = _repository.GetDMS().Where(w => w.NND == _document.NND).ToList();
|
||||||
|
_fi = new FileInfo(@"Resources\DOCX\Izv.docx");
|
||||||
|
_wordApp = new Application();
|
||||||
|
_wordDocument = _wordApp.Documents.Open(_fi.FullName);
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private Application _wordApp;
|
||||||
|
private Microsoft.Office.Interop.Word.Document _wordDocument;
|
||||||
|
private object _wFalse = false;
|
||||||
|
private object _wTrue = true;
|
||||||
|
private object _missing = null;
|
||||||
|
private FileInfo _fi;
|
||||||
|
private DMS _document;
|
||||||
|
private List<DMS> _docs;
|
||||||
|
private Table _table;
|
||||||
|
private int _copies;
|
||||||
|
private XLAB7Repository _repository;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Mehtods
|
||||||
|
|
||||||
|
private void Replace(string text, string replacementText)
|
||||||
|
{
|
||||||
|
Find find = _wordApp.Selection.Find;
|
||||||
|
find.Text = text;
|
||||||
|
find.Replacement.Text = replacementText;
|
||||||
|
find.Execute(FindText: Type.Missing,
|
||||||
|
MatchCase: false,
|
||||||
|
MatchWholeWord: false,
|
||||||
|
MatchWildcards: false,
|
||||||
|
MatchSoundsLike: Type.Missing,
|
||||||
|
MatchAllWordForms: false,
|
||||||
|
Forward: true,
|
||||||
|
Wrap: Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue,
|
||||||
|
Format: false,
|
||||||
|
ReplaceWith: Type.Missing,
|
||||||
|
Replace: Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Print()
|
||||||
|
{
|
||||||
|
var ekzmk = new List<EKZMK>();
|
||||||
|
foreach (var doc in _docs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ekzmk.Add(_repository.GetEKZMK().Result.FirstOrDefault(f => f.IDEKZMK == doc.IDOD));
|
||||||
|
}
|
||||||
|
catch { continue; }
|
||||||
|
}
|
||||||
|
Replace("number", _document.NND);
|
||||||
|
Replace("name", ekzmk.FirstOrDefault().IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.IDSPNMTPNavigation.NMTP);
|
||||||
|
if (ekzmk.Count() > 3)
|
||||||
|
{
|
||||||
|
Replace("serial", ekzmk.Count().ToString()+" шт.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string serials=string.Empty;
|
||||||
|
foreach (var d in ekzmk)
|
||||||
|
{
|
||||||
|
serials += d.IDEKZNavigation.NNZV+", ";
|
||||||
|
}
|
||||||
|
Replace("serial", serials);
|
||||||
|
}
|
||||||
|
Replace("type", ekzmk.FirstOrDefault().IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.TP);
|
||||||
|
Replace("gr", ekzmk.FirstOrDefault().IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.NNTPGR);
|
||||||
|
Replace("reason", ekzmk.FirstOrDefault().PRCHNPGDN);
|
||||||
|
Replace("method", "");
|
||||||
|
Replace("dev", ekzmk.FirstOrDefault().IDEKZNavigation.IDFRPDVNavigation.NMFRPD);
|
||||||
|
Replace("person", ekzmk.FirstOrDefault().IDPRSNNavigation.PRFIO);
|
||||||
|
Replace("date", ((DateTime)ekzmk.FirstOrDefault().DTMKFK).ToLongDateString());
|
||||||
|
|
||||||
|
_wordDocument.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, _copies);
|
||||||
|
_wordDocument.Close(_wFalse);
|
||||||
|
_wordApp.Quit();
|
||||||
|
}
|
||||||
|
#endregion //Mehtods
|
||||||
|
}
|
||||||
|
}
|
||||||
124
XLIMS.CORE/Helpers/OpenPsv.cs
Normal file
124
XLIMS.CORE/Helpers/OpenPsv.cs
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace XLIMS.CORE.Helpers
|
||||||
|
{
|
||||||
|
public class OpenPsv
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private readonly dynamic _wordApp;
|
||||||
|
private readonly dynamic _wordDocument;
|
||||||
|
private readonly dynamic _table;
|
||||||
|
|
||||||
|
private readonly DocViewModel _document;
|
||||||
|
private readonly XLAB7Repository _repository;
|
||||||
|
private readonly int _copies;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
public OpenPsv(DocViewModel document, XLAB7Repository repository, int copies = 1)
|
||||||
|
{
|
||||||
|
_document = document ?? throw new ArgumentNullException(nameof(document));
|
||||||
|
_repository = repository ?? throw new ArgumentNullException(nameof(repository));
|
||||||
|
_copies = copies < 1 ? 1 : copies;
|
||||||
|
|
||||||
|
var templatePath = Path.Combine("Resources", "DOCX", "OpenPsv.docx");
|
||||||
|
|
||||||
|
if (!File.Exists(templatePath))
|
||||||
|
throw new FileNotFoundException("Шаблон Word не найден", templatePath);
|
||||||
|
|
||||||
|
var wordType = Type.GetTypeFromProgID("Word.Application");
|
||||||
|
if (wordType == null)
|
||||||
|
throw new InvalidOperationException("Microsoft Word не установлен");
|
||||||
|
|
||||||
|
_wordApp = Activator.CreateInstance(wordType);
|
||||||
|
_wordApp.Visible = false;
|
||||||
|
|
||||||
|
_wordDocument = _wordApp.Documents.Open(templatePath);
|
||||||
|
|
||||||
|
if (_wordDocument.Tables.Count < 1)
|
||||||
|
throw new InvalidOperationException("В документе отсутствует таблица");
|
||||||
|
|
||||||
|
_table = _wordDocument.Tables[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
private void Replace(string placeholder, string value)
|
||||||
|
{
|
||||||
|
dynamic range = _wordDocument.Content;
|
||||||
|
dynamic find = range.Find;
|
||||||
|
|
||||||
|
find.ClearFormatting();
|
||||||
|
find.Text = placeholder;
|
||||||
|
find.Replacement.ClearFormatting();
|
||||||
|
find.Replacement.Text = value ?? string.Empty;
|
||||||
|
|
||||||
|
find.Execute(
|
||||||
|
Replace: 2, // wdReplaceAll
|
||||||
|
Wrap: 1 // wdFindContinue
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Print()
|
||||||
|
{
|
||||||
|
Replace("number", _document.Number);
|
||||||
|
Replace("div", _document.CurrentFRPD.NMFRPD);
|
||||||
|
Replace("date", ((DateTime)_document.Date).ToLongDateString());
|
||||||
|
Replace("count", _document.AllEKZMK.Count.ToString());
|
||||||
|
Replace("next", ((DateTime)_document.Date).AddDays(30).ToLongDateString());
|
||||||
|
Replace("person", _document.CurrentPRSNPR.PRFIO);
|
||||||
|
|
||||||
|
int rowIndex = 2;
|
||||||
|
int index = 1;
|
||||||
|
|
||||||
|
foreach (var group in _document.AllGroupsEKZMK)
|
||||||
|
{
|
||||||
|
_table.Rows.Add();
|
||||||
|
|
||||||
|
_table.Cell(rowIndex, 1).Range.Text = index.ToString();
|
||||||
|
_table.Cell(rowIndex, 2).Range.Text =
|
||||||
|
group.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation
|
||||||
|
.IDTIPSNavigation.IDSPNMTPNavigation.NMTP;
|
||||||
|
|
||||||
|
_table.Cell(rowIndex, 3).Range.Text =
|
||||||
|
group.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation
|
||||||
|
.IDTIPSNavigation.TP;
|
||||||
|
|
||||||
|
_table.Cell(rowIndex, 4).Range.Text =
|
||||||
|
group.CurrentEKZMK.CurrentEKZ.IDTPRZNavigation.DPZN;
|
||||||
|
|
||||||
|
if (group.GroupEKZMK.Count() > 3)
|
||||||
|
{
|
||||||
|
_table.Cell(rowIndex, 5).Range.Text =
|
||||||
|
group.GroupEKZMK.Count().ToString();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var item in group.GroupEKZMK)
|
||||||
|
{
|
||||||
|
_table.Cell(rowIndex, 5).Range.Text +=
|
||||||
|
item.CurrentEKZ.NNZV + ", ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_table.Cell(rowIndex, 6).Range.Text = group.Count.ToString();
|
||||||
|
_table.Cell(rowIndex, 9).Range.Text = group.CurrentEKZMK.DSEKZMK;
|
||||||
|
|
||||||
|
rowIndex++;
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
_wordDocument.PrintOut(Copies: _copies);
|
||||||
|
_wordDocument.Close(false);
|
||||||
|
_wordApp.Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
87
XLIMS.CORE/Helpers/Svid.cs
Normal file
87
XLIMS.CORE/Helpers/Svid.cs
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
|
namespace XLIMS.CORE.Helpers
|
||||||
|
{
|
||||||
|
public class Svid
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
|
||||||
|
|
||||||
|
public Svid(DMS document, XLAB7Repository repository, int copies = 1)
|
||||||
|
{
|
||||||
|
_copies = copies;
|
||||||
|
_document = document;
|
||||||
|
_repository = repository;
|
||||||
|
_fi = new FileInfo(@"Resources\DOCX\Svid.docx");
|
||||||
|
_wordApp = new Application();
|
||||||
|
_wordDocument = _wordApp.Documents.Open(_fi.FullName);
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
private Application _wordApp;
|
||||||
|
private Microsoft.Office.Interop.Word.Document _wordDocument;
|
||||||
|
private object _wFalse = false;
|
||||||
|
private object _wTrue = true;
|
||||||
|
private object _missing = null;
|
||||||
|
private FileInfo _fi;
|
||||||
|
private DMS _document;
|
||||||
|
private Table _table;
|
||||||
|
private int _copies;
|
||||||
|
private XLAB7Repository _repository;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Mehtods
|
||||||
|
|
||||||
|
private void Replace(string text, string replacementText)
|
||||||
|
{
|
||||||
|
Find find = _wordApp.Selection.Find;
|
||||||
|
find.Text = text;
|
||||||
|
find.Replacement.Text = replacementText;
|
||||||
|
find.Execute(FindText: Type.Missing,
|
||||||
|
MatchCase: false,
|
||||||
|
MatchWholeWord: false,
|
||||||
|
MatchWildcards: false,
|
||||||
|
MatchSoundsLike: Type.Missing,
|
||||||
|
MatchAllWordForms: false,
|
||||||
|
Forward: true,
|
||||||
|
Wrap: Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue,
|
||||||
|
Format: false,
|
||||||
|
ReplaceWith: Type.Missing,
|
||||||
|
Replace: Microsoft.Office.Interop.Word.WdReplace.wdReplaceAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Print()
|
||||||
|
{
|
||||||
|
var ekzmk = _repository.GetEKZMK().Result.FirstOrDefault(f => f.IDEKZMK == _document.IDOD);
|
||||||
|
Replace("number", _document.NND);
|
||||||
|
Replace("nextpovdate", ((DateTime)ekzmk.IDEKZNavigation.EKZMCP.FirstOrDefault().DTMKPLO).ToLongDateString());
|
||||||
|
Replace("name", ekzmk.IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.IDSPNMTPNavigation.NMTP);
|
||||||
|
Replace("serial", ekzmk.IDEKZNavigation.NNZV);
|
||||||
|
Replace("type", ekzmk.IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.TP);
|
||||||
|
Replace("gr", ekzmk.IDEKZNavigation.IDTPRZNavigation.IDTIPSNavigation.NNTPGR);
|
||||||
|
Replace("method", "");
|
||||||
|
Replace("temp", ekzmk.EKZMKFCTVL.FirstOrDefault(f=>f.IDSPIV==1000).ZNFCTVLMIN.ToString());
|
||||||
|
Replace("hum", ekzmk.EKZMKFCTVL.FirstOrDefault(f => f.IDSPIV == 1002).ZNFCTVLMIN.ToString());
|
||||||
|
Replace("press", ekzmk.EKZMKFCTVL.FirstOrDefault(f => f.IDSPIV == 1001).ZNFCTVLMIN.ToString());
|
||||||
|
Replace("count", "");
|
||||||
|
Replace("person", ekzmk.IDPRSNNavigation.PRFIO);
|
||||||
|
Replace("date", ((DateTime)ekzmk.DTMKFK).ToLongDateString());
|
||||||
|
_wordDocument.PrintOut(Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, _copies);
|
||||||
|
_wordDocument.Close(_wFalse);
|
||||||
|
_wordApp.Quit();
|
||||||
|
}
|
||||||
|
#endregion //Mehtods
|
||||||
|
}
|
||||||
|
}
|
||||||
3
XLIMS.CORE/Resources/CoreDictionary.xaml
Normal file
3
XLIMS.CORE/Resources/CoreDictionary.xaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
</ResourceDictionary>
|
||||||
BIN
XLIMS.CORE/Resources/DOCX/ClosePsv.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/ClosePsv.docx
Normal file
Binary file not shown.
BIN
XLIMS.CORE/Resources/DOCX/Izv.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/Izv.docx
Normal file
Binary file not shown.
BIN
XLIMS.CORE/Resources/DOCX/OpenPsv.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/OpenPsv.docx
Normal file
Binary file not shown.
BIN
XLIMS.CORE/Resources/DOCX/Svid.docx
Normal file
BIN
XLIMS.CORE/Resources/DOCX/Svid.docx
Normal file
Binary file not shown.
73
XLIMS.CORE/ViewModels/MainViewModel.cs
Normal file
73
XLIMS.CORE/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.CORE.Windows;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
|
||||||
|
namespace XLIMS.CORE.ViewModels
|
||||||
|
{
|
||||||
|
public class MainViewModel:ViewModelBase
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public MainViewModel(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
_serviceProvider = serviceProvider;
|
||||||
|
|
||||||
|
// Регистрация доступных activities
|
||||||
|
Activities.Add(serviceProvider.GetRequiredService<XLIMS.PSV.ViewModels.MainViewModel>());
|
||||||
|
Activities.Add(serviceProvider.GetRequiredService<XLIMS.DEV.ViewModels.MainViewModel>());
|
||||||
|
Activities.Add(serviceProvider.GetRequiredService<XLIMS.SP.ViewModels.MainViewModel>());
|
||||||
|
Activities.Add(serviceProvider.GetRequiredService<XLIMS.TPRZ.ViewModels.MainViewModel>());
|
||||||
|
|
||||||
|
// По умолчанию открываем первую
|
||||||
|
CurrentActivity = Activities.FirstOrDefault();
|
||||||
|
|
||||||
|
NavigateCommand = new RelayCommand<IActivityViewModel>(Navigate);
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
public readonly IServiceProvider _serviceProvider;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public ObservableCollection<IActivityViewModel> Activities { get; }
|
||||||
|
= new ObservableCollection<IActivityViewModel>();
|
||||||
|
|
||||||
|
private IActivityViewModel _currentActivity;
|
||||||
|
public IActivityViewModel CurrentActivity
|
||||||
|
{
|
||||||
|
get => _currentActivity;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_currentActivity != value)
|
||||||
|
{
|
||||||
|
_currentActivity = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
private void Navigate(IActivityViewModel vm)
|
||||||
|
{
|
||||||
|
if (vm != null)
|
||||||
|
CurrentActivity = vm;
|
||||||
|
}
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
public ICommand NavigateCommand { get; }
|
||||||
|
#endregion //Commands
|
||||||
|
}
|
||||||
|
}
|
||||||
42
XLIMS.CORE/Windows/EditWindow.xaml
Normal file
42
XLIMS.CORE/Windows/EditWindow.xaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="XLIMS.CORE.Windows.EditWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="{Binding Title}"
|
||||||
|
DataContext="{Binding}"
|
||||||
|
ShowInTaskbar="True"
|
||||||
|
SizeToContent="WidthAndHeight"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="ToolWindow">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="../Resources/CoreDictionary.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<DockPanel
|
||||||
|
Margin="10"
|
||||||
|
DockPanel.Dock="Bottom"
|
||||||
|
LastChildFill="False">
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Click="Button_Click_1"
|
||||||
|
Command="{Binding CancelCommand}"
|
||||||
|
Content="Отмена"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsCancel="True" />
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Margin="0,0,10,0"
|
||||||
|
Click="Button_Click_2"
|
||||||
|
Command="{Binding SaveCommand}"
|
||||||
|
Content="ОК"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsDefault="True" />
|
||||||
|
</DockPanel>
|
||||||
|
<ContentControl Content="{Binding}" />
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
37
XLIMS.CORE/Windows/EditWindow.xaml.cs
Normal file
37
XLIMS.CORE/Windows/EditWindow.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.CORE.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для EditWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EditWindow : Window
|
||||||
|
{
|
||||||
|
public EditWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
XLIMS.CORE/Windows/MainWindow.xaml
Normal file
22
XLIMS.CORE/Windows/MainWindow.xaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<Window x:Class="XLIMS.CORE.Windows.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="XLIMS"
|
||||||
|
WindowState="Maximized">
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<Border DockPanel.Dock="Left" Width="40"
|
||||||
|
Background="Gray">
|
||||||
|
<ListBox ItemsSource="{Binding Activities}"
|
||||||
|
SelectedItem="{Binding CurrentActivity,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Title}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Border>
|
||||||
|
<ContentControl DataContext="{Binding CurrentActivity}" Content="{Binding View}"/>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
|
|
||||||
|
|
||||||
42
XLIMS.CORE/Windows/MainWindow.xaml.cs
Normal file
42
XLIMS.CORE/Windows/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
using XLIMS.CORE.ViewModels;
|
||||||
|
|
||||||
|
namespace XLIMS.CORE.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow(MainViewModel viewModel)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
DataContext = viewModel; // ViewModel уже содержит ILimsService и все подсервисы
|
||||||
|
|
||||||
|
// При необходимости загружаем данные
|
||||||
|
if (viewModel is MainViewModel vm)
|
||||||
|
{
|
||||||
|
//vm.LoadDataAsync(); // или Loaded событие
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
// {
|
||||||
|
// if (e.ChangedButton == MouseButton.Left)
|
||||||
|
// DragMove();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// private void Minimize_Click(object sender, RoutedEventArgs e) => WindowState = WindowState.Minimized;
|
||||||
|
// private void Maximize_Click(object sender, RoutedEventArgs e) => WindowState = WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized;
|
||||||
|
// private void Close_Click(object sender, RoutedEventArgs e) => Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
28
XLIMS.CORE/XLIMS.CORE.csproj
Normal file
28
XLIMS.CORE/XLIMS.CORE.csproj
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Helpers\**" />
|
||||||
|
<EmbeddedResource Remove="Helpers\**" />
|
||||||
|
<None Remove="Helpers\**" />
|
||||||
|
<Page Remove="Helpers\**" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.MVVM\XLIMS.MVVM.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.PSV\XLIMS.PSV.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.SERVICES\XLIMS.SERVICES.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Views\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
10
XLIMS.DATA/AssemblyInfo.cs
Normal file
10
XLIMS.DATA/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
11
XLIMS.DATA/Models/BookSet.cs
Normal file
11
XLIMS.DATA/Models/BookSet.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class BookSet
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? Number { get; set; }
|
||||||
|
}
|
||||||
35
XLIMS.DATA/Models/DataSet.cs
Normal file
35
XLIMS.DATA/Models/DataSet.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class DataSet
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int DeviceId { get; set; }
|
||||||
|
|
||||||
|
public int DocumentId { get; set; }
|
||||||
|
|
||||||
|
public int? Count { get; set; }
|
||||||
|
|
||||||
|
public string? Zip { get; set; }
|
||||||
|
|
||||||
|
public string? Reason { get; set; }
|
||||||
|
|
||||||
|
public DateTime? Date { get; set; }
|
||||||
|
|
||||||
|
public bool? Gdn { get; set; }
|
||||||
|
|
||||||
|
public int? Nkl { get; set; }
|
||||||
|
|
||||||
|
public string? Person { get; set; }
|
||||||
|
|
||||||
|
public int? DocumentPovId { get; set; }
|
||||||
|
|
||||||
|
public virtual DeviceSet Device { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual DocumentSet Document { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual DocumentSet? DocumentPov { get; set; }
|
||||||
|
}
|
||||||
31
XLIMS.DATA/Models/DeviceSet.cs
Normal file
31
XLIMS.DATA/Models/DeviceSet.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class DeviceSet
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int DivisionId { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
public string? Tip { get; set; }
|
||||||
|
|
||||||
|
public string? Serial { get; set; }
|
||||||
|
|
||||||
|
public DateTime? NextPovDate { get; set; }
|
||||||
|
|
||||||
|
public string? Status { get; set; }
|
||||||
|
public string? Dpzn { get; set; }
|
||||||
|
public string? Hrtc { get; set; }
|
||||||
|
|
||||||
|
public string? Gsrs { get; set; }
|
||||||
|
|
||||||
|
public string? Oi { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<DataSet> DataSets { get; set; } = new List<DataSet>();
|
||||||
|
|
||||||
|
public virtual DivisionSet Division { get; set; } = null!;
|
||||||
|
}
|
||||||
23
XLIMS.DATA/Models/DivisionSet.cs
Normal file
23
XLIMS.DATA/Models/DivisionSet.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class DivisionSet
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
public string? Person { get; set; }
|
||||||
|
|
||||||
|
public string? Adress { get; set; }
|
||||||
|
|
||||||
|
public string? Telefon { get; set; }
|
||||||
|
|
||||||
|
public int? Kdl { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<DeviceSet> DeviceSets { get; set; } = new List<DeviceSet>();
|
||||||
|
|
||||||
|
public virtual ICollection<DocumentSet> DocumentSets { get; set; } = new List<DocumentSet>();
|
||||||
|
}
|
||||||
35
XLIMS.DATA/Models/DocumentSet.cs
Normal file
35
XLIMS.DATA/Models/DocumentSet.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class DocumentSet
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public int DivisionId { get; set; }
|
||||||
|
|
||||||
|
public string? Name { get; set; }
|
||||||
|
|
||||||
|
public string? Number { get; set; }
|
||||||
|
|
||||||
|
public DateTime? DocDate { get; set; }
|
||||||
|
|
||||||
|
public DateTime? RegDate { get; set; }
|
||||||
|
|
||||||
|
public string? Status { get; set; }
|
||||||
|
|
||||||
|
public DateTime? OutDate { get; set; }
|
||||||
|
|
||||||
|
public DateTime? InDate { get; set; }
|
||||||
|
|
||||||
|
public string? InPerson { get; set; }
|
||||||
|
|
||||||
|
public string? OutPerson { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<DataSet> DataSetDocumentPovs { get; set; } = new List<DataSet>();
|
||||||
|
|
||||||
|
public virtual ICollection<DataSet> DataSetDocuments { get; set; } = new List<DataSet>();
|
||||||
|
|
||||||
|
public virtual DivisionSet Division { get; set; } = null!;
|
||||||
|
}
|
||||||
189
XLIMS.DATA/Models/LimsdbContext.cs
Normal file
189
XLIMS.DATA/Models/LimsdbContext.cs
Normal file
@@ -0,0 +1,189 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class LimsdbContext : DbContext
|
||||||
|
{
|
||||||
|
public LimsdbContext()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public LimsdbContext(DbContextOptions<LimsdbContext> options)
|
||||||
|
: base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual DbSet<BookSet> BookSets { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<DataSet> DataSets { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<DeviceSet> DeviceSets { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<DivisionSet> DivisionSets { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<DocumentSet> DocumentSets { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<PersonalSet> PersonalSets { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Spnmtp> Spnmtps { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Spoi> Spois { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Tip> Tips { get; set; }
|
||||||
|
|
||||||
|
public virtual DbSet<Tprz> Tprzs { get; set; }
|
||||||
|
|
||||||
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
{
|
||||||
|
optionsBuilder.UseLazyLoadingProxies();
|
||||||
|
var config = new ConfigurationBuilder()
|
||||||
|
.AddJsonFile("appsettings.json")
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
//optionsBuilder.UseSqlServer("Data Source=SEVENHILL\\SQLEXPRESS;Initial Catalog=LIMSDB;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True;");
|
||||||
|
optionsBuilder.UseSqlServer(config.GetConnectionString("DefaultConnection"));
|
||||||
|
}
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
modelBuilder.Entity<BookSet>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("BookSet");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DataSet>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DataSet");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.DeviceId, "IX_FK_DeviceData");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.DocumentId, "IX_FK_DocumentData");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.DocumentPovId, "IX_FK_DocumentSetDataSet");
|
||||||
|
|
||||||
|
entity.Property(e => e.Date).HasColumnType("datetime");
|
||||||
|
entity.Property(e => e.Gdn).HasColumnName("GDN");
|
||||||
|
entity.Property(e => e.Nkl).HasColumnName("Nkl");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Device).WithMany(p => p.DataSets)
|
||||||
|
.HasForeignKey(d => d.DeviceId)
|
||||||
|
.HasConstraintName("FK_DeviceData");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Document).WithMany(p => p.DataSetDocuments)
|
||||||
|
.HasForeignKey(d => d.DocumentId)
|
||||||
|
.HasConstraintName("FK_DocumentData");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.DocumentPov).WithMany(p => p.DataSetDocumentPovs)
|
||||||
|
.HasForeignKey(d => d.DocumentPovId)
|
||||||
|
.HasConstraintName("FK_DocumentSetDataSet");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DeviceSet>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DeviceSet");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.DivisionId, "IX_FK_DivisionDevice");
|
||||||
|
|
||||||
|
entity.Property(e => e.Gsrs).HasColumnName("GSRS");
|
||||||
|
entity.Property(e => e.NextPovDate).HasColumnType("datetime");
|
||||||
|
entity.Property(e => e.Oi).HasColumnName("OI");
|
||||||
|
entity.Property(e => e.Status).HasColumnName("Status");
|
||||||
|
entity.Property(e => e.Dpzn).HasColumnName("Dpzn");
|
||||||
|
entity.Property(e => e.Hrtc).HasColumnName("Hrtc");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Division).WithMany(p => p.DeviceSets)
|
||||||
|
.HasForeignKey(d => d.DivisionId)
|
||||||
|
.HasConstraintName("FK_DivisionDevice");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DivisionSet>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DivisionSet");
|
||||||
|
|
||||||
|
entity.Property(e => e.Kdl).HasColumnName("KDL");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<DocumentSet>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("DocumentSet");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.DivisionId, "IX_FK_DivisionDocument");
|
||||||
|
|
||||||
|
entity.Property(e => e.DocDate).HasColumnType("datetime");
|
||||||
|
entity.Property(e => e.InDate).HasColumnType("datetime");
|
||||||
|
entity.Property(e => e.OutDate).HasColumnType("datetime");
|
||||||
|
entity.Property(e => e.RegDate).HasColumnType("datetime");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.Division).WithMany(p => p.DocumentSets)
|
||||||
|
.HasForeignKey(d => d.DivisionId)
|
||||||
|
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||||
|
.HasConstraintName("FK_DivisionDocument");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<PersonalSet>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("PersonalSet");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Spnmtp>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("SPNMTP");
|
||||||
|
|
||||||
|
entity.Property(e => e.Nmtp).HasColumnName("NMTP");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Spoi>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("SPOI");
|
||||||
|
|
||||||
|
entity.Property(e => e.Nmoi).HasColumnName("NMOI");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Tip>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("TIP");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Idspnmtp, "IX_FK_SPNMTPTIP");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Idspoi, "IX_FK_SPOITIP");
|
||||||
|
|
||||||
|
entity.Property(e => e.Idspnmtp).HasColumnName("IDSPNMTP");
|
||||||
|
entity.Property(e => e.Idspoi).HasColumnName("IDSPOI");
|
||||||
|
entity.Property(e => e.Tp).HasColumnName("TP");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdspnmtpNavigation).WithMany(p => p.Tips)
|
||||||
|
.HasForeignKey(d => d.Idspnmtp)
|
||||||
|
.HasConstraintName("FK_SPNMTPTIP");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdspoiNavigation).WithMany(p => p.Tips)
|
||||||
|
.HasForeignKey(d => d.Idspoi)
|
||||||
|
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||||
|
.HasConstraintName("FK_SPOITIP");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity<Tprz>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("TPRZ");
|
||||||
|
|
||||||
|
entity.HasIndex(e => e.Idtip, "IX_FK_TIPTPRZ");
|
||||||
|
|
||||||
|
entity.Property(e => e.Dpzn).HasColumnName("DPZN");
|
||||||
|
entity.Property(e => e.Gsrs).HasColumnName("GSRS");
|
||||||
|
entity.Property(e => e.Hrtc).HasColumnName("HRTC");
|
||||||
|
entity.Property(e => e.Idtip).HasColumnName("IDTIP");
|
||||||
|
entity.Property(e => e.Prmk).HasColumnName("PRMK");
|
||||||
|
|
||||||
|
entity.HasOne(d => d.IdtipNavigation).WithMany(p => p.Tprzs)
|
||||||
|
.HasForeignKey(d => d.Idtip)
|
||||||
|
.HasConstraintName("FK_TIPTPRZ");
|
||||||
|
});
|
||||||
|
|
||||||
|
OnModelCreatingPartial(modelBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||||
|
}
|
||||||
13
XLIMS.DATA/Models/PersonalSet.cs
Normal file
13
XLIMS.DATA/Models/PersonalSet.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class PersonalSet
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? Person { get; set; }
|
||||||
|
|
||||||
|
public string? Status { get; set; }
|
||||||
|
}
|
||||||
13
XLIMS.DATA/Models/Spnmtp.cs
Normal file
13
XLIMS.DATA/Models/Spnmtp.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class Spnmtp
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? Nmtp { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Tip> Tips { get; set; } = new List<Tip>();
|
||||||
|
}
|
||||||
13
XLIMS.DATA/Models/Spoi.cs
Normal file
13
XLIMS.DATA/Models/Spoi.cs
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class Spoi
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? Nmoi { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<Tip> Tips { get; set; } = new List<Tip>();
|
||||||
|
}
|
||||||
21
XLIMS.DATA/Models/Tip.cs
Normal file
21
XLIMS.DATA/Models/Tip.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class Tip
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? Tp { get; set; }
|
||||||
|
|
||||||
|
public int Idspoi { get; set; }
|
||||||
|
|
||||||
|
public int Idspnmtp { get; set; }
|
||||||
|
|
||||||
|
public virtual Spnmtp IdspnmtpNavigation { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual Spoi IdspoiNavigation { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual ICollection<Tprz> Tprzs { get; set; } = new List<Tprz>();
|
||||||
|
}
|
||||||
21
XLIMS.DATA/Models/Tprz.cs
Normal file
21
XLIMS.DATA/Models/Tprz.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
public partial class Tprz
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
|
public string? Dpzn { get; set; }
|
||||||
|
|
||||||
|
public string? Hrtc { get; set; }
|
||||||
|
|
||||||
|
public string? Gsrs { get; set; }
|
||||||
|
|
||||||
|
public int? Prmk { get; set; }
|
||||||
|
|
||||||
|
public int Idtip { get; set; }
|
||||||
|
|
||||||
|
public virtual Tip IdtipNavigation { get; set; } = null!;
|
||||||
|
}
|
||||||
85
XLIMS.DATA/XLIMS.DATA.csproj
Normal file
85
XLIMS.DATA/XLIMS.DATA.csproj
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\cs\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\de\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\es\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\fr\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\it\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\ja\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\ko\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\Microsoft.Build.Locator.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe.config" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\Microsoft.IO.Redist.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\Newtonsoft.Json.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\pl\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\pt-BR\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\ru\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\System.Buffers.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\System.Collections.Immutable.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\System.CommandLine.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\System.Memory.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\System.Numerics.Vectors.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\System.Runtime.CompilerServices.Unsafe.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\System.Threading.Tasks.Extensions.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\tr\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\zh-Hans\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-net472\zh-Hant\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\cs\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\de\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\es\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\fr\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\it\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\ja\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\ko\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\Microsoft.Build.Locator.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.deps.json" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.dll.config" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.runtimeconfig.json" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\Newtonsoft.Json.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\pl\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\pt-BR\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\ru\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\System.Collections.Immutable.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\System.CommandLine.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\tr\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\zh-Hans\System.CommandLine.resources.dll" />
|
||||||
|
<Content Remove="C:\Users\seven\.nuget\packages\microsoft.codeanalysis.workspaces.msbuild\4.14.0\contentFiles\any\any\BuildHost-netcore\zh-Hant\System.CommandLine.resources.dll" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.1">
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="appsettings.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Models\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
5
XLIMS.DATA/appsettings.json
Normal file
5
XLIMS.DATA/appsettings.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"ConnectionStrings": {
|
||||||
|
"DefaultConnection": "Data Source=SEVENHILL\\SQLEXPRESS;Initial Catalog=LIMSDB;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True;"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
XLIMS.DEV/AssemblyInfo.cs
Normal file
10
XLIMS.DEV/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
8
XLIMS.DEV/Resources/DevDictionary.xaml
Normal file
8
XLIMS.DEV/Resources/DevDictionary.xaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="clr-namespace:XLIMS.DEV.ViewModels"
|
||||||
|
xmlns:v="clr-namespace:XLIMS.DEV.Views">
|
||||||
|
<DataTemplate DataType="{x:Type vm:DeviceViewModel}">
|
||||||
|
<v:DeviceView/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ResourceDictionary>
|
||||||
84
XLIMS.DEV/ViewModels/DeviceViewModel.cs
Normal file
84
XLIMS.DEV/ViewModels/DeviceViewModel.cs
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
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.DEV.ViewModels
|
||||||
|
{
|
||||||
|
public class DeviceViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public DeviceViewModel(ILimsService limsService,Spoi spoi, Tip tip = null)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
if (tip != null) _tip = tip;
|
||||||
|
else _tip = new Tip() {IdspoiNavigation=spoi };
|
||||||
|
LoadSpnmtpAsync();
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
private readonly Tip _tip;
|
||||||
|
private Spnmtp _currentSpnmtp;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public ObservableCollection<Spnmtp> AllSpnmtps { get; set; } = new();
|
||||||
|
public Spnmtp CurrentSpnmtp
|
||||||
|
{
|
||||||
|
get=> _currentSpnmtp;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentSpnmtp = value;
|
||||||
|
if (_currentSpnmtp != null) _tip.IdspnmtpNavigation = _currentSpnmtp;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string? Tp
|
||||||
|
{
|
||||||
|
get => _tip.Tp;
|
||||||
|
set { _tip.Tp = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public int Id => _tip.Id;
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
public async Task LoadSpnmtpAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Параллельная загрузка данных из разных доменов через подсервисы
|
||||||
|
var spnmtpsTask = await _limsService.Spnmtps.GetAllAsync();
|
||||||
|
|
||||||
|
AllSpnmtps = new ObservableCollection<Spnmtp>(spnmtpsTask);
|
||||||
|
OnPropertyChanged(nameof(AllSpnmtps));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private async Task SaveAsync()
|
||||||
|
{
|
||||||
|
if (_tip.Id == 0) await _limsService.Tips.AddAsync(_tip);
|
||||||
|
else await _limsService.Tips.UpdateAsync(_tip);
|
||||||
|
}
|
||||||
|
public async Task Remove()
|
||||||
|
{
|
||||||
|
await _limsService.Tips.RemoveAsync(_tip);
|
||||||
|
}
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync);
|
||||||
|
#endregion //Commands
|
||||||
|
}
|
||||||
|
}
|
||||||
48
XLIMS.DEV/ViewModels/MainViewModel.cs
Normal file
48
XLIMS.DEV/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
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;
|
||||||
|
using XLIMS.DEV.Views;
|
||||||
|
|
||||||
|
namespace XLIMS.DEV.ViewModels
|
||||||
|
{
|
||||||
|
public class MainViewModel : ViewModelBase,IActivityViewModel
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public MainViewModel(ILimsService limsService, IDialogService dialogService)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
_dialogService = dialogService;
|
||||||
|
//LoadSpoiAsync();
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
private readonly IDialogService _dialogService;
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public string Title => "Приборы";
|
||||||
|
public object View => new MainView();
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion //Commands
|
||||||
|
}
|
||||||
|
}
|
||||||
12
XLIMS.DEV/Views/DeviceView.xaml
Normal file
12
XLIMS.DEV/Views/DeviceView.xaml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<UserControl x:Class="XLIMS.DEV.Views.DeviceView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:XLIMS.DEV.Views"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
26
XLIMS.DEV/Views/DeviceView.xaml.cs
Normal file
26
XLIMS.DEV/Views/DeviceView.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.DEV.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для DeviceView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class DeviceView : UserControl
|
||||||
|
{
|
||||||
|
public DeviceView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
XLIMS.DEV/Views/MainView.xaml
Normal file
8
XLIMS.DEV/Views/MainView.xaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<UserControl x:Class="XLIMS.DEV.Views.MainView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
>
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="{Binding Title}"/>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
26
XLIMS.DEV/Views/MainView.xaml.cs
Normal file
26
XLIMS.DEV/Views/MainView.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.DEV.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для MainView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainView : UserControl
|
||||||
|
{
|
||||||
|
public MainView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
XLIMS.DEV/Windows/EditWindow.xaml
Normal file
42
XLIMS.DEV/Windows/EditWindow.xaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="XLIMS.DEV.Windows.EditWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="{Binding Title}"
|
||||||
|
DataContext="{Binding}"
|
||||||
|
ShowInTaskbar="True"
|
||||||
|
SizeToContent="WidthAndHeight"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="ToolWindow">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="../Resources/CoreDictionary.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<DockPanel
|
||||||
|
Margin="10"
|
||||||
|
DockPanel.Dock="Bottom"
|
||||||
|
LastChildFill="False">
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Click="Button_Click_1"
|
||||||
|
Command="{Binding CancelCommand}"
|
||||||
|
Content="Отмена"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsCancel="True" />
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Margin="0,0,10,0"
|
||||||
|
Click="Button_Click_2"
|
||||||
|
Command="{Binding SaveCommand}"
|
||||||
|
Content="ОК"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsDefault="True" />
|
||||||
|
</DockPanel>
|
||||||
|
<ContentControl Content="{Binding}" />
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
37
XLIMS.DEV/Windows/EditWindow.xaml.cs
Normal file
37
XLIMS.DEV/Windows/EditWindow.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.DEV.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для EditWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EditWindow : Window
|
||||||
|
{
|
||||||
|
public EditWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
XLIMS.DEV/XLIMS.DEV.csproj
Normal file
22
XLIMS.DEV/XLIMS.DEV.csproj
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\XLIMS.CONTRACT\XLIMS.CONTRACT.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.MVVM\XLIMS.MVVM.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Views\MainView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
10
XLIMS.MVVM/AssemblyInfo.cs
Normal file
10
XLIMS.MVVM/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
112
XLIMS.MVVM/Base/AsyncRelayCommand.cs
Normal file
112
XLIMS.MVVM/Base/AsyncRelayCommand.cs
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Base
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Асинхронная команда без параметра.
|
||||||
|
/// </summary>
|
||||||
|
public class AsyncRelayCommand : ICommand
|
||||||
|
{
|
||||||
|
private readonly Func<Task> _execute;
|
||||||
|
private readonly Func<bool>? _canExecute;
|
||||||
|
|
||||||
|
private bool _isExecuting;
|
||||||
|
|
||||||
|
public AsyncRelayCommand(Func<Task> execute, Func<bool>? canExecute = null)
|
||||||
|
{
|
||||||
|
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object? parameter)
|
||||||
|
{
|
||||||
|
if (_isExecuting) return false;
|
||||||
|
return _canExecute == null || _canExecute();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Execute(object? parameter)
|
||||||
|
{
|
||||||
|
if (!CanExecute(parameter)) return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_isExecuting = true;
|
||||||
|
CommandManager.InvalidateRequerySuggested();
|
||||||
|
|
||||||
|
await _execute();
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isExecuting = false;
|
||||||
|
CommandManager.InvalidateRequerySuggested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler? CanExecuteChanged
|
||||||
|
{
|
||||||
|
add { CommandManager.RequerySuggested += value; }
|
||||||
|
remove { CommandManager.RequerySuggested -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// Удобный статический метод для создания из метода с параметром (если вдруг понадобится)
|
||||||
|
public static AsyncRelayCommand FromAsync(Func<object?, Task> execute, Func<object?, bool>? canExecute = null)
|
||||||
|
{
|
||||||
|
return new AsyncRelayCommand(() => execute(null), canExecute == null ? null : () => canExecute(null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Асинхронная команда с параметром (типизированная).
|
||||||
|
/// </summary>
|
||||||
|
public class AsyncRelayCommand<T> : ICommand
|
||||||
|
{
|
||||||
|
private readonly Func<T?, Task> _execute;
|
||||||
|
private readonly Predicate<T?>? _canExecute;
|
||||||
|
|
||||||
|
private bool _isExecuting;
|
||||||
|
|
||||||
|
public AsyncRelayCommand(Func<T?, Task> execute, Predicate<T?>? canExecute = null)
|
||||||
|
{
|
||||||
|
_execute = execute ?? throw new ArgumentNullException(nameof(execute));
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object? parameter)
|
||||||
|
{
|
||||||
|
if (_isExecuting) return false;
|
||||||
|
if (_canExecute == null) return true;
|
||||||
|
|
||||||
|
// Если параметр неправильного типа — считаем, что нельзя выполнить
|
||||||
|
return parameter is T typedParam && _canExecute(typedParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async void Execute(object? parameter)
|
||||||
|
{
|
||||||
|
if (!CanExecute(parameter)) return;
|
||||||
|
|
||||||
|
T? typedParam = parameter is T p ? p : default;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_isExecuting = true;
|
||||||
|
CommandManager.InvalidateRequerySuggested();
|
||||||
|
|
||||||
|
await _execute(typedParam);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
_isExecuting = false;
|
||||||
|
CommandManager.InvalidateRequerySuggested();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler? CanExecuteChanged
|
||||||
|
{
|
||||||
|
add { CommandManager.RequerySuggested += value; }
|
||||||
|
remove { CommandManager.RequerySuggested -= value; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
89
XLIMS.MVVM/Base/RelayCommand.cs
Normal file
89
XLIMS.MVVM/Base/RelayCommand.cs
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Base
|
||||||
|
{
|
||||||
|
public class RelayCommand : ICommand
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
readonly Action<object> _execute;
|
||||||
|
readonly Predicate<object> _canExecute;
|
||||||
|
|
||||||
|
#endregion // Fields
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new command that can always execute.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="execute">The execution logic.</param>
|
||||||
|
public RelayCommand(Action<object> execute)
|
||||||
|
: this(execute, null)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new command.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="execute">The execution logic.</param>
|
||||||
|
/// <param name="canExecute">The execution status logic.</param>
|
||||||
|
public RelayCommand(Action<object> execute, Predicate<object> canExecute)
|
||||||
|
{
|
||||||
|
if (execute == null)
|
||||||
|
throw new ArgumentNullException("execute");
|
||||||
|
|
||||||
|
_execute = execute;
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // Constructors
|
||||||
|
|
||||||
|
#region ICommand Members
|
||||||
|
|
||||||
|
[DebuggerStepThrough]
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
return _canExecute == null ? true : _canExecute(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged
|
||||||
|
{
|
||||||
|
add { CommandManager.RequerySuggested += value; }
|
||||||
|
remove { CommandManager.RequerySuggested -= value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(object parameter)
|
||||||
|
{
|
||||||
|
_execute(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion // ICommand Members
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RelayCommand<T> : ICommand
|
||||||
|
{
|
||||||
|
private readonly Action<T> _execute;
|
||||||
|
private readonly Func<T, bool> _canExecute;
|
||||||
|
|
||||||
|
public RelayCommand(Action<T> execute, Func<T, bool> canExecute = null)
|
||||||
|
{
|
||||||
|
_execute = execute;
|
||||||
|
_canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
=> _canExecute == null || _canExecute((T)parameter);
|
||||||
|
|
||||||
|
public void Execute(object parameter)
|
||||||
|
=> _execute((T)parameter);
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged
|
||||||
|
{
|
||||||
|
add => CommandManager.RequerySuggested += value;
|
||||||
|
remove => CommandManager.RequerySuggested -= value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
25
XLIMS.MVVM/Base/ViewModelBase.cs
Normal file
25
XLIMS.MVVM/Base/ViewModelBase.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Base
|
||||||
|
{
|
||||||
|
public abstract class ViewModelBase : INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
protected void OnPropertyChanged([CallerMemberName] String propertyName="")
|
||||||
|
{
|
||||||
|
PropertyChangedEventHandler handler = PropertyChanged;
|
||||||
|
|
||||||
|
if (handler != null)
|
||||||
|
{
|
||||||
|
handler(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
31
XLIMS.MVVM/Converters/BoolConverter.cs
Normal file
31
XLIMS.MVVM/Converters/BoolConverter.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Converters
|
||||||
|
{
|
||||||
|
[ValueConversion(typeof(Boolean), typeof(String))]
|
||||||
|
public class BoolConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Boolean data = (Boolean)value;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
catch { return value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string strValue = value.ToString();
|
||||||
|
Boolean resultData;
|
||||||
|
if (Boolean.TryParse(strValue, out resultData))
|
||||||
|
{
|
||||||
|
return resultData;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
XLIMS.MVVM/Converters/CompositeCollectionConverter.cs
Normal file
35
XLIMS.MVVM/Converters/CompositeCollectionConverter.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Windows.Data;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Converters
|
||||||
|
{
|
||||||
|
[ValueConversion(typeof(object),typeof(CompositeCollection))]
|
||||||
|
public class CompositeCollectionConverter : IMultiValueConverter
|
||||||
|
{
|
||||||
|
|
||||||
|
public object Convert(object[] values
|
||||||
|
, Type targetType
|
||||||
|
, object parameter
|
||||||
|
, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
var res = new CompositeCollection();
|
||||||
|
foreach (var item in values)
|
||||||
|
if (item is IEnumerable)
|
||||||
|
res.Add(new CollectionContainer()
|
||||||
|
{
|
||||||
|
Collection = item as IEnumerable
|
||||||
|
});
|
||||||
|
else res.Add(item);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object[] ConvertBack(object value
|
||||||
|
, Type[] targetTypes
|
||||||
|
, object parameter
|
||||||
|
, System.Globalization.CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
25
XLIMS.MVVM/Converters/DateConverter.cs
Normal file
25
XLIMS.MVVM/Converters/DateConverter.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Converters
|
||||||
|
{
|
||||||
|
[ValueConversion(typeof(DateTime), typeof(string))]
|
||||||
|
public class DateConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (!(value is DateTime)) return string.Empty;
|
||||||
|
DateTime test = (DateTime)value;
|
||||||
|
string date = test.ToString();
|
||||||
|
return (date);
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var strValue = value.ToString();
|
||||||
|
DateTime resultDateTime;
|
||||||
|
return DateTime.TryParse(strValue, out resultDateTime) ? resultDateTime : value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
34
XLIMS.MVVM/Converters/ImageConverter.cs
Normal file
34
XLIMS.MVVM/Converters/ImageConverter.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Converters
|
||||||
|
{
|
||||||
|
[ValueConversion(typeof(Byte[]), typeof(Image))]
|
||||||
|
public class ImageConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var ms = new MemoryStream((byte[])value);
|
||||||
|
var returnImage = Image.FromStream(ms);
|
||||||
|
return returnImage;
|
||||||
|
}
|
||||||
|
catch { return value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
//MemoryStream ms = new MemoryStream();
|
||||||
|
//value.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
XLIMS.MVVM/Converters/VisibilityConverter.cs
Normal file
32
XLIMS.MVVM/Converters/VisibilityConverter.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace XLIMS.MVVM.Converters
|
||||||
|
{
|
||||||
|
[ValueConversion(typeof(string), typeof(Visibility))]
|
||||||
|
public class VisibilityConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value != null)
|
||||||
|
{
|
||||||
|
return Visibility.Visible;
|
||||||
|
//string s = value.ToString();
|
||||||
|
//object s1 = value;
|
||||||
|
//if (s1 is decimal)
|
||||||
|
// if ((decimal.Parse(s1.ToString())) == 0) return Visibility.Collapsed;
|
||||||
|
//if (s1 is bool)
|
||||||
|
// if ((bool.Parse(s1.ToString())) == false) return Visibility.Collapsed;
|
||||||
|
//if (string.IsNullOrEmpty(s)) return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
return Visibility.Collapsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
XLIMS.MVVM/XLIMS.MVVM.csproj
Normal file
10
XLIMS.MVVM/XLIMS.MVVM.csproj
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
10
XLIMS.PSV/AssemblyInfo.cs
Normal file
10
XLIMS.PSV/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
16
XLIMS.PSV/Resources/PsvDictionary.xaml
Normal file
16
XLIMS.PSV/Resources/PsvDictionary.xaml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="clr-namespace:XLIMS.PSV.ViewModels"
|
||||||
|
xmlns:v="clr-namespace:XLIMS.PSV.Views">
|
||||||
|
<DataTemplate DataType="{x:Type vm:BrowseSerialViewModel}">
|
||||||
|
<v:BrowseSerialView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:BrowseTprzViewModel}">
|
||||||
|
<v:BrowseTprzView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:BadViewModel}">
|
||||||
|
<v:BadView/>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
|
|
||||||
141
XLIMS.PSV/ViewModels/BadViewModel.cs
Normal file
141
XLIMS.PSV/ViewModels/BadViewModel.cs
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System.IO;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
public class BadViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public BadViewModel(ILimsService limsService, DataSet data)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
_currentData = data;
|
||||||
|
if (_currentData.Gdn == null)
|
||||||
|
{
|
||||||
|
_povDoc = new DocumentSet() { Division = _currentData.Device.Division,Name="Извещение" };
|
||||||
|
_currentData.DocumentPov = _povDoc;
|
||||||
|
}
|
||||||
|
else if (_currentData.DocumentPov != null) _povDoc = _currentData.DocumentPov;
|
||||||
|
LoadDataAsync();
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
private DataSet _currentData;
|
||||||
|
private bool _isValid;
|
||||||
|
private PersonalSet _currentPersonal;
|
||||||
|
private DocumentSet _povDoc;
|
||||||
|
private BookSet _currentBook;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public string Title => $"{_currentData.Device.Tip} №{_currentData.Device.Serial} {_currentData.Device.Name}";
|
||||||
|
public ObservableCollection<PersonalSet> AllPersonals { get; set; }
|
||||||
|
public ObservableCollection<BookSet> AllBooks { get; set; }
|
||||||
|
public BookSet CurrentBook
|
||||||
|
{
|
||||||
|
get => _currentBook;
|
||||||
|
set { _currentBook = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public PersonalSet CurrentPersonal
|
||||||
|
{
|
||||||
|
get => _currentPersonal;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentPersonal = value;
|
||||||
|
if (_currentPersonal != null) { _currentData.Person = _currentPersonal.Person; }
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DateTime? PovDate
|
||||||
|
{
|
||||||
|
get => _currentData.Date;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentData.Date = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Reason
|
||||||
|
{
|
||||||
|
get => _currentData.Reason;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentData.Reason = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Number
|
||||||
|
{
|
||||||
|
get => _povDoc.Number;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_povDoc.Number = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DateTime? DocDate
|
||||||
|
{
|
||||||
|
get => _povDoc.DocDate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_povDoc.DocDate = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private async Task LoadDataAsync()
|
||||||
|
{
|
||||||
|
var personalTask = await _limsService.Personals.GetAllAsync();
|
||||||
|
var bookTask=await _limsService.Books.GetAllAsync();
|
||||||
|
AllPersonals=new ObservableCollection<PersonalSet>(personalTask);
|
||||||
|
AllBooks=new ObservableCollection<BookSet>(bookTask);
|
||||||
|
OnPropertyChanged(nameof(AllPersonals));
|
||||||
|
OnPropertyChanged(nameof(AllBooks));
|
||||||
|
}
|
||||||
|
private async Task SaveAsync()
|
||||||
|
{
|
||||||
|
if (_currentData.Gdn == null)
|
||||||
|
{
|
||||||
|
_currentData.Gdn = false;
|
||||||
|
|
||||||
|
await _limsService.Datas.UpdateAsync(_currentData);
|
||||||
|
var result = MessageBox.Show("Распечатать извещение?", "Внимание!", MessageBoxButton.OKCancel);
|
||||||
|
if (result == MessageBoxResult.OK)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//await Task.Run(() => new Izv(_newDMS, _repository).Print());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { await _limsService.Datas.UpdateAsync(_currentData); }
|
||||||
|
}
|
||||||
|
#endregion //properties
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync, () => CurrentPersonal != null && !string.IsNullOrEmpty(Number));
|
||||||
|
#endregion //Commands
|
||||||
|
|
||||||
|
#region IDataErrorInfo
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
113
XLIMS.PSV/ViewModels/BrowseSerialViewModel.cs
Normal file
113
XLIMS.PSV/ViewModels/BrowseSerialViewModel.cs
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
|
||||||
|
public class BrowseSerialViewModel : ViewModelBase, IDisposable
|
||||||
|
{
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
private int _divisionId;
|
||||||
|
|
||||||
|
private DeviceSet _currentSerial = null;
|
||||||
|
private string _search = string.Empty;
|
||||||
|
private CancellationTokenSource? _searchCts = null;
|
||||||
|
private bool _disposed = false;
|
||||||
|
|
||||||
|
public ObservableCollection<DeviceSet> AllSerial { get; } = new();
|
||||||
|
public ICollectionView SerialView { get; }
|
||||||
|
|
||||||
|
public DeviceSet? CurrentSerial
|
||||||
|
{
|
||||||
|
get => _currentSerial;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentSerial = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Search
|
||||||
|
{
|
||||||
|
get => _search;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_search = value;
|
||||||
|
DebounceSearch();
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BrowseSerialViewModel(ILimsService limsService, int divisionId)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
_divisionId = divisionId;
|
||||||
|
|
||||||
|
SerialView = CollectionViewSource.GetDefaultView(AllSerial);
|
||||||
|
SerialView.Filter = SerialFilter;
|
||||||
|
|
||||||
|
LoadSerialsAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadSerialsAsync()
|
||||||
|
{
|
||||||
|
AllSerial.Clear();
|
||||||
|
var devList = await _limsService.Devices.GetAllAsync();
|
||||||
|
foreach (var dev in devList.Where(e=>e.DivisionId==_divisionId))
|
||||||
|
{
|
||||||
|
AllSerial.Add(dev);
|
||||||
|
}
|
||||||
|
SerialView.Refresh();
|
||||||
|
}
|
||||||
|
private bool SerialFilter(object item)
|
||||||
|
{
|
||||||
|
if (item is not DeviceSet dev) return false;
|
||||||
|
if (string.IsNullOrWhiteSpace(Search)) return true;
|
||||||
|
|
||||||
|
var search = Search.Trim();
|
||||||
|
return (dev.Serial?.Contains(search, StringComparison.OrdinalIgnoreCase) == true)
|
||||||
|
|| (dev.Dpzn?.Contains(search, StringComparison.OrdinalIgnoreCase) == true)
|
||||||
|
|| (dev.Tip?.Contains(search, StringComparison.OrdinalIgnoreCase) == true)
|
||||||
|
|| (dev.Name?.Contains(search, StringComparison.OrdinalIgnoreCase) == true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICommand? _saveCommand = null;
|
||||||
|
public ICommand SaveCommand => _saveCommand ??= new RelayCommand(_ => Save(), _ => CurrentSerial != null);
|
||||||
|
|
||||||
|
private void Save()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void DebounceSearch()
|
||||||
|
{
|
||||||
|
_searchCts?.Cancel();
|
||||||
|
_searchCts = new CancellationTokenSource();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Delay(300, _searchCts.Token);
|
||||||
|
SerialView.Refresh();
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_disposed) return;
|
||||||
|
_disposed = true;
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
179
XLIMS.PSV/ViewModels/BrowseTprzViewModel.cs
Normal file
179
XLIMS.PSV/ViewModels/BrowseTprzViewModel.cs
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Threading;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
|
||||||
|
public class BrowseTprzViewModel : ViewModelBase, IDataErrorInfo, IDisposable
|
||||||
|
{
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
private readonly ObservableCollection<Tprz> _allTprz = new();
|
||||||
|
|
||||||
|
private Tprz? _currentTprz = null;
|
||||||
|
private string _search = string.Empty;
|
||||||
|
private string _serial = string.Empty;
|
||||||
|
private bool _isValid;
|
||||||
|
private CancellationTokenSource? _searchCts;
|
||||||
|
private CancellationTokenSource? _loadCts;
|
||||||
|
|
||||||
|
private string _lastFilter = string.Empty;
|
||||||
|
|
||||||
|
public BrowseTprzViewModel(ILimsService limsService)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
AllTPRZView = CollectionViewSource.GetDefaultView(_allTprz);
|
||||||
|
AllTPRZView.Filter = TprzFilter;
|
||||||
|
LoadTPRZAsync();
|
||||||
|
}
|
||||||
|
private async Task LoadTPRZAsync()
|
||||||
|
{
|
||||||
|
_loadCts?.Cancel();
|
||||||
|
_loadCts = new CancellationTokenSource();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_allTprz.Clear();
|
||||||
|
var items = await _limsService.Tprzs.GetAllAsync();
|
||||||
|
foreach (var item in items)
|
||||||
|
_allTprz.Add(item);
|
||||||
|
AllTPRZView.Refresh();
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException) { }
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
// Логирование или отображение ошибки пользователю
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ICollectionView AllTPRZView { get; }
|
||||||
|
|
||||||
|
public Tprz? CurrentTPRZ
|
||||||
|
{
|
||||||
|
get => _currentTprz;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentTprz = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Search
|
||||||
|
{
|
||||||
|
get => _search;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_search = value ?? string.Empty;
|
||||||
|
DebouncedRefresh();
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void DebouncedRefresh()
|
||||||
|
{
|
||||||
|
_searchCts?.Cancel();
|
||||||
|
_searchCts = new CancellationTokenSource();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await Task.Delay(300, _searchCts.Token);
|
||||||
|
AllTPRZView.Refresh();
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException) { }
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Serial
|
||||||
|
{
|
||||||
|
get => _serial;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_serial = value?.Trim() ?? string.Empty;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool TprzFilter(object obj)
|
||||||
|
{
|
||||||
|
if (obj is not Tprz tprz) return false;
|
||||||
|
var filter = Search?.Trim() ?? string.Empty;
|
||||||
|
if (_lastFilter != filter)
|
||||||
|
_lastFilter = filter;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(_lastFilter)) return true;
|
||||||
|
|
||||||
|
return (tprz.Dpzn?.Contains(_lastFilter, StringComparison.OrdinalIgnoreCase) == true)
|
||||||
|
|| (tprz.IdtipNavigation.Tp?.Contains(_lastFilter, StringComparison.OrdinalIgnoreCase) == true)
|
||||||
|
|| (tprz.IdtipNavigation?.IdspnmtpNavigation?.Nmtp?.Contains(_lastFilter, StringComparison.OrdinalIgnoreCase) == true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private RelayCommand? _saveCommand;
|
||||||
|
public ICommand SaveCommand => _saveCommand ??= new RelayCommand(_ => Save(), _ => _isValid && CurrentTPRZ != null);
|
||||||
|
|
||||||
|
private void Save()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private new void OnPropertyChanged([CallerMemberName] string propertyName = "")
|
||||||
|
{
|
||||||
|
base.OnPropertyChanged(propertyName);
|
||||||
|
if (propertyName == nameof(Serial) || propertyName == nameof(CurrentTPRZ))
|
||||||
|
CommandManager.InvalidateRequerySuggested();
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IDataErrorInfo
|
||||||
|
|
||||||
|
public string Error => string.Empty;
|
||||||
|
|
||||||
|
private void ValidateAll()
|
||||||
|
{
|
||||||
|
_isValid = Validate();
|
||||||
|
CommandManager.InvalidateRequerySuggested();
|
||||||
|
}
|
||||||
|
|
||||||
|
public string this[string columnName]
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string msg = string.Empty;
|
||||||
|
switch (columnName)
|
||||||
|
{
|
||||||
|
case nameof(Serial):
|
||||||
|
if (string.IsNullOrWhiteSpace(Serial))
|
||||||
|
msg = "Поле не может быть пустым!";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ValidateAll();
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool Validate()
|
||||||
|
{
|
||||||
|
// Добавьте комплексную валидацию всех нужных полей
|
||||||
|
return !string.IsNullOrWhiteSpace(Serial);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private bool _disposed = false;
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (_disposed) return;
|
||||||
|
_disposed = true;
|
||||||
|
_searchCts?.Dispose();
|
||||||
|
_loadCts?.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
28
XLIMS.PSV/ViewModels/DocPovViewModel.cs
Normal file
28
XLIMS.PSV/ViewModels/DocPovViewModel.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
public class DocPovViewModel:ViewModelBase
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
#endregion //Commands
|
||||||
|
}
|
||||||
|
}
|
||||||
192
XLIMS.PSV/ViewModels/GoodViewModel.cs
Normal file
192
XLIMS.PSV/ViewModels/GoodViewModel.cs
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
public class GoodViewModel:ViewModelBase
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public GoodViewModel(ILimsService limsService, DataSet data)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
_currentData = data;
|
||||||
|
if (_currentData.Gdn == null) _povDoc = new DocumentSet() { Division = _currentData.Device.Division };
|
||||||
|
else if (_currentData.DocumentPov != null) _povDoc = _currentData.DocumentPov;
|
||||||
|
LoadDataAsync();
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
private DataSet _currentData;
|
||||||
|
private PersonalSet _currentPersonal;
|
||||||
|
private DocumentSet _povDoc;
|
||||||
|
private BookSet _currentBook;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public string Title => $"{_currentData.Device.Tip} №{_currentData.Device.Serial} {_currentData.Device.Name}";
|
||||||
|
public ObservableCollection<PersonalSet> AllPersonals { get; set; } = new();
|
||||||
|
public ObservableCollection<BookSet> AllBooks { get; set; } = new();
|
||||||
|
public BookSet CurrentBook
|
||||||
|
{
|
||||||
|
get => _currentBook;
|
||||||
|
set { _currentBook = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public PersonalSet CurrentPersonal
|
||||||
|
{
|
||||||
|
get => _currentPersonal;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentPersonal = value;
|
||||||
|
if (_currentPersonal != null) { _currentData.Person = _currentPersonal.Person; }
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DateTime? PovDate
|
||||||
|
{
|
||||||
|
get => _currentData.Date;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentData.Date = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public int? Nkl
|
||||||
|
{
|
||||||
|
get { return _currentData.Nkl; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentData.Nkl = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string Number
|
||||||
|
{
|
||||||
|
get => _povDoc.Number;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_povDoc.Number = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DateTime? DocDate
|
||||||
|
{
|
||||||
|
get => _povDoc.DocDate;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_povDoc.DocDate = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
private async Task LoadDataAsync()
|
||||||
|
{
|
||||||
|
var personalTask = await _limsService.Personals.GetAllAsync();
|
||||||
|
var bookTask = await _limsService.Books.GetAllAsync();
|
||||||
|
AllPersonals = new ObservableCollection<PersonalSet>(personalTask);
|
||||||
|
AllBooks = new ObservableCollection<BookSet>(bookTask);
|
||||||
|
OnPropertyChanged(nameof(PersonalSet));
|
||||||
|
OnPropertyChanged(nameof(BookSet));
|
||||||
|
}
|
||||||
|
private async Task SaveAsync()
|
||||||
|
{
|
||||||
|
if (_currentData.Gdn == null)
|
||||||
|
{
|
||||||
|
_currentData.Gdn = true;
|
||||||
|
await _limsService.Datas.AddAsync(_currentData);
|
||||||
|
}
|
||||||
|
else { await _limsService.Datas.UpdateAsync(_currentData); }
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(Number))
|
||||||
|
{
|
||||||
|
await _limsService.Documents.AddAsync(_povDoc);
|
||||||
|
if (MessageBox.Show("Распечатать свидетельство?", "Внимание!", MessageBoxButton.OKCancel).ToString() == "OK")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// await Task.Run(() => new Svid(_newDMS, _repository).Print());
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MessageBox.Show(e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
public ICommand SaveCommand => new AsyncRelayCommand(SaveAsync,() => CurrentPersonal != null);
|
||||||
|
#endregion //Commands
|
||||||
|
|
||||||
|
#region IDEI
|
||||||
|
//public string Error => string.Join(Environment.NewLine, GetValidationErrors());
|
||||||
|
|
||||||
|
//public string this[string columnName]
|
||||||
|
//{
|
||||||
|
// get
|
||||||
|
// {
|
||||||
|
// string msg = null;
|
||||||
|
// if (columnName == nameof(NND))
|
||||||
|
// {
|
||||||
|
// if (_repository.Dms.Any(a => a.Nnd ==CurrentBook+NND))
|
||||||
|
// {
|
||||||
|
// msg = "Документ с таким номером уже есть в базе!";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (columnName == "DTMKFK")
|
||||||
|
// {
|
||||||
|
// if (DTMKFK < _currentEKZMK.DTPRM)
|
||||||
|
// {
|
||||||
|
// msg = "Дата поверки не может быть раньше даты приемки!";
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (columnName == nameof(Temp))
|
||||||
|
// {
|
||||||
|
// if (Temp == 0)
|
||||||
|
// {
|
||||||
|
// msg = "Данные о теммпературе не могут быть равны нулю!";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (columnName == nameof(Hum))
|
||||||
|
// {
|
||||||
|
// if (Hum == 0)
|
||||||
|
// {
|
||||||
|
// msg = "Данные о влажности не могут быть равны нулю!";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (columnName == nameof(Press))
|
||||||
|
// {
|
||||||
|
// if (Press == 0)
|
||||||
|
// {
|
||||||
|
// msg = "Данные о давлении не могут быть равны нулю!";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return msg;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
#endregion //IDEI
|
||||||
|
}
|
||||||
|
}
|
||||||
158
XLIMS.PSV/ViewModels/MainViewModel.cs
Normal file
158
XLIMS.PSV/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
using XLIMS.PSV.Views;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
public class MainViewModel : ViewModelBase,IActivityViewModel
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public MainViewModel(ILimsService limsService, IDialogService dialogService)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
_dialogService = dialogService;
|
||||||
|
LoadSide();
|
||||||
|
_limsService.Datas.SetChanged += Datas_SetChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Datas_SetChanged()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
private readonly IDialogService _dialogService;
|
||||||
|
private SideItemViewModel _currentSideItem;
|
||||||
|
private DocumentSet _currentPsv;
|
||||||
|
private IGrouping<string,DataSet> _currentGroupPov;
|
||||||
|
private DataSet _currentPov;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public ObservableCollection<SideItemViewModel> SideItems { get; set; } = new();
|
||||||
|
public SideItemViewModel CurrentSideItem
|
||||||
|
{
|
||||||
|
get => _currentSideItem;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentSideItem = value;
|
||||||
|
if (_currentSideItem != null) { LoadPsvAsync(_currentSideItem.Index); }
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ObservableCollection<DocumentSet> AllPsvs { get; set; } = new();
|
||||||
|
public DocumentSet CurrentPsv
|
||||||
|
{
|
||||||
|
get => _currentPsv;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentPsv = value;
|
||||||
|
if (_currentPsv != null) { LoadDataAsync(_currentPsv); }
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ObservableCollection<IGrouping<string,DataSet>> GroupedPovs { get; set; }
|
||||||
|
public IGrouping<string, DataSet> CurrentGroupPov
|
||||||
|
{
|
||||||
|
get => _currentGroupPov;
|
||||||
|
set { _currentGroupPov = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public DataSet CurrentPov
|
||||||
|
{
|
||||||
|
get => _currentPov;
|
||||||
|
set { _currentPov = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public string Title => "ПСВ";
|
||||||
|
public object View => new MainView();
|
||||||
|
|
||||||
|
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
public void LoadSide()
|
||||||
|
{
|
||||||
|
var side=new List<SideItemViewModel>();
|
||||||
|
side.Add(new SideItemViewModel(1,"Срочные"));
|
||||||
|
side.Add(new SideItemViewModel(2,"Открытые"));
|
||||||
|
side.Add(new SideItemViewModel(3,"Архив"));
|
||||||
|
SideItems = new ObservableCollection<SideItemViewModel>(side);
|
||||||
|
OnPropertyChanged(nameof(SideItems));
|
||||||
|
}
|
||||||
|
public async Task LoadPsvAsync(int index)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var psvsTask = await _limsService.Documents.GetAllAsync();
|
||||||
|
if (index == 1)
|
||||||
|
{
|
||||||
|
AllPsvs = new ObservableCollection<DocumentSet>(psvsTask.Where(e => e.Name == "ПСВ" && (DateTime.Today - e.DocDate).Value.TotalDays > 15));
|
||||||
|
}
|
||||||
|
if (index == 2)
|
||||||
|
{
|
||||||
|
AllPsvs = new ObservableCollection<DocumentSet>(psvsTask.Where(e => e.Name == "ПСВ"));
|
||||||
|
}
|
||||||
|
if (index == 3)
|
||||||
|
{
|
||||||
|
|
||||||
|
AllPsvs = new ObservableCollection<DocumentSet>(psvsTask.Where(e => e.Name == "ПСВ" && e.Status == "close"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(AllPsvs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public async Task LoadDataAsync(DocumentSet psv)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var povsTask = await Task.Run<IEnumerable<DataSet>>(()=>psv.DataSetDocuments.ToList());
|
||||||
|
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(povsTask.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
OnPropertyChanged(nameof(GroupedPovs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void AddPsv()
|
||||||
|
{
|
||||||
|
_dialogService.ShowDialog(new PsvViewModel(_limsService, _dialogService));
|
||||||
|
}
|
||||||
|
private void EditPsv()
|
||||||
|
{
|
||||||
|
_dialogService.ShowDialog(new PsvViewModel(_limsService, _dialogService,CurrentPsv));
|
||||||
|
}
|
||||||
|
private async Task DelPsvAsync()
|
||||||
|
{
|
||||||
|
await _limsService.Documents.RemoveAsync(CurrentPsv);
|
||||||
|
AllPsvs.Remove(CurrentPsv);
|
||||||
|
}
|
||||||
|
private void GoodPov() { }
|
||||||
|
private void BadPov()
|
||||||
|
{
|
||||||
|
_dialogService.ShowDialog(new BadViewModel(_limsService,CurrentPov));
|
||||||
|
}
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
public ICommand AddPsvCommand => new RelayCommand(p => AddPsv());
|
||||||
|
public ICommand EditPsvCommand => new RelayCommand(p => EditPsv(),p=>CurrentPsv!=null);
|
||||||
|
public ICommand BadCommand => new RelayCommand(p => BadPov());
|
||||||
|
public ICommand DelPsvCommand => new AsyncRelayCommand(DelPsvAsync,()=>CurrentPsv!=null);
|
||||||
|
|
||||||
|
#endregion //Commands
|
||||||
|
}
|
||||||
|
}
|
||||||
239
XLIMS.PSV/ViewModels/PsvViewModel.cs
Normal file
239
XLIMS.PSV/ViewModels/PsvViewModel.cs
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using XLIMS.PSV.Windows;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
public class PsvViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public PsvViewModel(ILimsService limsService, IDialogService dialogService, DocumentSet document=null)
|
||||||
|
{
|
||||||
|
_limsService = limsService;
|
||||||
|
_dialogService = dialogService;
|
||||||
|
|
||||||
|
if (document != null)
|
||||||
|
{
|
||||||
|
_document = document;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_document = new DocumentSet() {Name="ПСВ"};
|
||||||
|
}
|
||||||
|
LoadDataAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
private DocumentSet _document;
|
||||||
|
private readonly ILimsService _limsService;
|
||||||
|
private readonly IDialogService _dialogService;
|
||||||
|
private int _devicesCount;
|
||||||
|
private DivisionSet _currentDivision;
|
||||||
|
private Tprz _currentTprz;
|
||||||
|
private DeviceSet _currentDevice;
|
||||||
|
private IGrouping<string, DataSet> _currentGroupedPov;
|
||||||
|
private DataSet _currentPov;
|
||||||
|
private PersonalSet _currentPersonal;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public ObservableCollection<IGrouping<string, DataSet>> GroupedPovs { get; set; } = new();
|
||||||
|
public int ID => _document.Id;
|
||||||
|
public ObservableCollection<DivisionSet> AllDivisions { get; set; } = new();
|
||||||
|
public ObservableCollection<PersonalSet> AllPersonals { get; set; } = new();
|
||||||
|
public ObservableCollection<DataSet> AllPovs { get; set; } = new();
|
||||||
|
public DivisionSet CurrentDivision
|
||||||
|
{
|
||||||
|
get => _document.Division;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_document.Division = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public PersonalSet CurrentPersonal
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _currentPersonal;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentPersonal = value;
|
||||||
|
if(_currentPersonal!=null) { _document.InPerson = _currentPersonal.Person; }
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public IGrouping<string, DataSet> CurrentGroupedPov
|
||||||
|
{
|
||||||
|
get => _currentGroupedPov;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentGroupedPov = value; OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public DataSet CurrentPov
|
||||||
|
{
|
||||||
|
get => _currentPov;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_currentPov = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string? Number
|
||||||
|
{
|
||||||
|
get=>_document.Number;
|
||||||
|
set { _document.Number = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public DateTime? Date
|
||||||
|
{
|
||||||
|
get => _document.DocDate;
|
||||||
|
set { _document.DocDate = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
private async Task BrowseTprz()
|
||||||
|
{
|
||||||
|
var vm = new BrowseTprzViewModel(_limsService);
|
||||||
|
if (_dialogService.ShowDialog(vm, out _) != true || vm.CurrentTPRZ == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var tprz = vm.CurrentTPRZ;
|
||||||
|
var serial = vm.Serial;
|
||||||
|
|
||||||
|
bool ExistsInList() => AllPovs.Any(p =>
|
||||||
|
p.Device.Serial == serial &&
|
||||||
|
p.Device.Dpzn == tprz.Dpzn &&
|
||||||
|
p.Device.Gsrs == tprz.Gsrs &&
|
||||||
|
p.Device.Hrtc == tprz.Hrtc);
|
||||||
|
|
||||||
|
if (ExistsInList())
|
||||||
|
{
|
||||||
|
MessageBox.Show("Документ уже содержит выбранный экземпляр!",
|
||||||
|
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dataSets = await _limsService.Datas.GetAllAsync();
|
||||||
|
if (dataSets.Any(d =>
|
||||||
|
d.Device.Serial == serial &&
|
||||||
|
d.Device.Dpzn == tprz.Dpzn &&
|
||||||
|
d.Device.Gsrs == tprz.Gsrs &&
|
||||||
|
d.Device.Hrtc == tprz.Hrtc &&
|
||||||
|
d.Device.Division == CurrentDivision &&
|
||||||
|
d.Gdn == null))
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Прибор с номером №{serial} уже находится в поверке!",
|
||||||
|
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var devices = await _limsService.Devices.GetAllAsync();
|
||||||
|
var dev = devices.FirstOrDefault(d =>
|
||||||
|
d.Serial == serial &&
|
||||||
|
d.Dpzn == tprz.Dpzn &&
|
||||||
|
d.Gsrs == tprz.Gsrs &&
|
||||||
|
d.Hrtc == tprz.Hrtc &&
|
||||||
|
d.Division == CurrentDivision)
|
||||||
|
?? new DeviceSet
|
||||||
|
{
|
||||||
|
Oi = tprz.IdtipNavigation.IdspoiNavigation.Nmoi,
|
||||||
|
Name = tprz.IdtipNavigation.IdspnmtpNavigation.Nmtp,
|
||||||
|
Tip = tprz.IdtipNavigation.Tp,
|
||||||
|
Serial = serial,
|
||||||
|
Dpzn = tprz.Dpzn,
|
||||||
|
Hrtc = tprz.Hrtc,
|
||||||
|
Division = CurrentDivision
|
||||||
|
};
|
||||||
|
|
||||||
|
AllPovs.Add(new DataSet() {Device=dev,Document=_document });
|
||||||
|
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(AllPovs.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
|
||||||
|
CurrentGroupedPov = GroupedPovs.FirstOrDefault();
|
||||||
|
OnPropertyChanged(nameof(GroupedPovs));
|
||||||
|
OnPropertyChanged(nameof(CurrentGroupedPov));
|
||||||
|
|
||||||
|
}
|
||||||
|
private async Task BrowseSerial()
|
||||||
|
{
|
||||||
|
var vm = new BrowseSerialViewModel(_limsService,CurrentDivision.Id);
|
||||||
|
if (_dialogService.ShowDialog(vm, out _) != true || vm.CurrentSerial == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Проверка на дублирование в текущем документе
|
||||||
|
bool alreadyExists = AllPovs.Any(e => e.Device == vm.CurrentSerial);
|
||||||
|
if (alreadyExists)
|
||||||
|
{
|
||||||
|
MessageBox.Show("Документ уже содержит выбранный экземпляр!",
|
||||||
|
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dataSets = await _limsService.Datas.GetAllAsync();
|
||||||
|
if (vm.CurrentSerial.DataSets.Any(d =>d.Gdn == null))
|
||||||
|
{
|
||||||
|
MessageBox.Show($"Прибор с номером №{vm.CurrentSerial.Serial} уже находится в поверке!",
|
||||||
|
"Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
AllPovs.Add(new DataSet() { Device = vm.CurrentSerial, Document = _document });
|
||||||
|
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(AllPovs.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
|
||||||
|
CurrentGroupedPov = GroupedPovs.FirstOrDefault();
|
||||||
|
OnPropertyChanged(nameof(GroupedPovs));
|
||||||
|
OnPropertyChanged(nameof(CurrentGroupedPov));
|
||||||
|
}
|
||||||
|
private async Task LoadDataAsync()
|
||||||
|
{
|
||||||
|
var povsTask = await Task.Run<IEnumerable<DataSet>>(() => _document.DataSetDocuments.ToList());
|
||||||
|
AllPersonals = new ObservableCollection<PersonalSet>(await _limsService.Personals.GetAllAsync());
|
||||||
|
AllDivisions = new ObservableCollection<DivisionSet>(await _limsService.Divisions.GetAllAsync());
|
||||||
|
AllPovs=new ObservableCollection<DataSet>(povsTask);
|
||||||
|
GroupedPovs = new ObservableCollection<IGrouping<string, DataSet>>(AllPovs.GroupBy(e => e.Device.Dpzn + e.Device.Hrtc + e.Device.Gsrs));
|
||||||
|
CurrentPersonal = AllPersonals.FirstOrDefault(f => f.Person == _document.InPerson);
|
||||||
|
OnPropertyChanged(nameof(AllDivisions));
|
||||||
|
OnPropertyChanged(nameof(AllPersonals));
|
||||||
|
OnPropertyChanged(nameof(GroupedPovs));
|
||||||
|
OnPropertyChanged(nameof(CurrentPersonal));
|
||||||
|
}
|
||||||
|
private async Task Save()
|
||||||
|
{
|
||||||
|
foreach (var pov in AllPovs)
|
||||||
|
{
|
||||||
|
if(pov.Id==0) await _limsService.Datas.AddAsync(pov);
|
||||||
|
else await _limsService.Datas.UpdateAsync(pov);
|
||||||
|
}
|
||||||
|
if(_document.Id== 0) {await _limsService.Documents.AddAsync(_document); }
|
||||||
|
else await _limsService.Documents.UpdateAsync(_document);
|
||||||
|
}
|
||||||
|
private async Task DelPov()
|
||||||
|
{
|
||||||
|
if(CurrentPov.Id!=0)
|
||||||
|
{
|
||||||
|
await _limsService.Datas.RemoveAsync(CurrentPov);
|
||||||
|
AllPovs.Remove(CurrentPov);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
public ICommand BrowseTprzCommand => new AsyncRelayCommand(BrowseTprz, ()=>CurrentDivision != null);
|
||||||
|
public ICommand BrowseSerialCommand => new AsyncRelayCommand(BrowseSerial,()=>CurrentDivision!=null);
|
||||||
|
public ICommand SaveCommand => new AsyncRelayCommand(Save);
|
||||||
|
#endregion //Commands
|
||||||
|
}
|
||||||
|
}
|
||||||
45
XLIMS.PSV/ViewModels/SideItemViewModel.cs
Normal file
45
XLIMS.PSV/ViewModels/SideItemViewModel.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using XLIMS.MVVM.Base;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.ViewModels
|
||||||
|
{
|
||||||
|
public class SideItemViewModel:ViewModelBase
|
||||||
|
{
|
||||||
|
#region Constructor
|
||||||
|
public SideItemViewModel(int index,string title)
|
||||||
|
{
|
||||||
|
_index = index;
|
||||||
|
_title = title;
|
||||||
|
}
|
||||||
|
#endregion //Constructor
|
||||||
|
|
||||||
|
#region Events
|
||||||
|
#endregion //Events
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
private int _index;
|
||||||
|
private string _title;
|
||||||
|
#endregion //Fields
|
||||||
|
|
||||||
|
#region Properties
|
||||||
|
public string Title
|
||||||
|
{
|
||||||
|
get => _title;
|
||||||
|
set { _title = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
public int Index
|
||||||
|
{
|
||||||
|
get => _index;
|
||||||
|
set { _index = value; OnPropertyChanged(); }
|
||||||
|
}
|
||||||
|
#endregion //Properties
|
||||||
|
|
||||||
|
#region Methods
|
||||||
|
#endregion //Methods
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
#endregion //Commands
|
||||||
|
}
|
||||||
|
}
|
||||||
58
XLIMS.PSV/Views/BadView.xaml
Normal file
58
XLIMS.PSV/Views/BadView.xaml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="XLIMS.PSV.Views.BadView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid Margin="10" MinWidth="350">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="2">
|
||||||
|
<TextBlock Text="Причина непригодности:" />
|
||||||
|
<TextBox Margin="2"
|
||||||
|
Text="{Binding Reason, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="3" Grid.ColumnSpan="3">
|
||||||
|
<TextBlock Text="Дата поверки:"/>
|
||||||
|
<DatePicker
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
SelectedDate="{Binding PovDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="4" Grid.ColumnSpan="3">
|
||||||
|
<TextBlock Text="Поверитель:"/>
|
||||||
|
<ComboBox
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DisplayMemberPath="Person"
|
||||||
|
ItemsSource="{Binding AllPersonals}"
|
||||||
|
SelectedItem="{Binding CurrentPersonal, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="6" Grid.ColumnSpan="3">
|
||||||
|
<TextBlock Text="Извещение о непригодности:"/>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<ComboBox ItemsSource="{Binding AllBooks}"
|
||||||
|
SelectedItem="{Binding CurrentBook,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
DockPanel.Dock="Left" Width="125" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Text="{Binding Number,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
|
||||||
|
</DockPanel>
|
||||||
|
<TextBlock Text="Дата извещения:"/>
|
||||||
|
<DatePicker
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
SelectedDate="{Binding DocDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
XLIMS.PSV/Views/BadView.xaml.cs
Normal file
28
XLIMS.PSV/Views/BadView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для BadView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class BadView : UserControl
|
||||||
|
{
|
||||||
|
public BadView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
90
XLIMS.PSV/Views/BrowseSerialView.xaml
Normal file
90
XLIMS.PSV/Views/BrowseSerialView.xaml
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="XLIMS.PSV.Views.BrowseSerialView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<Grid Width="800">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="400" MinHeight="300" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Row="0">
|
||||||
|
<TextBox
|
||||||
|
Width="350"
|
||||||
|
MinWidth="100"
|
||||||
|
Margin="10"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</Border>
|
||||||
|
<DataGrid
|
||||||
|
Grid.Row="1"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
GridLinesVisibility="All"
|
||||||
|
ItemsSource="{Binding SerialView}"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
SelectedItem="{Binding CurrentSerial, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
SelectionUnit="FullRow">
|
||||||
|
<DataGrid.GroupStyle>
|
||||||
|
<GroupStyle>
|
||||||
|
<GroupStyle.HeaderTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding Path=Name}" FontWeight="Bold"/>
|
||||||
|
<TextBlock Text=" ("/>
|
||||||
|
<TextBlock Text="{Binding Path=ItemCount}"/>
|
||||||
|
<TextBlock Text=")"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</GroupStyle.HeaderTemplate>
|
||||||
|
</GroupStyle>
|
||||||
|
</DataGrid.GroupStyle>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="ГР" Binding="{Binding Gsrs}"/>
|
||||||
|
<!--<DataGridTemplateColumn Width="auto" Header="Госреестр">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>-->
|
||||||
|
<DataGridTemplateColumn Width="*" Header="Наименование">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Name}" TextTrimming="CharacterEllipsis" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Tip}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Dpzn}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="120" Header="Характеристики">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Hrtc}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="120" Header="Зав. номер">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Serial}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
26
XLIMS.PSV/Views/BrowseSerialView.xaml.cs
Normal file
26
XLIMS.PSV/Views/BrowseSerialView.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.Views
|
||||||
|
{
|
||||||
|
|
||||||
|
public partial class BrowseSerialView : UserControl
|
||||||
|
{
|
||||||
|
public BrowseSerialView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
80
XLIMS.PSV/Views/BrowseTprzView.xaml
Normal file
80
XLIMS.PSV/Views/BrowseTprzView.xaml
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="XLIMS.PSV.Views.BrowseTprzView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<Grid Width="800">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="400" MinHeight="300" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Row="0">
|
||||||
|
<TextBox
|
||||||
|
Width="350"
|
||||||
|
MinWidth="100"
|
||||||
|
Margin="10"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Text="{Binding Search, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</Border>
|
||||||
|
<DataGrid
|
||||||
|
|
||||||
|
Grid.Row="1"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
GridLinesVisibility="All"
|
||||||
|
ItemsSource="{Binding AllTPRZView}"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
SelectedItem="{Binding CurrentTPRZ, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
EnableRowVirtualization="True"
|
||||||
|
EnableColumnVirtualization="True"
|
||||||
|
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
|
||||||
|
VirtualizingPanel.VirtualizationMode="Standard"
|
||||||
|
VirtualizingPanel.IsVirtualizing="True"
|
||||||
|
SelectionMode="Single"
|
||||||
|
SelectionUnit="FullRow">
|
||||||
|
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Width="auto" Header="Госреестр">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding GSRS}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="*" Header="Наименование">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding IdtipNavigation.IdspnmtpNavigation.Nmtp}" TextTrimming="CharacterEllipsis" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding IdtipNavigation.Tp}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Dpzn}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="120" Header="Характеристики">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Hrtc}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Border Grid.Row="2">
|
||||||
|
<TextBox
|
||||||
|
Margin="10"
|
||||||
|
Text="{Binding Serial, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
XLIMS.PSV/Views/BrowseTprzView.xaml.cs
Normal file
28
XLIMS.PSV/Views/BrowseTprzView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для BrowseTPRZView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class BrowseTprzView : UserControl
|
||||||
|
{
|
||||||
|
public BrowseTprzView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
76
XLIMS.PSV/Views/GoodView.xaml
Normal file
76
XLIMS.PSV/Views/GoodView.xaml
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<UserControl
|
||||||
|
x:Class="XLIMS.PSV.Views.GoodView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid Margin="10" MinWidth="350">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" >
|
||||||
|
<TextBlock Text="Температура:"/>
|
||||||
|
<TextBox Margin="2"
|
||||||
|
Text="{Binding Temp, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="1" >
|
||||||
|
<TextBlock Text="Влажность:" />
|
||||||
|
<TextBox Margin="2"
|
||||||
|
Text="{Binding Hum, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="2">
|
||||||
|
<TextBlock Text="Давление:" />
|
||||||
|
<TextBox Margin="2"
|
||||||
|
Text="{Binding Press, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="3" Grid.ColumnSpan="3">
|
||||||
|
<TextBlock Text="Дата поверки:"/>
|
||||||
|
<DatePicker
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
SelectedDate="{Binding DTMKFK, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="4" Grid.ColumnSpan="3">
|
||||||
|
<TextBlock Text="Поверитель:"/>
|
||||||
|
<ComboBox
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DisplayMemberPath="Prfio"
|
||||||
|
ItemsSource="{Binding AllPRSN}"
|
||||||
|
SelectedItem="{Binding CurrentPRSN, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="5" Grid.ColumnSpan="3">
|
||||||
|
<TextBlock Text="Номер наклейки:"/>
|
||||||
|
<TextBox
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Text="{Binding NNNKL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
|
||||||
|
TextWrapping="WrapWithOverflow" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="6" Grid.ColumnSpan="3">
|
||||||
|
<TextBlock Text="Свидетельство о поверке:"/>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<ComboBox ItemsSource="{Binding AllBooks}"
|
||||||
|
SelectedItem="{Binding CurrentBook,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
DockPanel.Dock="Left" Width="125" Margin="0,0,5,0"/>
|
||||||
|
<TextBox Text="{Binding NND,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True}"/>
|
||||||
|
</DockPanel>
|
||||||
|
<TextBlock Text="Дата свидетельства:"/>
|
||||||
|
<DatePicker
|
||||||
|
Margin="0,5,0,5"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
SelectedDate="{Binding DTD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
XLIMS.PSV/Views/GoodView.xaml.cs
Normal file
28
XLIMS.PSV/Views/GoodView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для GoodView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class GoodView : UserControl
|
||||||
|
{
|
||||||
|
public GoodView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
151
XLIMS.PSV/Views/MainView.xaml
Normal file
151
XLIMS.PSV/Views/MainView.xaml
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<UserControl x:Class="XLIMS.PSV.Views.MainView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<Menu DockPanel.Dock="Top">
|
||||||
|
<MenuItem Header="Новая ПСВ"
|
||||||
|
Command="{Binding AddPsvCommand}"/>
|
||||||
|
<MenuItem Header="Изменить ПСВ"
|
||||||
|
Command="{Binding EditPsvCommand}"/>
|
||||||
|
<MenuItem Header="Удалить ПСВ"
|
||||||
|
Command="{Binding DelPsvCommand}"/>
|
||||||
|
</Menu>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="300" MinWidth="200" MaxWidth="400"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="300" MinWidth="200" MaxWidth="400"/>
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="*" MinWidth="200" />
|
||||||
|
<ColumnDefinition Width="auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<GridSplitter Grid.Column="1" Width="3"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Stretch"/>
|
||||||
|
<GridSplitter Grid.Column="3" Width="3"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Stretch"/>
|
||||||
|
<GridSplitter Grid.Column="5" Width="3"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Stretch"/>
|
||||||
|
<Border Grid.Column="0">
|
||||||
|
<ListBox ItemsSource="{Binding SideItems}"
|
||||||
|
SelectedItem="{Binding CurrentSideItem,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
BorderThickness="0">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Title}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Column="2">
|
||||||
|
<ListBox ItemsSource="{Binding AllPsvs}"
|
||||||
|
SelectedItem="{Binding CurrentPsv,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
BorderThickness="0">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Number}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Column="4">
|
||||||
|
<DataGrid AutoGenerateColumns="False"
|
||||||
|
ItemsSource="{Binding GroupedPovs}"
|
||||||
|
SelectedItem="{Binding CurrentGroupPov,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
BorderThickness="0">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Width="auto" Header="Госреестр">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Gsrs}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="*" Header="Наименование">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Name}" TextTrimming="CharacterEllipsis" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Tip}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Dpzn}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="120" Header="Характеристики">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Hrtc}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="120" Header="Кол-во">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Count}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Border>
|
||||||
|
<Border Grid.Column="6">
|
||||||
|
<DataGrid AutoGenerateColumns="False"
|
||||||
|
ItemsSource="{Binding CurrentGroupPov}"
|
||||||
|
SelectedItem="{Binding CurrentPov,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
BorderThickness="0">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Забракован"
|
||||||
|
Command="{Binding BadCommand}"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Заводской номер">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Serial}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="120" Header="Дата поверки">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Date}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Поверитель">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Person}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="*" Header="Результат">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Gdn}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
|
</UserControl>
|
||||||
26
XLIMS.PSV/Views/MainView.xaml.cs
Normal file
26
XLIMS.PSV/Views/MainView.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.Views
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для MainView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainView : UserControl
|
||||||
|
{
|
||||||
|
public MainView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
42
XLIMS.PSV/Windows/EditWindow.xaml
Normal file
42
XLIMS.PSV/Windows/EditWindow.xaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<Window
|
||||||
|
x:Class="XLIMS.PSV.Windows.EditWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
Title="{Binding Title}"
|
||||||
|
DataContext="{Binding}"
|
||||||
|
ShowInTaskbar="True"
|
||||||
|
SizeToContent="WidthAndHeight"
|
||||||
|
ResizeMode="NoResize"
|
||||||
|
WindowStartupLocation="CenterScreen"
|
||||||
|
WindowStyle="ToolWindow">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="../Resources/PsvDictionary.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<DockPanel
|
||||||
|
Margin="10"
|
||||||
|
DockPanel.Dock="Bottom"
|
||||||
|
LastChildFill="False">
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Click="Button_Click_1"
|
||||||
|
Command="{Binding CancelCommand}"
|
||||||
|
Content="Отмена"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsCancel="True" />
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Margin="0,0,10,0"
|
||||||
|
Click="Button_Click_2"
|
||||||
|
Command="{Binding SaveCommand}"
|
||||||
|
Content="ОК"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsDefault="True" />
|
||||||
|
</DockPanel>
|
||||||
|
<ContentControl Content="{Binding}" />
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
37
XLIMS.PSV/Windows/EditWindow.xaml.cs
Normal file
37
XLIMS.PSV/Windows/EditWindow.xaml.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для EditWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class EditWindow : Window
|
||||||
|
{
|
||||||
|
public EditWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
209
XLIMS.PSV/Windows/PsvWindow.xaml
Normal file
209
XLIMS.PSV/Windows/PsvWindow.xaml
Normal file
@@ -0,0 +1,209 @@
|
|||||||
|
<Window x:Class="XLIMS.PSV.Windows.PsvWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
>
|
||||||
|
<DockPanel LastChildFill="True">
|
||||||
|
<DockPanel
|
||||||
|
Margin="10"
|
||||||
|
DockPanel.Dock="Bottom"
|
||||||
|
LastChildFill="False">
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Command="{Binding CancelCommand}"
|
||||||
|
Click="Button_Click_1"
|
||||||
|
Content="Отмена"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsCancel="True" />
|
||||||
|
<Button
|
||||||
|
Width="85"
|
||||||
|
Margin="0,0,10,0"
|
||||||
|
Command="{Binding SaveCommand}"
|
||||||
|
Click="Button_Click_2"
|
||||||
|
Content="Принять"
|
||||||
|
DockPanel.Dock="Right"
|
||||||
|
IsDefault="True" />
|
||||||
|
</DockPanel>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
<RowDefinition MinHeight="300" />
|
||||||
|
<RowDefinition Height="auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Grid.Row="0" Background="Transparent">
|
||||||
|
<DockPanel Margin="15" LastChildFill="False">
|
||||||
|
<DockPanel DockPanel.Dock="Top" LastChildFill="True">
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,5,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Text="Подразделение:" />
|
||||||
|
<ComboBox ItemsSource="{Binding AllDivisions}"
|
||||||
|
SelectedItem="{Binding CurrentDivision, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Kdl}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DockPanel>
|
||||||
|
<DockPanel
|
||||||
|
Margin="0,15,0,0"
|
||||||
|
DockPanel.Dock="Top"
|
||||||
|
LastChildFill="False">
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,5,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Text="Номер:" />
|
||||||
|
<TextBox
|
||||||
|
Width="350"
|
||||||
|
MinWidth="100"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Text="{Binding Number, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="15,0,5,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Text="Дата:" />
|
||||||
|
<DatePicker DockPanel.Dock="Left" SelectedDate="{Binding Date, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
</DockPanel>
|
||||||
|
<DockPanel
|
||||||
|
Margin="0,15,0,0"
|
||||||
|
DockPanel.Dock="Top"
|
||||||
|
LastChildFill="False">
|
||||||
|
<TextBlock
|
||||||
|
Margin="0,0,5,0"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Text="Принял:" />
|
||||||
|
<ComboBox
|
||||||
|
Width="200"
|
||||||
|
ItemsSource="{Binding AllPersonals}"
|
||||||
|
SelectedItem="{Binding CurrentPersonal, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Person}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
</DockPanel>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
<Grid Grid.Row="1">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="70*"/>
|
||||||
|
<ColumnDefinition Width="30*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<DataGrid
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
GridLinesVisibility="All"
|
||||||
|
ItemsSource="{Binding GroupedPovs}"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
SelectedItem="{Binding CurrentGroupedPov, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
SelectionUnit="FullRow">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Command="{Binding BrowseTprzCommand}" Header="Добавить СИ по типу" />
|
||||||
|
<MenuItem Command="{Binding BrowseSerialCommand}" Header="Добавить СИ по зав. номеру" />
|
||||||
|
<Separator />
|
||||||
|
<MenuItem Command="{Binding DelCommand}" Header="Удалить" />
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Width="auto" Header="Госреестр">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Gsrs}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="*" Header="Наименование">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Name}" TextTrimming="CharacterEllipsis" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Обозначение типа">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Tip}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Диапазон (мод.)">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Dpzn}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="120" Header="Характеристики">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Hrtc}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<!--<DataGridTextColumn
|
||||||
|
Width="200"
|
||||||
|
Binding="{Binding Zip, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
Header="Комплектность" />-->
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Кол-во">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Count}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<DataGrid Grid.Column="1" Margin="3,0,0,0"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
CanUserAddRows="False"
|
||||||
|
GridLinesVisibility="All"
|
||||||
|
ItemsSource="{Binding CurrentGroupedPov}"
|
||||||
|
RowHeaderWidth="0"
|
||||||
|
SelectedItem="{Binding CurrentPov, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
SelectionUnit="FullRow">
|
||||||
|
<DataGrid.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Command="{Binding BrowseTprzCommand}" Header="Добавить СИ по типу" />
|
||||||
|
<MenuItem Command="{Binding BrowseSerialCommand}" Header="Добавить СИ по зав. номеру" />
|
||||||
|
<Separator />
|
||||||
|
<MenuItem Command="{Binding DelCommand}" Header="Удалить" />
|
||||||
|
</ContextMenu>
|
||||||
|
</DataGrid.ContextMenu>
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTemplateColumn Width="200" Header="Зав. номер">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Device.Serial}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
<DataGridTemplateColumn Width="*" Header="Комплектность">
|
||||||
|
<DataGridTemplateColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Zip}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</DataGridTemplateColumn.CellTemplate>
|
||||||
|
</DataGridTemplateColumn>
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
</Grid>
|
||||||
|
<Border Grid.Row="2">
|
||||||
|
<DockPanel Margin="15" LastChildFill="False">
|
||||||
|
<TextBlock DockPanel.Dock="Left" Text="Кол-во:" />
|
||||||
|
<TextBlock
|
||||||
|
Margin="5,0,0,0"
|
||||||
|
DockPanel.Dock="Left"
|
||||||
|
Text="{Binding Count}" />
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
|
</Window>
|
||||||
34
XLIMS.PSV/Windows/PsvWindow.xaml.cs
Normal file
34
XLIMS.PSV/Windows/PsvWindow.xaml.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace XLIMS.PSV.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Логика взаимодействия для PsvWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class PsvWindow : Window
|
||||||
|
{
|
||||||
|
public PsvWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DialogResult = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
XLIMS.PSV/XLIMS.PSV.csproj
Normal file
22
XLIMS.PSV/XLIMS.PSV.csproj
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\XLIMS.CONTRACT\XLIMS.CONTRACT.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.MVVM\XLIMS.MVVM.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Windows\PsvWindow.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
10
XLIMS.SERVICES/AssemblyInfo.cs
Normal file
10
XLIMS.SERVICES/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
74
XLIMS.SERVICES/DialogService.cs
Normal file
74
XLIMS.SERVICES/DialogService.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.PSV.ViewModels;
|
||||||
|
using XLIMS.PSV.Windows;
|
||||||
|
|
||||||
|
namespace XLIMS.SERVICES;
|
||||||
|
|
||||||
|
public class DialogService : IDialogService
|
||||||
|
{
|
||||||
|
// Словарь: ViewModel → соответствующий Window
|
||||||
|
private readonly Dictionary<Type, Type> _mappings = new();
|
||||||
|
|
||||||
|
public DialogService()
|
||||||
|
{
|
||||||
|
// Регистрируем соответствия (можно вынести в отдельный конфигуратор)
|
||||||
|
Register<BrowseTprzViewModel, EditWindow>();
|
||||||
|
Register<BrowseSerialViewModel, EditWindow>();
|
||||||
|
Register<PsvViewModel, PsvWindow>();
|
||||||
|
Register<GoodViewModel,EditWindow>();
|
||||||
|
Register<BadViewModel,EditWindow>();
|
||||||
|
// и т.д.
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Register<TViewModel, TWindow>()
|
||||||
|
where TViewModel : class
|
||||||
|
where TWindow : Window, new()
|
||||||
|
{
|
||||||
|
_mappings[typeof(TViewModel)] = typeof(TWindow);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ShowDialog<TViewModel>(TViewModel viewModel)
|
||||||
|
where TViewModel : class
|
||||||
|
{
|
||||||
|
ShowDialogInternal(viewModel, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool? ShowDialog<TViewModel>(TViewModel viewModel, out object? result)
|
||||||
|
where TViewModel : class
|
||||||
|
{
|
||||||
|
var dialogResult = ShowDialogInternal(viewModel, true);
|
||||||
|
result = (dialogResult.Owner as Window)?.DialogResult;
|
||||||
|
return dialogResult.DialogResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Немодальное окно (опционально)
|
||||||
|
public void Show<TViewModel>(TViewModel viewModel)
|
||||||
|
where TViewModel : class
|
||||||
|
{
|
||||||
|
ShowDialogInternal(viewModel, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Window ShowDialogInternal(object viewModel, bool modal)
|
||||||
|
{
|
||||||
|
var vmType = viewModel.GetType();
|
||||||
|
if (!_mappings.TryGetValue(vmType, out var windowType))
|
||||||
|
throw new InvalidOperationException($"Нет зарегистрированного окна для ViewModel {vmType}");
|
||||||
|
|
||||||
|
var window = (Window)Activator.CreateInstance(windowType)!;
|
||||||
|
window.DataContext = viewModel;
|
||||||
|
|
||||||
|
// Если главное окно уже открыто — устанавливаем Owner (чтобы окно не уходило за него)
|
||||||
|
if (Application.Current?.MainWindow != null && Application.Current.MainWindow != window)
|
||||||
|
window.Owner = Application.Current.MainWindow;
|
||||||
|
|
||||||
|
if (modal)
|
||||||
|
window.ShowDialog();
|
||||||
|
else
|
||||||
|
window.Show();
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
}
|
||||||
115
XLIMS.SERVICES/GenericRepository.cs
Normal file
115
XLIMS.SERVICES/GenericRepository.cs
Normal file
@@ -0,0 +1,115 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
|
||||||
|
namespace XLIMS.SERVICES
|
||||||
|
{
|
||||||
|
public class GenericRepository<TEntity> : IGenericRepository<TEntity> where TEntity : class
|
||||||
|
{
|
||||||
|
protected readonly DbContext _context;
|
||||||
|
protected readonly DbSet<TEntity> _dbSet;
|
||||||
|
public event Action SetChanged;
|
||||||
|
|
||||||
|
public GenericRepository(DbContext context)
|
||||||
|
{
|
||||||
|
_context = context ?? throw new ArgumentNullException(nameof(context));
|
||||||
|
_dbSet = context.Set<TEntity>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<TEntity> GetByIdAsync(int id)
|
||||||
|
{
|
||||||
|
return await _dbSet.FindAsync(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<TEntity>> GetAllAsync()
|
||||||
|
{
|
||||||
|
return await _dbSet.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<TEntity>> WhereAsync(Expression<Func<TEntity, bool>> predicate)
|
||||||
|
{
|
||||||
|
return await _dbSet.Where(predicate).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<TEntity> Find(Expression<Func<TEntity, bool>> predicate)
|
||||||
|
{
|
||||||
|
return _dbSet.Where(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<TEntity>> FindAsync(Expression<Func<TEntity, bool>> predicate)
|
||||||
|
{
|
||||||
|
return await _dbSet.Where(predicate).ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<TEntity> SingleOrDefaultAsync(Expression<Func<TEntity, bool>> predicate)
|
||||||
|
{
|
||||||
|
return await _dbSet.SingleOrDefaultAsync(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task AddAsync(TEntity entity)
|
||||||
|
{
|
||||||
|
await _dbSet.AddAsync(entity);
|
||||||
|
await SaveChangesAsync();
|
||||||
|
SetChanged?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task AddRangeAsync(IEnumerable<TEntity> entities)
|
||||||
|
{
|
||||||
|
await _dbSet.AddRangeAsync(entities);
|
||||||
|
await SaveChangesAsync();
|
||||||
|
SetChanged?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateAsync(TEntity entity)
|
||||||
|
{
|
||||||
|
_dbSet.Update(entity);
|
||||||
|
await SaveChangesAsync();
|
||||||
|
SetChanged?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task UpdateRangeAsync(IEnumerable<TEntity> entities)
|
||||||
|
{
|
||||||
|
_dbSet.UpdateRange(entities);
|
||||||
|
await SaveChangesAsync();
|
||||||
|
SetChanged?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task RemoveAsync(TEntity entity)
|
||||||
|
{
|
||||||
|
_dbSet.Remove(entity);
|
||||||
|
await SaveChangesAsync();
|
||||||
|
SetChanged?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task RemoveRangeAsync(IEnumerable<TEntity> entities)
|
||||||
|
{
|
||||||
|
_dbSet.RemoveRange(entities);
|
||||||
|
await SaveChangesAsync();
|
||||||
|
SetChanged?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> CountAsync(Expression<Func<TEntity, bool>> predicate = null)
|
||||||
|
{
|
||||||
|
if (predicate == null)
|
||||||
|
return await _dbSet.CountAsync();
|
||||||
|
|
||||||
|
return await _dbSet.CountAsync(predicate);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> SaveChangesAsync()
|
||||||
|
{
|
||||||
|
return await _context.SaveChangesAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SaveChanges()
|
||||||
|
{
|
||||||
|
return _context.SaveChanges();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
49
XLIMS.SERVICES/LimsService.cs
Normal file
49
XLIMS.SERVICES/LimsService.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
|
||||||
|
namespace XLIMS.SERVICES
|
||||||
|
{
|
||||||
|
public class LimsService : ILimsService
|
||||||
|
{
|
||||||
|
private readonly LimsdbContext _context;
|
||||||
|
|
||||||
|
public IGenericRepository<BookSet> Books { get; private set; }
|
||||||
|
public IGenericRepository<DataSet> Datas { get; private set; }
|
||||||
|
public IGenericRepository<DeviceSet> Devices { get; private set; }
|
||||||
|
public IGenericRepository<DivisionSet> Divisions { get; private set; }
|
||||||
|
public IGenericRepository<DocumentSet> Documents { get; private set; }
|
||||||
|
public IGenericRepository<PersonalSet> Personals { get; private set; }
|
||||||
|
public IGenericRepository<Spnmtp> Spnmtps { get; private set; }
|
||||||
|
public IGenericRepository<Spoi> Spois { get; private set; }
|
||||||
|
public IGenericRepository<Tip> Tips { get; private set; }
|
||||||
|
public IGenericRepository<Tprz> Tprzs { get; private set; }
|
||||||
|
|
||||||
|
public LimsService(LimsdbContext context)
|
||||||
|
{
|
||||||
|
_context = context;
|
||||||
|
|
||||||
|
Books = new GenericRepository<BookSet>(_context);
|
||||||
|
Datas = new GenericRepository<DataSet>(_context);
|
||||||
|
Devices = new GenericRepository<DeviceSet>(_context);
|
||||||
|
Divisions = new GenericRepository<DivisionSet>(_context);
|
||||||
|
Documents = new GenericRepository<DocumentSet>(_context);
|
||||||
|
Personals = new GenericRepository<PersonalSet>(_context);
|
||||||
|
Spnmtps = new GenericRepository<Spnmtp>(_context);
|
||||||
|
Spois = new GenericRepository<Spoi>(_context);
|
||||||
|
Tips = new GenericRepository<Tip>(_context);
|
||||||
|
Tprzs = new GenericRepository<Tprz>(_context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<int> SaveChangesAsync()
|
||||||
|
{
|
||||||
|
return await _context.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int SaveChanges()
|
||||||
|
{
|
||||||
|
return _context.SaveChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
40
XLIMS.SERVICES/XLIMS.SERVICES.csproj
Normal file
40
XLIMS.SERVICES/XLIMS.SERVICES.csproj
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="BookService.cs" />
|
||||||
|
<Compile Remove="DataSetSerivce.cs" />
|
||||||
|
<Compile Remove="DeviceService.cs" />
|
||||||
|
<Compile Remove="DivisionService.cs" />
|
||||||
|
<Compile Remove="DocumentService.cs" />
|
||||||
|
<Compile Remove="LimsService1.cs" />
|
||||||
|
<Compile Remove="PersonalService.cs" />
|
||||||
|
<Compile Remove="SpnmtpService.cs" />
|
||||||
|
<Compile Remove="SpoiSevice.cs" />
|
||||||
|
<Compile Remove="TipService.cs" />
|
||||||
|
<Compile Remove="TprzService.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\XLIMS.CONTRACT\XLIMS.CONTRACT.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.DATA\XLIMS.DATA.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.DEV\XLIMS.DEV.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.PSV\XLIMS.PSV.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.SP\XLIMS.SP.csproj" />
|
||||||
|
<ProjectReference Include="..\XLIMS.TPRZ\XLIMS.TPRZ.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
49
XLIMS.SERVICES/XLimsServicesDI.cs
Normal file
49
XLIMS.SERVICES/XLimsServicesDI.cs
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
using System.Configuration;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using System.IO;
|
||||||
|
using XLIMS.DATA.Models;
|
||||||
|
using XLIMS.CONTRACT;
|
||||||
|
using XLIMS.SERVICES;
|
||||||
|
|
||||||
|
namespace Microsoft.Extensions.DependencyInjection
|
||||||
|
{
|
||||||
|
public static class XLimsServicesDI
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddXLimsServices(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
var configuration = new ConfigurationBuilder()
|
||||||
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
|
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
// Регистрируем DbContext с использованием строки из конфига
|
||||||
|
services.AddDbContext<LimsdbContext>(options =>
|
||||||
|
{
|
||||||
|
var connectionString = configuration.GetConnectionString("DefaultConnection");
|
||||||
|
options.UseSqlServer(connectionString);
|
||||||
|
// Опционально: логирование запросов в Debug
|
||||||
|
// options.LogTo(Console.WriteLine, LogLevel.Information);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Остальные сервисы
|
||||||
|
// Фасад
|
||||||
|
services.AddScoped<ILimsService, LimsService>();
|
||||||
|
|
||||||
|
// Сервисы
|
||||||
|
services.AddSingleton<IDialogService, DialogService>();
|
||||||
|
|
||||||
|
// ViewModel'и
|
||||||
|
services.AddTransient<XLIMS.PSV.ViewModels.MainViewModel>();
|
||||||
|
services.AddTransient<XLIMS.SP.ViewModels.MainViewModel>();
|
||||||
|
services.AddTransient<XLIMS.TPRZ.ViewModels.MainViewModel>();
|
||||||
|
services.AddTransient<XLIMS.DEV.ViewModels.MainViewModel>();
|
||||||
|
|
||||||
|
// Сохраняем конфигурацию (если понадобится в других местах)
|
||||||
|
services.AddSingleton<IConfiguration>(configuration);
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
10
XLIMS.SP/AssemblyInfo.cs
Normal file
10
XLIMS.SP/AssemblyInfo.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
||||||
20
XLIMS.SP/Resources/SpDictionary.xaml
Normal file
20
XLIMS.SP/Resources/SpDictionary.xaml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:vm="clr-namespace:XLIMS.SP.ViewModels"
|
||||||
|
xmlns:v="clr-namespace:XLIMS.SP.Views">
|
||||||
|
<DataTemplate DataType="{x:Type vm:BookViewModel}">
|
||||||
|
<v:BookView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:SpoiViewModel}">
|
||||||
|
<v:SpoiView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:SpnmtpViewModel}">
|
||||||
|
<v:SpnmtpView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:PersonalViewModel}">
|
||||||
|
<v:PersonalView/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:DivisionViewModel}">
|
||||||
|
<v:DivisionView/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ResourceDictionary>
|
||||||
54
XLIMS.SP/ViewModels/BookViewModel.cs
Normal file
54
XLIMS.SP/ViewModels/BookViewModel.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
92
XLIMS.SP/ViewModels/BooksViewModel.cs
Normal file
92
XLIMS.SP/ViewModels/BooksViewModel.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
56
XLIMS.SP/ViewModels/DeviceViewModel.cs
Normal file
56
XLIMS.SP/ViewModels/DeviceViewModel.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
54
XLIMS.SP/ViewModels/DivisionViewModel.cs
Normal file
54
XLIMS.SP/ViewModels/DivisionViewModel.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
91
XLIMS.SP/ViewModels/DivisionsViewModel.cs
Normal file
91
XLIMS.SP/ViewModels/DivisionsViewModel.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
41
XLIMS.SP/ViewModels/MainViewModel.cs
Normal file
41
XLIMS.SP/ViewModels/MainViewModel.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
54
XLIMS.SP/ViewModels/PersonalViewModel.cs
Normal file
54
XLIMS.SP/ViewModels/PersonalViewModel.cs
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
92
XLIMS.SP/ViewModels/PersonalsViewModel.cs
Normal file
92
XLIMS.SP/ViewModels/PersonalsViewModel.cs
Normal 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
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user