Удаление
parent
85939c0b5c
commit
d64a300cef
|
|
@ -43,6 +43,8 @@ public class RecordRep:BaseRep
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
@ -50,4 +52,25 @@ public class RecordRep:BaseRep
|
||||||
}
|
}
|
||||||
return recordsList;
|
return recordsList;
|
||||||
}
|
}
|
||||||
|
public bool Delete(int id)
|
||||||
|
{
|
||||||
|
string sql = @"delete from `records` where `id` = @id";
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var mc = new MySqlCommand(sql, connection))
|
||||||
|
{
|
||||||
|
mc.Parameters.AddWithValue("@id",id);
|
||||||
|
mc.ExecuteNonQuery();
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Console.WriteLine(e);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +50,6 @@ sealed class Program
|
||||||
|
|
||||||
s.AddTransient<Records>();
|
s.AddTransient<Records>();
|
||||||
s.AddTransient<RecordViewModel>();
|
s.AddTransient<RecordViewModel>();
|
||||||
s.AddTransient<InfoViewModel>();
|
|
||||||
}).
|
}).
|
||||||
Build();
|
Build();
|
||||||
BuildAvaloniaApp(host.Services)
|
BuildAvaloniaApp(host.Services)
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ using Microsoft.Extensions.DependencyInjection;
|
||||||
using Policlinica.DB;
|
using Policlinica.DB;
|
||||||
using Policlinica.Views;
|
using Policlinica.Views;
|
||||||
|
|
||||||
|
|
||||||
namespace Policlinica.ViewModels;
|
namespace Policlinica.ViewModels;
|
||||||
|
|
||||||
public partial class AdminWindowViewModel : ViewModelBase
|
public partial class AdminWindowViewModel : ViewModelBase
|
||||||
|
|
@ -30,5 +31,11 @@ public partial class AdminWindowViewModel : ViewModelBase
|
||||||
|
|
||||||
RecordsList = new ObservableCollection<Record>(recordRep.GetRecord());
|
RecordsList = new ObservableCollection<Record>(recordRep.GetRecord());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[RelayCommand]
|
||||||
|
void DeleteRecord()
|
||||||
|
{
|
||||||
|
_recordRep.Delete(SelectedRecord.Id);
|
||||||
|
RecordsList = new ObservableCollection<Record>(_recordRep.GetRecord());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
using System;
|
|
||||||
using CommunityToolkit.Mvvm.ComponentModel;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace Policlinica.ViewModels;
|
|
||||||
|
|
||||||
public partial class InfoViewModel : ViewModelBase
|
|
||||||
|
|
||||||
{
|
|
||||||
private readonly Navigation _navigation1;
|
|
||||||
[ObservableProperty] private ViewModelBase _currentPage1;
|
|
||||||
|
|
||||||
public InfoViewModel(IServiceProvider sv1, Navigation navigation1)
|
|
||||||
{
|
|
||||||
_navigation1 = navigation1;
|
|
||||||
//_navigation1.SetCurrentView(this);
|
|
||||||
_navigation1.Navigate(sv1.GetRequiredService<AdminWindowViewModel>());
|
|
||||||
}
|
|
||||||
|
|
||||||
Action closeAction;
|
|
||||||
|
|
||||||
public void SetClose(Action closeAction)
|
|
||||||
{
|
|
||||||
this.closeAction = closeAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Close()
|
|
||||||
{
|
|
||||||
this.closeAction?.Invoke();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -10,4 +10,5 @@ public partial class RecordViewModel:ViewModelBase
|
||||||
{
|
{
|
||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
<Grid RowDefinitions="Auto,*,Auto" Margin="20">
|
<Grid RowDefinitions="Auto,*,Auto" Margin="20">
|
||||||
<DataGrid ItemsSource="{Binding RecordsList }" SelectedItem="{Binding SelectedRecord }">
|
<DataGrid ItemsSource="{Binding RecordsList }" SelectedItem="{Binding SelectedRecord }">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
|
<DataGridCheckBoxColumn IsVisible="True"/>
|
||||||
|
<!--><DataGridCheckBoxColumn/><!-->
|
||||||
<DataGridTextColumn Binding="{Binding ClientName}" Header="Имя клиента"/>
|
<DataGridTextColumn Binding="{Binding ClientName}" Header="Имя клиента"/>
|
||||||
<DataGridTextColumn Binding="{Binding ClientSurname}" Header="Фамилия клиента"/>
|
<DataGridTextColumn Binding="{Binding ClientSurname}" Header="Фамилия клиента"/>
|
||||||
<DataGridTextColumn Binding="{Binding Title}" Header="Врач"/>
|
<DataGridTextColumn Binding="{Binding Title}" Header="Врач"/>
|
||||||
|
|
@ -20,8 +22,8 @@
|
||||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||||
|
|
||||||
|
|
||||||
<Button Content="Удалить выбранную работу" FontSize="20" HorizontalAlignment="Center" Command="{Binding }"/>
|
<Button Content="Удалить выбранную работу" FontSize="20" HorizontalAlignment="Center" Command="{Binding DeleteRecordCommand}"/>
|
||||||
<Button Content="Дабавить запись" FontSize="20" HorizontalAlignment="Center" Command="{Binding }"/>
|
<Button Content="Добавить запись" FontSize="20" HorizontalAlignment="Center" Command="{Binding }"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<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"
|
|
||||||
xmlns:viewModels="clr-namespace:Policlinica.ViewModels"
|
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
||||||
x:Class="Policlinica.Views.InfoWindow"
|
|
||||||
x:DataType="viewModels:InfoViewModel"
|
|
||||||
Title="InfoWindow">
|
|
||||||
<ContentControl Content="{Binding CurrentPage1}"/>
|
|
||||||
</Window>
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
using Avalonia;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Markup.Xaml;
|
|
||||||
|
|
||||||
namespace Policlinica.Views;
|
|
||||||
|
|
||||||
public partial class InfoWindow : Window
|
|
||||||
{
|
|
||||||
public InfoWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
3dafe9e286f4348bb3be1f1a828cb1f3bb8a8315b24cc6601634892b3c1b2bf7
|
42f46587e074d14fa4a0984c7c2e3fc4c254cb27449b5871bd3d13cc463ff9c1
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -13,7 +13,7 @@ using System.Reflection;
|
||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Policlinica")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("Policlinica")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a0fa5b4e011e907f888c1bd90b1aca01c04496a5")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+85939c0b5c573767a3338c4ce92fddef096efbb7")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("Policlinica")]
|
[assembly: System.Reflection.AssemblyProductAttribute("Policlinica")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("Policlinica")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("Policlinica")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
998d766077978e34f9194d23b03f2860aaba54cabf89a38215c9c95a2297c5bd
|
696a3eb6be9c620cb975cedba6cdc15660992fe7db0c7103404aa03ebcf91b12
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,6 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
[C:/Users/artem/RiderProjects/Policlinica1/Policlinica/Views/AutorizationView.axaml]
|
[C:/Users/artem/RiderProjects/Policlinica1/Policlinica/Views/AutorizationView.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
[C:/Users/artem/RiderProjects/Policlinica1/Policlinica/Views/InfoWindow.axaml]
|
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
|
||||||
|
|
||||||
[C:/Users/artem/RiderProjects/Policlinica1/Policlinica/Views/Records.axaml]
|
[C:/Users/artem/RiderProjects/Policlinica1/Policlinica/Views/Records.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
af4c3fa3825f572321315f3fee4fa0e01dd9cf99efdc846ee253227b32f7daa9
|
5fb5a258e691fcc4f39ccb83ad69d9066bef4d4adfd7b02e613ab2da216611b4
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
{"documents":{"C:\\Users\\artem\\RiderProjects\\Policlinica1\\*":"https://raw.githubusercontent.com/Dezkriminant/Policlinica/a0fa5b4e011e907f888c1bd90b1aca01c04496a5/*"}}
|
{"documents":{"C:\\Users\\artem\\RiderProjects\\Policlinica1\\*":"https://raw.githubusercontent.com/Dezkriminant/Policlinica/85939c0b5c573767a3338c4ce92fddef096efbb7/*"}}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue