Виктор Александрович

master
vikto 2026-05-19 15:52:25 +10:00
parent e89906e6e8
commit db9efc98b9
160 changed files with 1596 additions and 3042 deletions

View File

@ -8,6 +8,7 @@
<entry key="Policlinica/Views/AdminWindow.axaml" value="Policlinica/Policlinica.csproj" /> <entry key="Policlinica/Views/AdminWindow.axaml" value="Policlinica/Policlinica.csproj" />
<entry key="Policlinica/Views/AdminWindowView.axaml" value="Policlinica/Policlinica.csproj" /> <entry key="Policlinica/Views/AdminWindowView.axaml" value="Policlinica/Policlinica.csproj" />
<entry key="Policlinica/Views/AutorizationView.axaml" value="Policlinica/Policlinica.csproj" /> <entry key="Policlinica/Views/AutorizationView.axaml" value="Policlinica/Policlinica.csproj" />
<entry key="Policlinica/Views/DoctorView.axaml" value="Policlinica/Policlinica.csproj" />
<entry key="Policlinica/Views/DoctoraWindow.axaml" value="Policlinica/Policlinica.csproj" /> <entry key="Policlinica/Views/DoctoraWindow.axaml" value="Policlinica/Policlinica.csproj" />
<entry key="Policlinica/Views/InfoWindow.axaml" value="Policlinica/Policlinica.csproj" /> <entry key="Policlinica/Views/InfoWindow.axaml" value="Policlinica/Policlinica.csproj" />
<entry key="Policlinica/Views/PasswordWindow.axaml" value="Policlinica/Policlinica.csproj" /> <entry key="Policlinica/Views/PasswordWindow.axaml" value="Policlinica/Policlinica.csproj" />

View File

@ -1,5 +1,6 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AActivatorUtilities_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fed8a591762ce49682d92e2a368f2ae47024959885623cca2929b25f95507612_003FActivatorUtilities_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AActivatorUtilities_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fed8a591762ce49682d92e2a368f2ae47024959885623cca2929b25f95507612_003FActivatorUtilities_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAvaloniaXamlLoader_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FSourcesCache_003F80462644bd1cc7e0b229dc4f5752b48c01cb67b46ae563b1b5078cc2556b98_003FAvaloniaXamlLoader_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACallSiteFactory_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F51986e38149d7168a48244177b10e8ce2c0faf1d4b35fbbeaf26cb3d652320_003FCallSiteFactory_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ACallSiteFactory_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003F51986e38149d7168a48244177b10e8ce2c0faf1d4b35fbbeaf26cb3d652320_003FCallSiteFactory_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExceptionDispatchInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fbd1d5c50194fea68ff3559c160230b0ab50f5acf4ce3061bffd6d62958e2182_003FExceptionDispatchInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExceptionDispatchInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fbd1d5c50194fea68ff3559c160230b0ab50f5acf4ce3061bffd6d62958e2182_003FExceptionDispatchInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExceptionDispatchInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F729d9a4cc4d14fd8892315623acbb0ffe26400_003F24_003F9e991285_003FExceptionDispatchInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AExceptionDispatchInfo_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F729d9a4cc4d14fd8892315623acbb0ffe26400_003F24_003F9e991285_003FExceptionDispatchInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

View File

