diff --git a/Labaratory/Labaratory/App.config b/Labaratory/Labaratory/App.config
index 5679481..5578ff8 100644
--- a/Labaratory/Labaratory/App.config
+++ b/Labaratory/Labaratory/App.config
@@ -13,6 +13,6 @@
-
+
\ No newline at end of file
diff --git a/Labaratory/Labaratory/App.xaml b/Labaratory/Labaratory/App.xaml
index 8e969db..49fe5d4 100644
--- a/Labaratory/Labaratory/App.xaml
+++ b/Labaratory/Labaratory/App.xaml
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Labaratory" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
- StartupUri="MainWindow.xaml">
+ StartupUri="Views/MainWindow.xaml">
diff --git a/Labaratory/Labaratory/Labaratory.csproj b/Labaratory/Labaratory/Labaratory.csproj
index e4cf16a..2eb5c33 100644
--- a/Labaratory/Labaratory/Labaratory.csproj
+++ b/Labaratory/Labaratory/Labaratory.csproj
@@ -89,67 +89,68 @@
MSBuild:Compile
Designer
-
+
Model1.tt
-
+
Model1.tt
-
-
+
+
+
Model1.tt
-
+
Model1.tt
-
-
+
+
True
True
Model1.Context.tt
-
+
True
True
Model1.tt
-
+
True
True
Model1.edmx
-
+
Model1.tt
-
+
Model1.tt
-
+
Model1.tt
-
+
Model1.tt
-
+
Model1.tt
-
+
Model1.tt
-
+
Model1.tt
-
+
Model1.tt
-
+
Model1.tt
-
-
+
+
Model1.tt
-
+
MSBuild:Compile
Designer
@@ -157,7 +158,7 @@
App.xaml
Code
-
+
MainWindow.xaml
Code
@@ -180,11 +181,11 @@
ResXFileCodeGenerator
Resources.Designer.cs
-
+
EntityModelCodeGenerator
Model1.Designer.cs
-
+
Model1.edmx
@@ -197,12 +198,12 @@
-
+
TextTemplatingFileGenerator
Model1.Context.cs
Model1.edmx
-
+
TextTemplatingFileGenerator
Model1.edmx
Model1.cs
diff --git a/Labaratory/Labaratory/LoginViewModel.cs b/Labaratory/Labaratory/LoginViewModel.cs
deleted file mode 100644
index 16a6ef9..0000000
--- a/Labaratory/Labaratory/LoginViewModel.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Input;
-
-namespace Labaratory
-{
- public class LoginViewModel : BaseViewModel
- {
- private string _login;
- private string _captchaText;
- private bool _isCaptchaVisible;
-
- public string Login
- {
- get => _login;
- set { _login = value; OnPropertyChanged(); }
- }
-
- public bool IsCaptchaVisible
- {
- get => _isCaptchaVisible;
- set { _isCaptchaVisible = value; OnPropertyChanged(); }
- }
-
- public ICommand LoginCommand { get; }
-
- public LoginViewModel()
- {
- // Инициализация команд и капчи
- }
- }
-}
diff --git a/Labaratory/Labaratory/Analyzer.cs b/Labaratory/Labaratory/Models/Analyzer.cs
similarity index 98%
rename from Labaratory/Labaratory/Analyzer.cs
rename to Labaratory/Labaratory/Models/Analyzer.cs
index 6c9f195..f742183 100644
--- a/Labaratory/Labaratory/Analyzer.cs
+++ b/Labaratory/Labaratory/Models/Analyzer.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Analyzer_Logs.cs b/Labaratory/Labaratory/Models/Analyzer_Logs.cs
similarity index 97%
rename from Labaratory/Labaratory/Analyzer_Logs.cs
rename to Labaratory/Labaratory/Models/Analyzer_Logs.cs
index 60bb550..1e6caab 100644
--- a/Labaratory/Labaratory/Analyzer_Logs.cs
+++ b/Labaratory/Labaratory/Models/Analyzer_Logs.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Insurance_Companies.cs b/Labaratory/Labaratory/Models/Insurance_Companies.cs
similarity index 98%
rename from Labaratory/Labaratory/Insurance_Companies.cs
rename to Labaratory/Labaratory/Models/Insurance_Companies.cs
index deb8e09..a336c31 100644
--- a/Labaratory/Labaratory/Insurance_Companies.cs
+++ b/Labaratory/Labaratory/Models/Insurance_Companies.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Invoice.cs b/Labaratory/Labaratory/Models/Invoice.cs
similarity index 97%
rename from Labaratory/Labaratory/Invoice.cs
rename to Labaratory/Labaratory/Models/Invoice.cs
index 0957f87..a4b1c6b 100644
--- a/Labaratory/Labaratory/Invoice.cs
+++ b/Labaratory/Labaratory/Models/Invoice.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Model1.Context.cs b/Labaratory/Labaratory/Models/Model1.Context.cs
similarity index 98%
rename from Labaratory/Labaratory/Model1.Context.cs
rename to Labaratory/Labaratory/Models/Model1.Context.cs
index 374e494..401adb4 100644
--- a/Labaratory/Labaratory/Model1.Context.cs
+++ b/Labaratory/Labaratory/Models/Model1.Context.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Data.Entity;
diff --git a/Labaratory/Labaratory/Model1.Context.tt b/Labaratory/Labaratory/Models/Model1.Context.tt
similarity index 100%
rename from Labaratory/Labaratory/Model1.Context.tt
rename to Labaratory/Labaratory/Models/Model1.Context.tt
diff --git a/Labaratory/Labaratory/Model1.Designer.cs b/Labaratory/Labaratory/Models/Model1.Designer.cs
similarity index 93%
rename from Labaratory/Labaratory/Model1.Designer.cs
rename to Labaratory/Labaratory/Models/Model1.Designer.cs
index 501daac..e29ec55 100644
--- a/Labaratory/Labaratory/Model1.Designer.cs
+++ b/Labaratory/Labaratory/Models/Model1.Designer.cs
@@ -1,4 +1,4 @@
-// Создание кода T4 для модели "C:\Users\usersql\source\repos\UP01TASK3\Labaratory\Labaratory\Model1.edmx" включено.
+// Создание кода T4 для модели "C:\Users\usersql\source\repos\UP01TASK3\Labaratory\Labaratory\Models\Model1.edmx" включено.
// Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
// на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
// открыта в конструкторе.
diff --git a/Labaratory/Labaratory/Model1.cs b/Labaratory/Labaratory/Models/Model1.cs
similarity index 100%
rename from Labaratory/Labaratory/Model1.cs
rename to Labaratory/Labaratory/Models/Model1.cs
diff --git a/Labaratory/Labaratory/Model1.edmx b/Labaratory/Labaratory/Models/Model1.edmx
similarity index 100%
rename from Labaratory/Labaratory/Model1.edmx
rename to Labaratory/Labaratory/Models/Model1.edmx
diff --git a/Labaratory/Labaratory/Model1.edmx.diagram b/Labaratory/Labaratory/Models/Model1.edmx.diagram
similarity index 100%
rename from Labaratory/Labaratory/Model1.edmx.diagram
rename to Labaratory/Labaratory/Models/Model1.edmx.diagram
diff --git a/Labaratory/Labaratory/Model1.tt b/Labaratory/Labaratory/Models/Model1.tt
similarity index 100%
rename from Labaratory/Labaratory/Model1.tt
rename to Labaratory/Labaratory/Models/Model1.tt
diff --git a/Labaratory/Labaratory/Order.cs b/Labaratory/Labaratory/Models/Order.cs
similarity index 98%
rename from Labaratory/Labaratory/Order.cs
rename to Labaratory/Labaratory/Models/Order.cs
index 51565e5..d2d8299 100644
--- a/Labaratory/Labaratory/Order.cs
+++ b/Labaratory/Labaratory/Models/Order.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Order_Items.cs b/Labaratory/Labaratory/Models/Order_Items.cs
similarity index 98%
rename from Labaratory/Labaratory/Order_Items.cs
rename to Labaratory/Labaratory/Models/Order_Items.cs
index e73a73c..fcf5b01 100644
--- a/Labaratory/Labaratory/Order_Items.cs
+++ b/Labaratory/Labaratory/Models/Order_Items.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Order_Statuses.cs b/Labaratory/Labaratory/Models/Order_Statuses.cs
similarity index 97%
rename from Labaratory/Labaratory/Order_Statuses.cs
rename to Labaratory/Labaratory/Models/Order_Statuses.cs
index aae936a..f987e89 100644
--- a/Labaratory/Labaratory/Order_Statuses.cs
+++ b/Labaratory/Labaratory/Models/Order_Statuses.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Patient.cs b/Labaratory/Labaratory/Models/Patient.cs
similarity index 98%
rename from Labaratory/Labaratory/Patient.cs
rename to Labaratory/Labaratory/Models/Patient.cs
index 775a27c..14f5294 100644
--- a/Labaratory/Labaratory/Patient.cs
+++ b/Labaratory/Labaratory/Models/Patient.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Policy_Types.cs b/Labaratory/Labaratory/Models/Policy_Types.cs
similarity index 97%
rename from Labaratory/Labaratory/Policy_Types.cs
rename to Labaratory/Labaratory/Models/Policy_Types.cs
index 91987d7..253d8e7 100644
--- a/Labaratory/Labaratory/Policy_Types.cs
+++ b/Labaratory/Labaratory/Models/Policy_Types.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Rendered_Services.cs b/Labaratory/Labaratory/Models/Rendered_Services.cs
similarity index 98%
rename from Labaratory/Labaratory/Rendered_Services.cs
rename to Labaratory/Labaratory/Models/Rendered_Services.cs
index f8d36fc..02016b8 100644
--- a/Labaratory/Labaratory/Rendered_Services.cs
+++ b/Labaratory/Labaratory/Models/Rendered_Services.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Role.cs b/Labaratory/Labaratory/Models/Role.cs
similarity index 97%
rename from Labaratory/Labaratory/Role.cs
rename to Labaratory/Labaratory/Models/Role.cs
index 3f7d315..791b67c 100644
--- a/Labaratory/Labaratory/Role.cs
+++ b/Labaratory/Labaratory/Models/Role.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Service.cs b/Labaratory/Labaratory/Models/Service.cs
similarity index 98%
rename from Labaratory/Labaratory/Service.cs
rename to Labaratory/Labaratory/Models/Service.cs
index 0fe68e5..9baf2e6 100644
--- a/Labaratory/Labaratory/Service.cs
+++ b/Labaratory/Labaratory/Models/Service.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/Service_Statuses.cs b/Labaratory/Labaratory/Models/Service_Statuses.cs
similarity index 97%
rename from Labaratory/Labaratory/Service_Statuses.cs
rename to Labaratory/Labaratory/Models/Service_Statuses.cs
index 6fd5935..d4152ee 100644
--- a/Labaratory/Labaratory/Service_Statuses.cs
+++ b/Labaratory/Labaratory/Models/Service_Statuses.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/User.cs b/Labaratory/Labaratory/Models/User.cs
similarity index 98%
rename from Labaratory/Labaratory/User.cs
rename to Labaratory/Labaratory/Models/User.cs
index 100514d..ed38730 100644
--- a/Labaratory/Labaratory/User.cs
+++ b/Labaratory/Labaratory/Models/User.cs
@@ -7,7 +7,7 @@
//
//------------------------------------------------------------------------------
-namespace Labaratory
+namespace Labaratory.Models
{
using System;
using System.Collections.Generic;
diff --git a/Labaratory/Labaratory/SessionManager.cs b/Labaratory/Labaratory/Services/SessionManager.cs
similarity index 100%
rename from Labaratory/Labaratory/SessionManager.cs
rename to Labaratory/Labaratory/Services/SessionManager.cs
diff --git a/Labaratory/Labaratory/Services/Valid.cs b/Labaratory/Labaratory/Services/Valid.cs
new file mode 100644
index 0000000..7edd86a
--- /dev/null
+++ b/Labaratory/Labaratory/Services/Valid.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Labaratory.Services
+{
+ public static class Valid
+ {
+ public static string GenerateCaptchaText()
+ {
+ const string chars = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789";
+ Random rand = new Random();
+ return new string(Enumerable.Repeat(chars, 4)
+ .Select(s => s[rand.Next(s.Length)]).ToArray());
+ }
+
+ public static bool IsPasswordStrong(string password)
+ {
+ return false;
+ }
+
+ public static bool ValidateCaptcha(string input, string original)
+ {
+ if (string.IsNullOrEmpty(input)) return false;
+ return input.Trim().ToUpper() == original.ToUpper();
+ }
+ }
+}
diff --git a/Labaratory/Labaratory/BaseViewModel.cs b/Labaratory/Labaratory/ViewModels/BaseViewModel.cs
similarity index 100%
rename from Labaratory/Labaratory/BaseViewModel.cs
rename to Labaratory/Labaratory/ViewModels/BaseViewModel.cs
diff --git a/Labaratory/Labaratory/ViewModels/LoginViewModel.cs b/Labaratory/Labaratory/ViewModels/LoginViewModel.cs
new file mode 100644
index 0000000..af6399e
--- /dev/null
+++ b/Labaratory/Labaratory/ViewModels/LoginViewModel.cs
@@ -0,0 +1,78 @@
+using Labaratory.Services;
+using System;
+using System.Windows;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Input;
+using Wpf.Ui.Input;
+
+namespace Labaratory
+{
+ public class LoginViewModel : BaseViewModel
+ {
+ private string _login;
+ private string _password;
+ private string _captchaText;
+ private string _captchaInput;
+ private bool _isCaptchaVisible;
+ private bool _isLoginEnabled = true;
+ private int _failedAttempts = 0;
+ private Models.LaboratoryDBEntities db = new Models.LaboratoryDBEntities();
+
+
+ // Свойства для привязки (Binding)
+ public string Login { get => _login; set { _login = value; OnPropertyChanged(); } }
+ public string Password { get => _password; set { _password = value; OnPropertyChanged(); } }
+ public string CaptchaText { get => _captchaText; set { _captchaText = value; OnPropertyChanged(); } }
+ public string CaptchaInput { get => _captchaInput; set { _captchaInput = value; OnPropertyChanged(); } }
+ public bool IsCaptchaVisible { get => _isCaptchaVisible; set { _isCaptchaVisible = value; OnPropertyChanged(); } }
+ public bool IsLoginEnabled { get => _isLoginEnabled; set { _isLoginEnabled = value; OnPropertyChanged(); } }
+
+ // Команды
+ public ICommand LoginCommand { get; }
+ public ICommand RefreshCaptchaCommand { get; }
+
+ public LoginViewModel()
+ {
+ LoginCommand = new RelayCommand