init commit

This commit is contained in:
Ivan 2025-03-05 12:21:17 +03:00
commit 1839671865
346 changed files with 78962 additions and 0 deletions

13
.idea/.idea.demo_hard/.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/.idea.demo_hard.iml
/projectSettingsUpdater.xml
/modules.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AvaloniaProject">
<option name="projectPerEditor">
<map>
<entry key="demo_hard/AddClient.axaml" value="demo_hard/demo_hard.csproj" />
<entry key="demo_hard/FunctionWindow.axaml" value="demo_hard/demo_hard.csproj" />
<entry key="demo_hard/HistoryWindow.axaml" value="demo_hard/demo_hard.csproj" />
<entry key="demo_hard/MainWindow.axaml" value="demo_hard/demo_hard.csproj" />
<entry key="demo_hard/Order.axaml" value="demo_hard/demo_hard.csproj" />
<entry key="demo_hard/SallerWindow.axaml" value="demo_hard/demo_hard.csproj" />
</map>
</option>
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings" defaultProject="true" />
</project>

40
Libary/Libary.cs Normal file
View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
namespace Libary
{
public class Calculations
{
public string[] AvailablePeriods(TimeSpan[] startTimes, int[] durations, TimeSpan beginWorkingTime, TimeSpan endWorkingTime, int consultationTime)
{
TimeSpan consultationDuration = TimeSpan.FromMinutes(consultationTime);
List<string> freeSlots = new List<string>();
TimeSpan current = beginWorkingTime;
for (int i = 0; i < startTimes.Length; i++)
{
TimeSpan start = startTimes[i];
TimeSpan end = start.Add(TimeSpan.FromMinutes(durations[i]));
while (current.Add(consultationDuration) <= start)
{
freeSlots.Add($"{current:hh\\:mm}-{current.Add(consultationDuration):hh\\:mm}");
current = current.Add(consultationDuration);
}
if (current < end)
{
current = end;
}
}
while (current.Add(consultationDuration) <= endWorkingTime)
{
freeSlots.Add($"{current:hh\\:mm}-{current.Add(consultationDuration):hh\\:mm}");
current = current.Add(consultationDuration);
}
return freeSlots.ToArray();
}
}
}