@ -4,7 +4,6 @@
xmlns:local="using:Policlinica" xmlns:local="using:Policlinica"
RequestedThemeVariant="Default"> RequestedThemeVariant="Default">
<Application.DataTemplates> <Application.DataTemplates>
<local:ViewLocator/> <local:ViewLocator/>
</Application.DataTemplates> </Application.DataTemplates>

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using MySqlConnector; using MySqlConnector;
@ -49,4 +49,26 @@ public class RecordItemsRepository : BaseRep
return result; return result;
} }
public bool InsertRecordItem(RecordItem recordItem)
{
string sql = @"insert into `record_items` (record_id, service_id, service_price)
values (@record_id, @service_id, @service_price)";
try
{
using (var mc = new MySqlCommand(sql, connection))
{
mc.Parameters.AddWithValue("@record_id", recordItem.RecordId);
mc.Parameters.AddWithValue("@service_id", recordItem.ServiceId);
mc.Parameters.AddWithValue("@service_price", recordItem.ServicePrice);
mc.ExecuteNonQuery();
}
return true;
}
catch (Exception e)
{
Console.WriteLine(e);
}
return false;
}
} }

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using MySqlConnector; using MySqlConnector;
@ -57,6 +57,66 @@ public class RecordRep:BaseRep
} }
return recordsList; return recordsList;
} }
public int InsertRecord(Record record)
{
string insertSql = @"insert into `records` (client_name, client_surname, doctor_id, user_id, service_id, total_amount, record_date)
values (@client_name, @client_surname, @doctor_id, @user_id, @service_id, @total_amount, @record_date)";
try
{
using (var mc = new MySqlCommand(insertSql, connection))
{
mc.Parameters.AddWithValue("@client_name", record.ClientName ?? "");
mc.Parameters.AddWithValue("@client_surname", record.ClientSurname ?? "");
mc.Parameters.AddWithValue("@doctor_id", record.DoctorId);
mc.Parameters.AddWithValue("@user_id", record.UserId);
mc.Parameters.AddWithValue("@service_id", record.ServiceId);
mc.Parameters.AddWithValue("@total_amount", record.TotalAmount);
mc.Parameters.AddWithValue("@record_date", record.RecordDate);
int result = mc.ExecuteNonQuery();
Console.WriteLine($"ExecuteNonQuery returned: {result}");
}
// Получаем ID последней вставленной записи
string lastIdSql = "SELECT LAST_INSERT_ID() as last_id";
using (var mc = new MySqlCommand(lastIdSql, connection))
{
object result = mc.ExecuteScalar();
Console.WriteLine($"ExecuteScalar result type: {result?.GetType()}, value: {result}");
if (result != null)
{
if (result is long longId)
{
Console.WriteLine($"Got long ID: {longId}");
return (int)longId;
}
else if (result is int intId)
{
Console.WriteLine($"Got int ID: {intId}");
return intId;
}
else if (long.TryParse(result.ToString(), out long parsedId))
{
Console.WriteLine($"Parsed long ID: {parsedId}");
return (int)parsedId;
}
}
else
{
Console.WriteLine("ExecuteScalar returned null");
}
}
}
catch (Exception e)
{
Console.WriteLine($"Error in InsertRecord: {e.Message}");
Console.WriteLine($"Stack trace: {e.StackTrace}");
}
return -1;
}
public bool Delete(int id) public bool Delete(int id)
{ {
string sql = @"delete from `records` where `id` = @id"; string sql = @"delete from `records` where `id` = @id";

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -88,6 +88,7 @@ public class UserRepository:BaseRep
Id = reader.GetInt32("id"), Id = reader.GetInt32("id"),
Name = reader.GetString("name"), Name = reader.GetString("name"),
Password = reader.GetString("password"), Password = reader.GetString("password"),
Login = reader.GetString("name")
}); });
} }
} }

View File

@ -1,4 +1,4 @@
namespace Policlinica.DB; namespace Policlinica.DB;
public class User public class User
{ {
@ -6,6 +6,8 @@ public class User
public string Name { get; set; } public string Name { get; set; }
public string Surname { get; set; }
public string Password {get; set;} public string Password {get; set;}
public string Login { get; set; } public string Login { get; set; }

View File

@ -1,10 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk"> <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net9.0</TargetFramework> <TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<SelfContained>true</SelfContained>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -17,7 +19,6 @@
<PackageReference Include="Avalonia.Desktop" Version="11.3.11"/> <PackageReference Include="Avalonia.Desktop" Version="11.3.11"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.11"/> <PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.11"/>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.11"/> <PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.11"/>
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.11"> <PackageReference Include="Avalonia.Diagnostics" Version="11.3.11">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets> <IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
@ -35,15 +35,19 @@ public partial class AutorizationViewModel : ViewModelBase
SpUser = repository.CheckLoginAndPassword(Login, Password); SpUser = repository.CheckLoginAndPassword(Login, Password);
} }
_user.Password = Password;
_user.Login = Login;
if (SpUser.Count == 0) if (SpUser.Count == 0)
{ {
Eror = "Неверный логин или пароль"; Eror = "Неверный логин или пароль";
return; return;
} }
// Копируем все данные авторизованного пользователя в синглтон
_user.Id = SpUser[0].Id;
_user.Name = SpUser[0].Name;
_user.Surname = SpUser[0].Surname;
_user.Login = SpUser[0].Login;
_user.Password = SpUser[0].Password;
CurrentUser.login = SpUser[0].Name; CurrentUser.login = SpUser[0].Name;
var vm = ActivatorUtilities.CreateInstance<AdminViewModel>(_provider); var vm = ActivatorUtilities.CreateInstance<AdminViewModel>(_provider);

