Виктор Александрович
parent
e89906e6e8
commit
db9efc98b9
|
|
@ -8,6 +8,7 @@
|
|||
<entry key="Policlinica/Views/AdminWindow.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/DoctorView.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/PasswordWindow.axaml" value="Policlinica/Policlinica.csproj" />
|
||||
|
|
|
|||
|
|
@ -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">
|
||||
<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_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>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
x:Class="Policlinica.App"
|
||||
xmlns:local="using:Policlinica"
|
||||
RequestedThemeVariant="Default">
|
||||
|
||||
|
||||
<Application.DataTemplates>
|
||||
<local:ViewLocator/>
|
||||
|
|
@ -13,4 +12,4 @@
|
|||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
</Application>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MySqlConnector;
|
||||
|
|
@ -49,4 +49,26 @@ public class RecordItemsRepository : BaseRep
|
|||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Extensions.Options;
|
||||
using MySqlConnector;
|
||||
|
|
@ -57,6 +57,66 @@ public class RecordRep:BaseRep
|
|||
}
|
||||
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)
|
||||
{
|
||||
string sql = @"delete from `records` where `id` = @id";
|
||||
|
|
@ -78,4 +138,4 @@ public class RecordRep:BaseRep
|
|||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -88,6 +88,7 @@ public class UserRepository:BaseRep
|
|||
Id = reader.GetInt32("id"),
|
||||
Name = reader.GetString("name"),
|
||||
Password = reader.GetString("password"),
|
||||
Login = reader.GetString("name")
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -172,4 +173,4 @@ public class UserRepository:BaseRep
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace Policlinica.DB;
|
||||
namespace Policlinica.DB;
|
||||
|
||||
public class User
|
||||
{
|
||||
|
|
@ -6,7 +6,9 @@ public class User
|
|||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Surname { get; set; }
|
||||
|
||||
public string Password {get; set;}
|
||||
|
||||
public string Login { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
<SelfContained>true</SelfContained>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -17,7 +19,6 @@
|
|||
<PackageReference Include="Avalonia.Desktop" Version="11.3.11"/>
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" 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">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
|
|
@ -35,15 +35,19 @@ public partial class AutorizationViewModel : ViewModelBase
|
|||
SpUser = repository.CheckLoginAndPassword(Login, Password);
|
||||
}
|
||||
|
||||
_user.Password = Password;
|
||||
_user.Login = Login;
|
||||
|
||||
if (SpUser.Count == 0)
|
||||
{
|
||||
Eror = "Неверный логин или пароль";
|
||||
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;
|
||||
|
||||
var vm = ActivatorUtilities.CreateInstance<AdminViewModel>(_provider);
|
||||
|
|
@ -58,4 +62,4 @@ public partial class AutorizationViewModel : ViewModelBase
|
|||
_navigation.Navigate(vm);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,14 +32,16 @@ public partial class DoctorViewModel : ViewModelBase
|
|||
public void StartTest()
|
||||
{
|
||||
|
||||
if (Name == null)
|
||||
if (Name == null || Name.Trim() == "")
|
||||
return;
|
||||
if (Surname == null || Surname.Trim() == "")
|
||||
return;
|
||||
if (Surname == null)
|
||||
return;
|
||||
if (SelectedDoctor == null)
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,68 +1,135 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Policlinica.DB;
|
||||
/*
|
||||
|
||||
namespace Policlinica.ViewModels;
|
||||
|
||||
public partial class RecordItemsViewModel : ViewModelBase
|
||||
{
|
||||
|
||||
private readonly IServiceProvider _provider;
|
||||
private readonly Navigation _navigation;
|
||||
|
||||
[ObservableProperty] List<Service> _services;
|
||||
[ObservableProperty] Service _selectedService;
|
||||
private RecordItemsRepository _repository;
|
||||
private readonly RecordRep _recordRepository;
|
||||
private readonly RecordItemsRepository _recordItemsRepository;
|
||||
|
||||
[ObservableProperty] ObservableCollection<Service> selectedServices;
|
||||
[ObservableProperty] Doctor selectedDoctor;
|
||||
[ObservableProperty] DateTime recordDate;
|
||||
[ObservableProperty] decimal totalAmount;
|
||||
[ObservableProperty] User currentUser;
|
||||
[ObservableProperty] string statusMessage;
|
||||
[ObservableProperty] string clientName;
|
||||
[ObservableProperty] string clientSurname;
|
||||
|
||||
|
||||
|
||||
public RecordItemsViewModel(IServiceProvider provider, Service selectedService, List<Service> services, RecordItemsRepository repository)
|
||||
public RecordItemsViewModel(IServiceProvider provider, Navigation navigation, Doctor doctor,
|
||||
List<Service> services, RecordRep recordRepository, RecordItemsRepository recordItemsRepository,
|
||||
string name = "", string surname = "")
|
||||
{
|
||||
_provider = provider;
|
||||
_services = services;
|
||||
_selectedService = selectedService;
|
||||
_repository = repository;
|
||||
_navigation = navigation;
|
||||
_recordRepository = recordRepository;
|
||||
_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]
|
||||
public void SaveDB()
|
||||
public void SaveToDatabase()
|
||||
{
|
||||
|
||||
_repository.GetRecordItemsByTest(Records, Services);
|
||||
if (SelectedDoctor == null)
|
||||
if (selectedDoctor == null || selectedServices.Count == 0)
|
||||
{
|
||||
StatusMessage = "Ошибка: не все данные заполнены";
|
||||
return;
|
||||
var vm = ActivatorUtilities.CreateInstance<AdminViewModel>(_provider);
|
||||
_navigation.Navigate(vm);
|
||||
|
||||
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void Start()
|
||||
{
|
||||
if (SelectedService == null)
|
||||
return;
|
||||
var vm = _serviceProvider.GetRequiredService<MainWindowViewModel>();
|
||||
var win = _serviceProvider.GetRequiredService<MainWindow>();
|
||||
|
||||
vm.SetClose(win.Close);
|
||||
win.DataContext = vm;
|
||||
win.Show();
|
||||
close();
|
||||
}
|
||||
private Action close;
|
||||
}
|
||||
|
||||
public void SetClose(Action close)
|
||||
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);
|
||||
_navigation.Navigate(vm);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
StatusMessage = $"Ошибка: {ex.Message}";
|
||||
Console.WriteLine($"Exception: {ex}");
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void Cancel()
|
||||
{
|
||||
this.close = close;
|
||||
var repository = _provider.GetRequiredService<ServiceRepository>();
|
||||
var vm = ActivatorUtilities.CreateInstance<ServiceViewModel>(_provider, selectedDoctor, repository, clientName, clientSurname);
|
||||
_navigation.Navigate(vm);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
|
|
@ -20,17 +20,19 @@ public partial class ServiceViewModel : ViewModelBase
|
|||
|
||||
[ObservableProperty] string surname;
|
||||
[ObservableProperty] string name;
|
||||
[ObservableProperty] ObservableCollection<ServiceSelected> _services;
|
||||
[ObservableProperty] ObservableCollection<ServiceSelected> _services;
|
||||
[ObservableProperty] string _login;
|
||||
[ObservableProperty] Doctor _selectedDoctor;
|
||||
|
||||
public ServiceViewModel(IServiceProvider provider, Navigation navigation, Doctor selectedDoctor,
|
||||
ServiceRepository repository)
|
||||
ServiceRepository repository, string clientName = "", string clientSurname = "")
|
||||
{
|
||||
_provider = provider;
|
||||
_navigation = navigation;
|
||||
_selectedDoctor = selectedDoctor;
|
||||
_serviceRepository = repository;
|
||||
name = clientName;
|
||||
surname = clientSurname;
|
||||
Services = new ObservableCollection<ServiceSelected>(repository.GetServicesByDoctors(selectedDoctor.Id).Select(service => new ServiceSelected(service)).ToList());
|
||||
|
||||
//Console.WriteLine(CurrentUser.login);
|
||||
|
|
@ -38,25 +40,32 @@ public partial class ServiceViewModel : ViewModelBase
|
|||
|
||||
|
||||
[RelayCommand]
|
||||
|
||||
public void Dobavlenie()
|
||||
{
|
||||
List<Service> selectedServices = new List<Service>();
|
||||
|
||||
foreach (ServiceSelected s in Services)
|
||||
{
|
||||
List<Service> services = new List<Service>();
|
||||
|
||||
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);
|
||||
_navigation.Navigate(vm);
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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: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="Policlinica.Views.RecordItemsView">
|
||||
|
||||
xmlns:viewModels="clr-namespace:Policlinica.ViewModels"
|
||||
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>
|
||||
|
|
|
|||
|
|
@ -5,5 +5,4 @@
|
|||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Policlinica.Views.Records"
|
||||
Title="Record">
|
||||
Welcome to Avalonia!
|
||||
</Window>
|
||||
|
|
|
|||
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.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"DataBaseConnection":
|
||||
{
|
||||
"ConnectionString" : "server=217.150.77.216;port=24831;userid=student;password=student;database=Policlinic"
|
||||
}
|
||||
}
|
||||
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
Loading…
Reference in New Issue