13
Libary/Libary.csproj Normal file
View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="xunit" Version="2.9.3" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Libary")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Libary")]
[assembly: System.Reflection.AssemblyTitleAttribute("Libary")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Создано классом WriteCodeFragment MSBuild.

View File

@ -0,0 +1 @@
6a1a384ce1ed2ea67c76d3c71f45be100ef933e0a26ffbec2cc5a2dea02b3246

View File

@ -0,0 +1,15 @@
is_global = true
build_property.TargetFramework = net9.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Libary
build_property.ProjectDir = C:\Users\prdb\RiderProjects\Demochka\demo_hard\Libary\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 9.0
build_property.EnableCodeStyleSeverity =

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

Binary file not shown.

View File

@ -0,0 +1,79 @@
{
"format": 1,
"restore": {
"C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj": {}
},
"projects": {
"C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj",
"projectName": "Libary",
"projectPath": "C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj",
"packagesPath": "C:\\Users\\prdb\\.nuget\\packages\\",
"outputPath": "C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\prdb\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.200"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"dependencies": {
"xunit": {
"target": "Package",
"version": "[2.9.3, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.200/PortableRuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\prdb\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.2</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\prdb\.nuget\packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)xunit.core\2.9.3\build\xunit.core.props" Condition="Exists('$(NuGetPackageRoot)xunit.core\2.9.3\build\xunit.core.props')" />
</ImportGroup>
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Pkgxunit_analyzers Condition=" '$(Pkgxunit_analyzers)' == '' ">C:\Users\prdb\.nuget\packages\xunit.analyzers\1.18.0</Pkgxunit_analyzers>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)xunit.core\2.9.3\build\xunit.core.targets" Condition="Exists('$(NuGetPackageRoot)xunit.core\2.9.3\build\xunit.core.targets')" />
</ImportGroup>
</Project>

View File

@ -0,0 +1,292 @@
{
"version": 3,
"targets": {
"net9.0": {
"xunit/2.9.3": {
"type": "package",
"dependencies": {
"xunit.analyzers": "1.18.0",
"xunit.assert": "2.9.3",
"xunit.core": "[2.9.3]"
}
},
"xunit.abstractions/2.0.3": {
"type": "package",
"compile": {
"lib/netstandard2.0/xunit.abstractions.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard2.0/xunit.abstractions.dll": {
"related": ".xml"
}
}
},
"xunit.analyzers/1.18.0": {
"type": "package"
},
"xunit.assert/2.9.3": {
"type": "package",
"compile": {
"lib/net6.0/xunit.assert.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/net6.0/xunit.assert.dll": {
"related": ".xml"
}
}
},
"xunit.core/2.9.3": {
"type": "package",
"dependencies": {
"xunit.extensibility.core": "[2.9.3]",
"xunit.extensibility.execution": "[2.9.3]"
},
"build": {
"build/xunit.core.props": {},
"build/xunit.core.targets": {}
},
"buildMultiTargeting": {
"buildMultiTargeting/xunit.core.props": {},
"buildMultiTargeting/xunit.core.targets": {}
}
},
"xunit.extensibility.core/2.9.3": {
"type": "package",
"dependencies": {
"xunit.abstractions": "2.0.3"
},
"compile": {
"lib/netstandard1.1/xunit.core.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard1.1/xunit.core.dll": {
"related": ".xml"
}
}
},
"xunit.extensibility.execution/2.9.3": {
"type": "package",
"dependencies": {
"xunit.extensibility.core": "[2.9.3]"
},
"compile": {
"lib/netstandard1.1/xunit.execution.dotnet.dll": {
"related": ".xml"
}
},
"runtime": {
"lib/netstandard1.1/xunit.execution.dotnet.dll": {
"related": ".xml"
}
}
}
}
},
"libraries": {
"xunit/2.9.3": {
"sha512": "TlXQBinK35LpOPKHAqbLY4xlEen9TBafjs0V5KnA4wZsoQLQJiirCR4CbIXvOH8NzkW4YeJKP5P/Bnrodm0h9Q==",
"type": "package",
"path": "xunit/2.9.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"_content/README.md",
"_content/logo-128-transparent.png",
"xunit.2.9.3.nupkg.sha512",
"xunit.nuspec"
]
},
"xunit.abstractions/2.0.3": {
"sha512": "pot1I4YOxlWjIb5jmwvvQNbTrZ3lJQ+jUGkGjWE3hEFM0l5gOnBWS+H3qsex68s5cO52g+44vpGzhAt+42vwKg==",
"type": "package",
"path": "xunit.abstractions/2.0.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net35/xunit.abstractions.dll",
"lib/net35/xunit.abstractions.xml",
"lib/netstandard1.0/xunit.abstractions.dll",
"lib/netstandard1.0/xunit.abstractions.xml",
"lib/netstandard2.0/xunit.abstractions.dll",
"lib/netstandard2.0/xunit.abstractions.xml",
"xunit.abstractions.2.0.3.nupkg.sha512",
"xunit.abstractions.nuspec"
]
},
"xunit.analyzers/1.18.0": {
"sha512": "OtFMHN8yqIcYP9wcVIgJrq01AfTxijjAqVDy/WeQVSyrDC1RzBWeQPztL49DN2syXRah8TYnfvk035s7L95EZQ==",
"type": "package",
"path": "xunit.analyzers/1.18.0",
"hasTools": true,
"files": [
".nupkg.metadata",
".signature.p7s",
"_content/README.md",
"_content/logo-128-transparent.png",
"analyzers/dotnet/cs/xunit.analyzers.dll",
"analyzers/dotnet/cs/xunit.analyzers.fixes.dll",
"tools/install.ps1",
"tools/uninstall.ps1",
"xunit.analyzers.1.18.0.nupkg.sha512",
"xunit.analyzers.nuspec"
]
},
"xunit.assert/2.9.3": {
"sha512": "/Kq28fCE7MjOV42YLVRAJzRF0WmEqsmflm0cfpMjGtzQ2lR5mYVj1/i0Y8uDAOLczkL3/jArrwehfMD0YogMAA==",
"type": "package",
"path": "xunit.assert/2.9.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"_content/README.md",
"_content/logo-128-transparent.png",
"lib/net6.0/xunit.assert.dll",
"lib/net6.0/xunit.assert.xml",
"lib/netstandard1.1/xunit.assert.dll",
"lib/netstandard1.1/xunit.assert.xml",
"xunit.assert.2.9.3.nupkg.sha512",
"xunit.assert.nuspec"
]
},
"xunit.core/2.9.3": {
"sha512": "BiAEvqGvyme19wE0wTKdADH+NloYqikiU0mcnmiNyXaF9HyHmE6sr/3DC5vnBkgsWaE6yPyWszKSPSApWdRVeQ==",
"type": "package",
"path": "xunit.core/2.9.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"_content/README.md",
"_content/logo-128-transparent.png",
"build/xunit.core.props",
"build/xunit.core.targets",
"buildMultiTargeting/xunit.core.props",
"buildMultiTargeting/xunit.core.targets",
"xunit.core.2.9.3.nupkg.sha512",
"xunit.core.nuspec"
]
},
"xunit.extensibility.core/2.9.3": {
"sha512": "kf3si0YTn2a8J8eZNb+zFpwfoyvIrQ7ivNk5ZYA5yuYk1bEtMe4DxJ2CF/qsRgmEnDr7MnW1mxylBaHTZ4qErA==",
"type": "package",
"path": "xunit.extensibility.core/2.9.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"_content/README.md",
"_content/logo-128-transparent.png",
"lib/net452/xunit.core.dll",
"lib/net452/xunit.core.dll.tdnet",
"lib/net452/xunit.core.xml",
"lib/net452/xunit.runner.tdnet.dll",
"lib/net452/xunit.runner.utility.net452.dll",
"lib/netstandard1.1/xunit.core.dll",
"lib/netstandard1.1/xunit.core.xml",
"xunit.extensibility.core.2.9.3.nupkg.sha512",
"xunit.extensibility.core.nuspec"
]
},
"xunit.extensibility.execution/2.9.3": {
"sha512": "yMb6vMESlSrE3Wfj7V6cjQ3S4TXdXpRqYeNEI3zsX31uTsGMJjEw6oD5F5u1cHnMptjhEECnmZSsPxB6ChZHDQ==",
"type": "package",
"path": "xunit.extensibility.execution/2.9.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"_content/README.md",
"_content/logo-128-transparent.png",
"lib/net452/xunit.execution.desktop.dll",
"lib/net452/xunit.execution.desktop.xml",
"lib/netstandard1.1/xunit.execution.dotnet.dll",
"lib/netstandard1.1/xunit.execution.dotnet.xml",
"xunit.extensibility.execution.2.9.3.nupkg.sha512",
"xunit.extensibility.execution.nuspec"
]
}
},
"projectFileDependencyGroups": {
"net9.0": [
"xunit >= 2.9.3"
]
},
"packageFolders": {
"C:\\Users\\prdb\\.nuget\\packages\\": {},
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj",
"projectName": "Libary",
"projectPath": "C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj",
"packagesPath": "C:\\Users\\prdb\\.nuget\\packages\\",
"outputPath": "C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\prdb\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"net9.0"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.200"
},
"frameworks": {
"net9.0": {
"targetAlias": "net9.0",
"dependencies": {
"xunit": {
"target": "Package",
"version": "[2.9.3, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.200/PortableRuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -0,0 +1,16 @@
{
"version": 2,
"dgSpecHash": "KgIAobI5FKU=",
"success": true,
"projectFilePath": "C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj",
"expectedPackageFiles": [
"C:\\Users\\prdb\\.nuget\\packages\\xunit\\2.9.3\\xunit.2.9.3.nupkg.sha512",
"C:\\Users\\prdb\\.nuget\\packages\\xunit.abstractions\\2.0.3\\xunit.abstractions.2.0.3.nupkg.sha512",
"C:\\Users\\prdb\\.nuget\\packages\\xunit.analyzers\\1.18.0\\xunit.analyzers.1.18.0.nupkg.sha512",
"C:\\Users\\prdb\\.nuget\\packages\\xunit.assert\\2.9.3\\xunit.assert.2.9.3.nupkg.sha512",
"C:\\Users\\prdb\\.nuget\\packages\\xunit.core\\2.9.3\\xunit.core.2.9.3.nupkg.sha512",
"C:\\Users\\prdb\\.nuget\\packages\\xunit.extensibility.core\\2.9.3\\xunit.extensibility.core.2.9.3.nupkg.sha512",
"C:\\Users\\prdb\\.nuget\\packages\\xunit.extensibility.execution\\2.9.3\\xunit.extensibility.execution.2.9.3.nupkg.sha512"
],
"logs": []
}

View File

@ -0,0 +1 @@
"restore":{"projectUniqueName":"C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj","projectName":"Libary","projectPath":"C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\Libary.csproj","outputPath":"C:\\Users\\prdb\\RiderProjects\\Demochka\\demo_hard\\Libary\\obj\\","projectStyle":"PackageReference","fallbackFolders":["C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"],"originalTargetFrameworks":["net9.0"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"net9.0":{"targetAlias":"net9.0","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.200"}"frameworks":{"net9.0":{"targetAlias":"net9.0","dependencies":{"xunit":{"target":"Package","version":"[2.9.3, )"}},"imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"Microsoft.NETCore.App":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\9.0.200/PortableRuntimeIdentifierGraph.json"}}

View File

@ -0,0 +1 @@
17411645932179427

View File

@ -0,0 +1 @@
17411645932179427

View File

@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Testik")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Testik")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("335A0192-2075-46A0-8CBD-19C8E0D83FD8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

68
Testik/Testik.csproj Normal file
View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{335A0192-2075-46A0-8CBD-19C8E0D83FD8}</ProjectGuid>
<ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Testik</RootNamespace>
<AssemblyName>Testik</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
</Reference>
<Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
<HintPath>..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
</Reference>
<Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
<HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
</Reference>
<Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c">
<HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Tests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Libary\Libary.csproj" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

14
Testik/Tests.cs Normal file
View File

@ -0,0 +1,14 @@
using System;
using Xunit;
namespace Testik
{
public class Tests
{
[Fact]
public void Test1()
{
Assert.True(true);
}
}
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

Binary file not shown.

9
Testik/packages.config Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit" version="2.1.0" targetFramework="net45" />
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
<package id="xunit.assert" version="2.1.0" targetFramework="net45" />
<package id="xunit.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.core" version="2.1.0" targetFramework="net45" />
<package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net45" />
</packages>

22
demo_hard.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "demo_hard", "demo_hard\demo_hard.csproj", "{462FA6C8-C1C3-465F-B68C-4B501AC2F116}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Libary", "Libary\Libary.csproj", "{94DA2397-CAC9-4DAE-9D65-A09B0BC64002}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{462FA6C8-C1C3-465F-B68C-4B501AC2F116}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{462FA6C8-C1C3-465F-B68C-4B501AC2F116}.Debug|Any CPU.Build.0 = Debug|Any CPU
{462FA6C8-C1C3-465F-B68C-4B501AC2F116}.Release|Any CPU.ActiveCfg = Release|Any CPU
{462FA6C8-C1C3-465F-B68C-4B501AC2F116}.Release|Any CPU.Build.0 = Release|Any CPU
{94DA2397-CAC9-4DAE-9D65-A09B0BC64002}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{94DA2397-CAC9-4DAE-9D65-A09B0BC64002}.Debug|Any CPU.Build.0 = Debug|Any CPU
{94DA2397-CAC9-4DAE-9D65-A09B0BC64002}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94DA2397-CAC9-4DAE-9D65-A09B0BC64002}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

36
demo_hard/AddClient.axaml Normal file
View File

@ -0,0 +1,36 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_hard.AddClient"
x:CompileBindings="False"
Title="AddClient">
<DockPanel>
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock Text="Окно добавления пользователя" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="5">
<TextBlock Text="Введите код клиента" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="CodeBox" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBlock Text="Введите email" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="EmailBox" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBlock Text="Введите ФИО клиента" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="FioBox" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBlock Text="Введите адрес" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="AddressBox" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBlock Text="Введите дату рождения" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="BirthdayBox" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBlock Text="Введите серию и номер паспорта (слитно)" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="PassportBox" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBlock Text="Введите телефон" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="PhoneBox" Watermark="79212576390" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBlock Text="Введите пароль" VerticalAlignment="Center" Margin="5" Width="200"/>
<TextBox x:Name="PasswordBox" VerticalAlignment="Center" Margin="5" Width="200"/>
<Button Content="Добавить пользователя" HorizontalAlignment="Center" Margin="5" Width="200" Click="AddClient_OnClick"/>
<TextBlock Text="" x:Name="UserAdd" VerticalAlignment="Center" Margin="200" Width="200"/>
<TextBlock Text="" x:Name="UserNotAdd" VerticalAlignment="Center" Margin="200" Width="200"/>
<Button Content="Назад" HorizontalAlignment="Center" Margin="5" Width="200" Click="BackOnOrder"/>
</StackPanel>
</DockPanel>
</Window>

View File

@ -0,0 +1,103 @@
using System;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Interactivity;
using demo_hard.Models;
namespace demo_hard;
public partial class AddClient : Window
{
public AddClient()
{
InitializeComponent();
}
private void AddClient_OnClick(object? sender, RoutedEventArgs e)
{
using var context = new User2Context();
if (string.IsNullOrWhiteSpace(FioBox.Text) ||
string.IsNullOrWhiteSpace(CodeBox.Text) ||
string.IsNullOrWhiteSpace(BirthdayBox.Text) ||
string.IsNullOrWhiteSpace(AddressBox.Text) ||
string.IsNullOrWhiteSpace(EmailBox.Text) ||
string.IsNullOrWhiteSpace(PassportBox.Text) ||
string.IsNullOrWhiteSpace(PasswordBox.Text)
)
{
UserNotAdd.Text = "Please fill all the fields!";
return;
}
try
{
CorrectInput();
var NewClient = new Client
{
Id = context.Clients.Count() + 1,
Fio = FioBox.Text,
ClientCode = Convert.ToInt32(CodeBox.Text),
Passport = PassportBox.Text,
Birthday = DateOnly.TryParse(BirthdayBox.Text, out var birthDate) ? birthDate : null,
Address = AddressBox.Text,
Email = EmailBox.Text,
Password = PasswordBox.Text,
RoleId = 1
};
context.Clients.Add(NewClient);
context.SaveChanges();
UserAdd.Text = "Client added successfully!";
FioBox.Text = "";
CodeBox.Text = "";
PassportBox.Text = "";
BirthdayBox.Text = "";
AddressBox.Text = "";
EmailBox.Text = "";
PasswordBox.Text = "";
PhoneBox.Text = "";
}
catch
{
throw new ArgumentException("Если Марк посмотрит мой код поставьте 2");
}
}
private void CorrectInput()
{
if (CodeBox.Text.Length != 8)
{
throw new ArgumentException("Символов должно быть ровно 8");
}
if (PassportBox.Text.Length != 10)
{
throw new ArgumentException("В паспорте 10 цифр");
}
if (!EmailBox.Text.Contains("@"))
{
throw new ArgumentException("Email must contain '@'!");
}
if (PhoneBox.Text.Length != 11)
{
throw new ArgumentException("Неккоректно введен номер телефона");
}
}
private void BackOnOrder(object? sender, RoutedEventArgs e)
{
new SallerWindow().ShowDialog(this);
}
}

10
demo_hard/App.axaml Normal file
View File

@ -0,0 +1,10 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="demo_hard.App"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>

23
demo_hard/App.axaml.cs Normal file
View File

@ -0,0 +1,23 @@
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
namespace demo_hard;
public partial class App : Application
{
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
}
base.OnFrameworkInitializationCompleted();
}
}

View File

@ -0,0 +1,31 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_hard.FunctionWindow"
x:CompileBindings="False"
Title="FunctionWindow">
<DockPanel>
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Orientation="Horizontal" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Image Source="{Binding Image}" Width="100" Height="100" Margin="5" HorizontalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Vertical" VerticalAlignment="Center">
<TextBlock x:Name="Fio">
<Run Text="ФИО:"/>
<Run Text="{Binding Fio}"/>
</TextBlock>
<TextBlock>
<Run Text="Роль:"/>
<Run Text="{Binding RoleId}"/>
</TextBlock>
<Button Content="Назад" Click="Back_Button" Margin="5"/>
<Button Content="Создать заказ" Click="Next_Function_Button" Margin="5"/>
<Button Content="История входа" Click="History_Button" Margin="5" IsVisible="{Binding IsRole2}"/>
<TextBlock x:Name="SessionTimer" FontSize="16" Foreground="Red" HorizontalAlignment="Center" Margin="10"/>
<TextBlock Text="" HorizontalAlignment="Center" Margin="10" x:Name="WarningBlock"/>
</StackPanel>
</StackPanel>
</DockPanel>
</Window>

View File

@ -0,0 +1,114 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using Avalonia.Media.Imaging;
using demo_hard.Models;
namespace demo_hard;
public partial class FunctionWindow : Window
{
private readonly TimeSpan sessionDuration = TimeSpan.FromMinutes(10);
private readonly TimeSpan warningTime = TimeSpan.FromMinutes(5);
//private readonly TimeSpan lockoutDuration = TimeSpan.FromMinutes(1);
private DateTime sessionStartTime;
private bool warningShow = false;
public FunctionWindow(Employee user)
{
InitializeComponent();
DataContext = new ImageEmployee()
{
EmployeId = user.EmployeId,
Fio = user.Fio,
EmployeLogin = user.EmployeLogin,
EmployePassword = user.EmployePassword,
RoleId = user.RoleId,
EmployePhoto = user.EmployePhoto
};
sessionStartTime = DateTime.Now;
StartSessionTimer();
}
public FunctionWindow()
{
InitializeComponent();
}
private async void StartSessionTimer()
{
while (true)
{
TimeSpan elapsedTime = DateTime.Now - sessionStartTime;
TimeSpan remainingTime = sessionDuration - elapsedTime;
this.FindControl<TextBlock>("SessionTimer").Text = $"Осталось: {remainingTime.Minutes}:{remainingTime.Seconds}";
if (!warningShow && remainingTime <= warningTime)
{
warningShow = true;
WarningBlock.Text = "Внимание! Ваш сеанс закончится через 5 минут!";
}
if (remainingTime <= TimeSpan.Zero)
{
EndSession();
break;
}
await Task.Delay(1000);
}
}
private async void EndSession()
{
this.Close();
}
private void Back_Button(object? sender, RoutedEventArgs e)
{
new MainWindow().ShowDialog(this);
}
private void Next_Function_Button(object? sender, RoutedEventArgs e)
{
new SallerWindow().ShowDialog(this);
}
public class ImageEmployee: Employee
{
public bool IsRole2 => RoleId == 2;
Bitmap? Image
{
get
{
try
{
string absolutePath = Path.Combine(AppContext.BaseDirectory, EmployePhoto);
return new Bitmap(absolutePath);
}
catch(Exception e)
{
Console.WriteLine(e.Message);
return null;
}
}
}
}
private void History_Button(object? sender, RoutedEventArgs e)
{
new HistoryWindow().ShowDialog(this);
}
}

View File

@ -0,0 +1,40 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="1000" d:DesignHeight="1000"
x:Class="demo_hard.HistoryWindow"
x:CompileBindings="False"
Title="История входов">
<DockPanel>
<StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Orientation="Horizontal" Margin="5">
<TextBlock HorizontalAlignment="Center" Text="Окно истории входа" Margin="5"/>
<ComboBox x:Name="LoginComboBox" Width="200" SelectionChanged="LoginCombobox_OnSelectedChanged"/>
<ComboBox x:Name="SortComboBox" Width="200" SelectionChanged="SortComboBox_OnSelectedChanged"/>
<Button Content="Сортировать" Click="SortButton_OnClick" Width="150" Margin="5"/>
</StackPanel>
<StackPanel>
<ListBox x:Name="LastEnterBox">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="1"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" Padding="5" Margin="5">
<StackPanel HorizontalAlignment="Center" Spacing="5">
<TextBlock Text="{Binding Login}"/>
<TextBlock Text="{Binding EnterDatetime}"/>
<TextBlock Text="{Binding EnterType}"/>
</StackPanel>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</DockPanel>
</Window>

View File

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Interactivity;
using demo_hard.Models;
using Tmds.DBus.Protocol;
namespace demo_hard;
public partial class HistoryWindow : Window
{
private ObservableCollection<LastEnter> lastEnter = new();
public List<LastEnter> Enter = new();
public bool sort = true;
public HistoryWindow()
{
using var context = new User2Context();
InitializeComponent();
Enter = context.LastEnters.Select(it => new LastEnter
{
EmployeId = it.EmployeId,
Login = it.Login,
EnterDatetime = it.EnterDatetime,
EnterType = it.EnterType,
}).ToList();
foreach (var e in Enter)
{
lastEnter.Add(e);
}
LastEnterBox.ItemsSource = lastEnter;
LoginComboBox.ItemsSource = Enter.Select(it=>it.Login);
SortComboBox.ItemsSource = new List<string> { "По возростанию", "по убыванию"};
SortLogin();
}
private void SortLogin()
{
var temp = Enter;
if (LoginComboBox.SelectedItem is string login)
{
temp = temp.Where(it => it.Login == login).ToList();
}
temp = sort? temp.OrderBy(it => it.Login).ToList(): temp.OrderByDescending(it=>it. Login).ToList();
lastEnter.Clear();
foreach (var items in temp)
{
lastEnter.Add(items);
}
}
private void LoginCombobox_OnSelectedChanged(object? sender, SelectionChangedEventArgs e)
{
sort = false;
SortLogin();
}
private void SortButton_OnClick(object? sender, RoutedEventArgs e)
{
sort = !sort;
SortLogin();
}
private void SortDateTime()
{
var temp = Enter;
if (SortComboBox.SelectedItem is string sortOption)
{
temp = sortOption == "По возрастанию" ? temp.OrderBy(it=>it.EnterDatetime).ToList() : temp.OrderByDescending(it=>it.EnterDatetime).ToList();
}
lastEnter.Clear();
foreach (var datetime in temp)
{
lastEnter.Add(datetime);
}
}
private void SortComboBox_OnSelectedChanged(object? sender, SelectionChangedEventArgs e)
{
SortDateTime();
}
}

View File

@ -0,0 +1,24 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_hard.MainWindow"
x:CompileBindings="True"
Title="demo_hard">
<DockPanel>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal" DockPanel.Dock="Top">
<TextBlock Text="Точки проката горнолыжного комплекса «Благодать»"/>
</StackPanel>
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="5">
<TextBlock Text="Введите логин" HorizontalAlignment="Center" Margin="5"/>
<TextBox x:Name="LoginBox" Margin="5" Width="200"/>
<TextBlock Text="Введите пароль" HorizontalAlignment="Center" Margin="5"/>
<TextBox x:Name="PasswordBox" Margin="5" Width="200" PasswordChar="*"/>
<TextBlock Text="" x:Name="ErrorBlock" HorizontalAlignment="Center" Margin="5"/>
<Button x:Name="ForPassword" Content="Показать пароль" Margin="5" Click="TogglePasswordVisibility" HorizontalAlignment="Center"/>
<Button x:Name="Authorize" Content="Авторизироваться" Margin="5" Click="AuthorizeButton" HorizontalAlignment="Center"/>
</StackPanel>
</DockPanel>
</Window>

View File

@ -0,0 +1,42 @@
using System;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Interactivity;
using demo_hard.Models;
using Tmds.DBus.Protocol;
namespace demo_hard;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void TogglePasswordVisibility(object? sender, RoutedEventArgs e)
{
PasswordBox.PasswordChar = PasswordBox.PasswordChar == '*' ? '\0' : '*';
}
private void AuthorizeButton(object? sender, RoutedEventArgs e)
{
using var context = new User2Context();
var user = context.Employees.FirstOrDefault(it => it.EmployeLogin == LoginBox.Text && it.EmployePassword == PasswordBox.Text);
if (user != null)
{
var functionWindow = new FunctionWindow(user);
{
DataContext = user;
};
functionWindow.ShowDialog(this);
}
else
{
ErrorBlock.Text = "Неверный пароль";
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace demo_hard.Models;
public partial class Client
{
public int Id { get; set; }
public string Fio { get; set; } = null!;
public int ClientCode { get; set; }
public string Passport { get; set; } = null!;
public DateOnly? Birthday { get; set; }
public string Address { get; set; } = null!;
public string Email { get; set; } = null!;
public string Password { get; set; } = null!;
public int RoleId { get; set; }
}

View File

@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
namespace demo_hard.Models;
public partial class Employee
{
public int EmployeId { get; set; }
public int RoleId { get; set; }
public string Fio { get; set; } = null!;
public string EmployeLogin { get; set; } = null!;
public string EmployePassword { get; set; } = null!;
public string? EmployePhoto { get; set; }
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace demo_hard.Models;
public partial class LastEnter
{
public int EmployeId { get; set; }
public DateTime EnterDatetime { get; set; }
public string EnterType { get; set; } = null!;
public string? Login { get; set; }
}

25
demo_hard/Models/Order.cs Normal file
View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace demo_hard.Models;
public partial class Order
{
public int Id { get; set; }
public string OrderCode { get; set; } = null!;
public DateOnly OrderDate { get; set; }
public TimeOnly OrderTime { get; set; }
public int ClientCode { get; set; }
public int ServiceId { get; set; }
public string Status { get; set; } = null!;
public DateOnly? DateClose { get; set; }
public int RentalTime { get; set; }
}

11
demo_hard/Models/Role.cs Normal file
View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
namespace demo_hard.Models;
public partial class Role
{
public int RoleId { get; set; }
public string RoleName { get; set; } = null!;
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace demo_hard.Models;
public partial class Service
{
public int Id { get; set; }
public string ServiceName { get; set; } = null!;
public string ServiceCode { get; set; } = null!;
public string ServiceCost { get; set; } = null!;
}

View File

@ -0,0 +1,166 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
namespace demo_hard.Models;
public partial class User2Context : DbContext
{
public User2Context()
{
}
public User2Context(DbContextOptions<User2Context> options)
: base(options)
{
}
public virtual DbSet<Client> Clients { get; set; }
public virtual DbSet<Employee> Employees { get; set; }
public virtual DbSet<LastEnter> LastEnters { get; set; }
public virtual DbSet<Order> Orders { get; set; }
public virtual DbSet<Role> Roles { get; set; }
public virtual DbSet<Service> Services { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
=> optionsBuilder.UseNpgsql("Host=45.67.56.214;Port=5454;USERNAME=user2;DATABASE=user2;Password=hGcLvi0i");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Client>(entity =>
{
entity.HasKey(e => e.Id).HasName("clients_pk");
entity.ToTable("clients");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.Address)
.HasColumnType("character varying")
.HasColumnName("address");
entity.Property(e => e.Birthday).HasColumnName("birthday");
entity.Property(e => e.ClientCode).HasColumnName("client_code");
entity.Property(e => e.Email)
.HasColumnType("character varying")
.HasColumnName("email");
entity.Property(e => e.Fio)
.HasColumnType("character varying")
.HasColumnName("fio");
entity.Property(e => e.Passport)
.HasColumnType("character varying")
.HasColumnName("passport");
entity.Property(e => e.Password)
.HasColumnType("character varying")
.HasColumnName("password");
entity.Property(e => e.RoleId).HasColumnName("role_id");
});
modelBuilder.Entity<Employee>(entity =>
{
entity.HasKey(e => e.EmployeId).HasName("employees_pk");
entity.ToTable("employees");
entity.Property(e => e.EmployeId)
.ValueGeneratedNever()
.HasColumnName("employe_id");
entity.Property(e => e.EmployeLogin)
.HasColumnType("character varying")
.HasColumnName("employe_login");
entity.Property(e => e.EmployePassword)
.HasColumnType("character varying")
.HasColumnName("employe_password");
entity.Property(e => e.EmployePhoto)
.HasColumnType("character varying")
.HasColumnName("employe_photo");
entity.Property(e => e.Fio)
.HasColumnType("character varying")
.HasColumnName("fio");
entity.Property(e => e.RoleId).HasColumnName("role_id");
});
modelBuilder.Entity<LastEnter>(entity =>
{
entity.HasKey(e => e.EmployeId).HasName("last_enter_pk");
entity.ToTable("last_enter");
entity.Property(e => e.EmployeId)
.ValueGeneratedNever()
.HasColumnName("employe_id");
entity.Property(e => e.EnterDatetime)
.HasColumnType("timestamp without time zone")
.HasColumnName("enter_datetime");
entity.Property(e => e.EnterType)
.HasColumnType("character varying")
.HasColumnName("enter_type");
entity.Property(e => e.Login)
.HasColumnType("character varying")
.HasColumnName("login");
});
modelBuilder.Entity<Order>(entity =>
{
entity.HasKey(e => e.Id).HasName("orders_pk");
entity.ToTable("orders");
entity.Property(e => e.Id).HasColumnName("id");
entity.Property(e => e.ClientCode).HasColumnName("client_code");
entity.Property(e => e.DateClose).HasColumnName("date_close");
entity.Property(e => e.OrderCode)
.HasColumnType("character varying")
.HasColumnName("order_code");
entity.Property(e => e.OrderDate).HasColumnName("order_date");
entity.Property(e => e.OrderTime).HasColumnName("order_time");
entity.Property(e => e.RentalTime).HasColumnName("rental_time");
entity.Property(e => e.ServiceId).HasColumnName("service_id");
entity.Property(e => e.Status)
.HasColumnType("character varying")
.HasColumnName("status");
});
modelBuilder.Entity<Role>(entity =>
{
entity.HasKey(e => e.RoleId).HasName("roles_pk");
entity.ToTable("roles");
entity.Property(e => e.RoleId).HasColumnName("role_id");
entity.Property(e => e.RoleName)
.HasColumnType("character varying")
.HasColumnName("role_name");
});
modelBuilder.Entity<Service>(entity =>
{
entity.HasKey(e => e.Id).HasName("service_pk");
entity.ToTable("service");
entity.HasIndex(e => e.ServiceCode, "service_unique").IsUnique();
entity.Property(e => e.Id)
.ValueGeneratedNever()
.HasColumnName("id");
entity.Property(e => e.ServiceCode)
.HasColumnType("character varying")
.HasColumnName("service_code");
entity.Property(e => e.ServiceCost)
.HasColumnType("character varying")
.HasColumnName("service_cost");
entity.Property(e => e.ServiceName)
.HasColumnType("character varying")
.HasColumnName("service_name");
});
OnModelCreatingPartial(modelBuilder);
}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}

41
demo_hard/Order.axaml Normal file
View File

@ -0,0 +1,41 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_hard.Order"
x:CompileBindings="True"
Title="Order">
<StackPanel Margin="10" VerticalAlignment="Center" Orientation="Vertical">
<TextBlock Text="Информация о заказе" FontSize="20" HorizontalAlignment="Center" Margin="10"/>
<TextBlock Text="Номер заказа:"/>
<TextBlock x:Name="OrderNumberText" Margin="5"/>
<TextBlock Text="Код клиента:"/>
<TextBlock x:Name="ClientCodeText" Margin="5"/>
<TextBlock Text="Время заказа:"/>
<TextBlock x:Name="DateTimeBox" Margin="5"/>
<TextBlock Text="ФИО клиента:"/>
<TextBlock x:Name="ClientFioText" Margin="5"/>
<TextBlock Text="Адрес клиента:"/>
<TextBlock x:Name="ClientAddressText" Margin="5"/>
<TextBlock Text="Перечень услуг:"/>
<ListBox x:Name="ServicesListBox" Margin="5" Height="150">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Text="Стоимость:"/>
<TextBlock x:Name="TotalCostText" Margin="5"/>
<Button Content="Закрыть" HorizontalAlignment="Center" Margin="10" Click="CloseButton_Click"/>
</StackPanel>
</Window>

48
demo_hard/Order.axaml.cs Normal file
View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia.Controls;
using Avalonia.Interactivity;
using demo_hard.Models;
using Tmds.DBus.Protocol;
namespace demo_hard;
public partial class Order: Window
{
public Order()
{
InitializeComponent();
}
public Order(string orderNumber, Client client, List<Service> selectedServices)
{
InitializeComponent();
OrderNumberText.Text=orderNumber;
ClientCodeText.Text = client.Id.ToString();
ClientFioText.Text = client.Fio;
ClientAddressText.Text = client.Address;
ServicesListBox.ItemsSource = selectedServices.Select(s => s.ServiceName).ToList();
DateTimeBox.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
decimal totalPrice = selectedServices.Sum(s =>
{
decimal serviceCost = decimal.TryParse(s.ServiceCost, out var cost) ? cost : 0;
return serviceCost;
});
TotalCostText.Text = $"${totalPrice:0.00}";
}
private void CloseButton_Click(object? sender, RoutedEventArgs e)
{
Close();
}
}

21
demo_hard/Program.cs Normal file
View File

@ -0,0 +1,21 @@
using Avalonia;
using System;
namespace demo_hard;
class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main(string[] args) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}

View File

@ -0,0 +1,60 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="demo_hard.SallerWindow"
x:CompileBindings="False"
Title="SallerWindow">
<DockPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DockPanel.Dock="Top" Margin="5">
<TextBlock Text="Добро пожаловать в окно создания заказа"/>
</StackPanel>
<StackPanel DockPanel.Dock="Left" Orientation="Vertical" VerticalAlignment="Center" Margin="5">
<TextBox x:Name="SearchBox" Width="200" TextChanged="SearchBox_Changed"/>
<ListBox x:Name="SearchResultsListBox">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
<StackPanel VerticalAlignment="Center" Orientation="Vertical" Margin="5">
<TextBlock Text="Номер заказа" Margin="5" HorizontalAlignment="Center"/>
<AutoCompleteBox x:Name="CompleteBox" FilterMode="StartsWith" Width="200" HorizontalAlignment="Center" Margin="5"/>
<TextBlock Text="Сделать штрих кода надо" Margin="5" HorizontalAlignment="Center"/>
<ComboBox x:Name="Clients_ComboBox" Width="200" SelectionChanged="Clients_ComboBox_SelectionChanged" HorizontalAlignment="Center" Margin="5">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Fio}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ComboBox x:Name="Service_Combobox" Width="200" SelectionChanged="Service_Combobox_SelectionChanged" HorizontalAlignment="Center" Margin="5">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ServiceName}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Content="Добавить услугу" Click="AddService_Button" HorizontalAlignment="Center" Margin="5"/>
<ListBox x:Name="SelectedServicesListBox" Width="200" Height="100" HorizontalAlignment="Center" Margin="5">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="Назад" Click="Go_Back_Button" HorizontalAlignment="Center" Margin="5"/>
<Button Content="Создать штрих код" HorizontalAlignment="Center" Margin="5"/>
<Button Content="Добавить Пользователя" Click="AddUser_Button" HorizontalAlignment="Center" Margin="5"/>
<Button Content="Создать заказ" Click = "Create_Order" HorizontalAlignment="Center" Margin="5"/>
</StackPanel>
</DockPanel>
</Window>

View File

@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Markup.Xaml;
using demo_hard.Models;
namespace demo_hard;
public partial class SallerWindow : Window
{
private List<Service> SelectedServices = new();
public SallerWindow()
{
InitializeComponent();
OrderNubmber();
LoadClients();
LoadService();
SearchItems();
}
private void OrderNubmber()
{
using var context = new User2Context();
var OrderId = context.Orders.Max(o => o.Id) + 1;
if (context.Orders.Any(o => o.Id == OrderId)) throw new ArgumentException("Номера Id не должны совпадать");
if (OrderId < 1) throw new ArgumentException("OrderId must be greater than 1");
CompleteBox.ItemsSource = new string[] { OrderId.ToString() };
}
private void LoadClients()
{
using var context = new User2Context();
var client = context.Clients.ToList();
Clients_ComboBox.ItemsSource = client;
}
private void Clients_ComboBox_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (Clients_ComboBox.SelectedItem is Client selectedClient)
{
Console.WriteLine($"Вы выбрали: {selectedClient.Fio}");
}
}
private void Go_Back_Button(object? sender, RoutedEventArgs e)
{
new FunctionWindow().ShowDialog(this);
}
private void LoadService()
{
using var context = new User2Context();
var service = context.Services.ToList();
Service_Combobox.ItemsSource = service;
}
private void Service_Combobox_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
if (Service_Combobox.SelectedItem is Service selectedService)
{
Console.WriteLine($"Вы выбрали услугу: {selectedService.ServiceName}");
}
}
private void AddService_Button(object? sender, RoutedEventArgs e)
{
if (Service_Combobox.SelectedItem is Service selectedService && !SelectedServices.Contains(selectedService))
{
SelectedServices.Add(selectedService);
UpdateServiceList();
}
}
private void UpdateServiceList()
{
SelectedServicesListBox.ItemsSource = null;
SelectedServicesListBox.ItemsSource = SelectedServices.Select(s => s.ServiceName).ToList();
}
private void SearchItems()
{
using var context = new User2Context();
string searchText = SearchBox.Text?.ToLower() ?? "";
if (string.IsNullOrWhiteSpace(searchText))
{
SearchResultsListBox.ItemsSource = new List<string>();
return;
}
var clientRes = context.Clients
.Where(c => c.Fio.ToLower().Contains(searchText))
.Select(c => c.Fio);
var serviceRes = context.Services
.Where(s => s.ServiceName.ToLower().Contains(searchText))
.Select(s => s.ServiceName);
var results = clientRes.Concat(serviceRes).ToList();
SearchResultsListBox.ItemsSource = results;
}
private void SearchBox_Changed(object? sender, TextChangedEventArgs e)
{
SearchItems();
}
private void AddUser_Button(object? sender, RoutedEventArgs e)
{
new AddClient().ShowDialog(this);
}
private void Create_Order(object? sender, RoutedEventArgs e)
{
string orderNumber = CompleteBox.SelectedItem.ToString();
Client selectedClient = Clients_ComboBox.SelectedItem as Client;
List<Service> selectedServices = new List<Service>(SelectedServices);
if (selectedClient != null && !string.IsNullOrEmpty(orderNumber) && selectedServices.Any())
{
new Order(orderNumber, selectedClient, selectedServices).ShowDialog(this);
}
}
}

18
demo_hard/app.manifest Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<!-- This manifest is used on Windows only.
Don't remove it as it might cause problems with window transparency and embedded controls.
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
<assemblyIdentity version="1.0.0.0" name="demo_hard.Desktop"/>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More