View File

@ -32,13 +32,15 @@ public partial class DoctorViewModel : ViewModelBase
public void StartTest() public void StartTest()
{ {
if (Name == null) if (Name == null || Name.Trim() == "")
return; return;
if (Surname == null) if (Surname == null || Surname.Trim() == "")
return; return;
if (SelectedDoctor == null) if (SelectedDoctor == null)
return; return;
var vm = ActivatorUtilities.CreateInstance<ServiceViewModel>(_provider, SelectedDoctor);
var repository = _provider.GetRequiredService<ServiceRepository>();
var vm = ActivatorUtilities.CreateInstance<ServiceViewModel>(_provider, SelectedDoctor, repository, Name, Surname);
_navigation.Navigate(vm); _navigation.Navigate(vm);
} }

View File

@ -1,68 +1,135 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input; using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Policlinica.DB; using Policlinica.DB;
/*
namespace Policlinica.ViewModels; namespace Policlinica.ViewModels;
public partial class RecordItemsViewModel : ViewModelBase public partial class RecordItemsViewModel : ViewModelBase
{ {
private readonly IServiceProvider _provider; private readonly IServiceProvider _provider;
private readonly Navigation _navigation; private readonly Navigation _navigation;
private readonly RecordRep _recordRepository;
private readonly RecordItemsRepository _recordItemsRepository;
[ObservableProperty] List<Service> _services; [ObservableProperty] ObservableCollection<Service> selectedServices;
[ObservableProperty] Service _selectedService; [ObservableProperty] Doctor selectedDoctor;
private RecordItemsRepository _repository; [ObservableProperty] DateTime recordDate;
[ObservableProperty] decimal totalAmount;
[ObservableProperty] User currentUser;
[ObservableProperty] string statusMessage;
[ObservableProperty] string clientName;
[ObservableProperty] string clientSurname;
public RecordItemsViewModel(IServiceProvider provider, Navigation navigation, Doctor doctor,
List<Service> services, RecordRep recordRepository, RecordItemsRepository recordItemsRepository,
string name = "", string surname = "")
public RecordItemsViewModel(IServiceProvider provider, Service selectedService, List<Service> services, RecordItemsRepository repository)
{ {
_provider = provider; _provider = provider;
_services = services; _navigation = navigation;
_selectedService = selectedService; _recordRepository = recordRepository;
_repository = repository; _recordItemsRepository = recordItemsRepository;
selectedDoctor = doctor;
selectedServices = new ObservableCollection<Service>(services);
recordDate = DateTime.Now;
currentUser = _provider.GetRequiredService<User>();
clientName = name;
clientSurname = surname;
// Расчет общей суммы
totalAmount = selectedServices.Sum(s => s.Price);
} }
[RelayCommand] [RelayCommand]
public void SaveDB() public void SaveToDatabase()
{ {
if (selectedDoctor == null || selectedServices.Count == 0)
_repository.GetRecordItemsByTest(Records, Services); {
if (SelectedDoctor == null) StatusMessage = "Ошибка: не все данные заполнены";
return; return;
}
if (string.IsNullOrWhiteSpace(clientName) || string.IsNullOrWhiteSpace(clientSurname))
{
StatusMessage = "Ошибка: не заполнены имя и фамилия клиента";
return;
}
try
{
// Используем первую услугу
int mainServiceId = selectedServices[0].Id;
Console.WriteLine($"Main service ID: {mainServiceId}");
Console.WriteLine($"Selected services count: {selectedServices.Count}");
// Создаем запись с данными КЛИЕНТА
var record = new Record
{
ClientName = clientName,
ClientSurname = clientSurname,
DoctorId = selectedDoctor.Id,
UserId = currentUser.Id,
ServiceId = mainServiceId,
TotalAmount = totalAmount,
RecordDate = recordDate
};
Console.WriteLine($"Saving record: Name={record.ClientName}, Surname={record.ClientSurname}, DoctorId={record.DoctorId}, UserId={record.UserId}, ServiceId={record.ServiceId}");
// Сохраняем запись в БД и получаем ID
int recordId = _recordRepository.InsertRecord(record);
if (recordId <= 0)
{
StatusMessage = "Ошибка при сохранении записи";
Console.WriteLine($"Failed to insert record. Returned ID: {recordId}");
return;
}
Console.WriteLine($"Record saved with ID: {recordId}");
// Сохраняем все выбранные услуги в record_items
foreach (var service in selectedServices)
{
Console.WriteLine($"Saving record item for service: {service.Id} (price: {service.Price})");
var recordItem = new RecordItem
{
ServiceId = service.Id,
RecordId = recordId,
ServicePrice = service.Price
};
bool itemSaved = _recordItemsRepository.InsertRecordItem(recordItem);
if (!itemSaved)
{
Console.WriteLine($"Failed to insert record item for service {service.Id}");
}
}
StatusMessage = "Запись успешно сохранена!";
// Переходим в админ-панель
var vm = ActivatorUtilities.CreateInstance<AdminViewModel>(_provider); var vm = ActivatorUtilities.CreateInstance<AdminViewModel>(_provider);
_navigation.Navigate(vm); _navigation.Navigate(vm);
}
catch (Exception ex)
{
StatusMessage = $"Ошибка: {ex.Message}";
Console.WriteLine($"Exception: {ex}");
}
} }
[RelayCommand] [RelayCommand]
public void Start() public void Cancel()
{ {
if (SelectedService == null) var repository = _provider.GetRequiredService<ServiceRepository>();
return; var vm = ActivatorUtilities.CreateInstance<ServiceViewModel>(_provider, selectedDoctor, repository, clientName, clientSurname);
var vm = _serviceProvider.GetRequiredService<MainWindowViewModel>(); _navigation.Navigate(vm);
var win = _serviceProvider.GetRequiredService<MainWindow>();
vm.SetClose(win.Close);
win.DataContext = vm;
win.Show();
close();
}
private Action close;
public void SetClose(Action close)
{
this.close = close;
} }
} }
*/

View File

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
@ -25,12 +25,14 @@ public partial class ServiceViewModel : ViewModelBase
[ObservableProperty] Doctor _selectedDoctor; [ObservableProperty] Doctor _selectedDoctor;
public ServiceViewModel(IServiceProvider provider, Navigation navigation, Doctor selectedDoctor, public ServiceViewModel(IServiceProvider provider, Navigation navigation, Doctor selectedDoctor,
ServiceRepository repository) ServiceRepository repository, string clientName = "", string clientSurname = "")
{ {
_provider = provider; _provider = provider;
_navigation = navigation; _navigation = navigation;
_selectedDoctor = selectedDoctor; _selectedDoctor = selectedDoctor;
_serviceRepository = repository; _serviceRepository = repository;
name = clientName;
surname = clientSurname;
Services = new ObservableCollection<ServiceSelected>(repository.GetServicesByDoctors(selectedDoctor.Id).Select(service => new ServiceSelected(service)).ToList()); Services = new ObservableCollection<ServiceSelected>(repository.GetServicesByDoctors(selectedDoctor.Id).Select(service => new ServiceSelected(service)).ToList());
//Console.WriteLine(CurrentUser.login); //Console.WriteLine(CurrentUser.login);
@ -38,25 +40,32 @@ public partial class ServiceViewModel : ViewModelBase
[RelayCommand] [RelayCommand]
public void Dobavlenie() public void Dobavlenie()
{ {
{ List<Service> selectedServices = new List<Service>();
List<Service> services = new List<Service>();
foreach (ServiceSelected s in Services) foreach (ServiceSelected s in Services)
{ {
if (s.IsSelected == true) if (s.IsSelected == true)
{ {
services.Add(s.Service); selectedServices.Add(s.Service);
} }
} }
var vm = ActivatorUtilities.CreateInstance<ServiceViewModel>(_provider, SelectedDoctor); if (selectedServices.Count == 0)
{
// Можно добавить уведомление об ошибке
return;
}
// Получаем репозитории для передачи в ViewModel
var recordRepository = _provider.GetRequiredService<RecordRep>();
var recordItemsRepository = _provider.GetRequiredService<RecordItemsRepository>();
// Создаем ViewModel для показа подтверждения записи
var vm = ActivatorUtilities.CreateInstance<RecordItemsViewModel>(_provider,
_navigation, _selectedDoctor, selectedServices, recordRepository, recordItemsRepository, Name, Surname);
_navigation.Navigate(vm); _navigation.Navigate(vm);
}
}
} }
}

View File

@ -1,8 +1,69 @@
<UserControl xmlns="https://github.com/avaloniaui" <UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" xmlns:viewModels="clr-namespace:Policlinica.ViewModels"
x:Class="Policlinica.Views.RecordItemsView"> mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="600"
x:Class="Policlinica.Views.RecordItemsView"
x:DataType="viewModels:RecordItemsViewModel">
<StackPanel Margin="20" Spacing="15">
<!-- Заголовок -->
<TextBlock Text="Подтверждение записи" FontSize="24" FontWeight="Bold" HorizontalAlignment="Center"/>
<!-- Информация о клиенте -->
<Border BorderBrush="LightGray" BorderThickness="1" Padding="15" CornerRadius="5">
<StackPanel Spacing="10">
<TextBlock FontWeight="Bold" FontSize="16">Клиент:</TextBlock>
<TextBlock Text="{Binding ClientName}" FontSize="14"/>
<TextBlock Text="{Binding ClientSurname}" FontSize="14"/>
</StackPanel>
</Border>
<!-- Информация о враче -->
<Border BorderBrush="LightGray" BorderThickness="1" Padding="15" CornerRadius="5">
<StackPanel Spacing="10">
<TextBlock FontWeight="Bold" FontSize="16">Врач:</TextBlock>
<TextBlock Text="{Binding SelectedDoctor.Title}" FontSize="14"/>
</StackPanel>
</Border>
<!-- Выбранные услуги -->
<Border BorderBrush="LightGray" BorderThickness="1" Padding="15" CornerRadius="5">
<StackPanel Spacing="10">
<TextBlock FontWeight="Bold" FontSize="16">Выбранные услуги:</TextBlock>
<ListBox ItemsSource="{Binding SelectedServices}" Height="150">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Spacing="20">
<TextBlock Text="{Binding ServiceName}" Width="200"/>
<TextBlock Text="{Binding Price}" Width="100"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</Border>
<!-- Итоговая сумма -->
<Border BorderBrush="LightBlue" BorderThickness="2" Padding="15" CornerRadius="5" Background="#F0F8FF">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="30">
<TextBlock Text="Итого:" FontWeight="Bold" FontSize="16" VerticalAlignment="Center"/>
<TextBlock Text="{Binding TotalAmount}" FontSize="18" FontWeight="Bold" Foreground="Blue"/>
</StackPanel>
</Border>
<!-- Сообщение статуса -->
<TextBlock Text="{Binding StatusMessage}" Foreground="Green" FontSize="14" TextWrapping="Wrap"/>
<!-- Кнопки -->
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Spacing="20" Margin="0,20,0,0">
<Button Content="Сохранить запись" FontSize="16" Padding="20,10" Background="Green" Foreground="White"
Command="{Binding SaveToDatabaseCommand}"/>
<Button Content="Вернуться" FontSize="16" Padding="20,10" Background="Gray" Foreground="White"
Command="{Binding CancelCommand}"/>
</StackPanel>
</StackPanel>
</UserControl> </UserControl>

View File

@ -5,5 +5,4 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Policlinica.Views.Records" x:Class="Policlinica.Views.Records"
Title="Record"> Title="Record">
Welcome to Avalonia!
</Window> </Window>

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "net9.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
"configProperties": {
"MVVMTOOLKIT_ENABLE_INOTIFYPROPERTYCHANGING_SUPPORT": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

View File

@ -1,6 +0,0 @@
{
"DataBaseConnection":
{
"ConnectionString" : "server=217.150.77.216;port=24831;userid=student;password=student;database=Policlinic"
}
}

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