first commit
This commit is contained in:
commit
e5d1f72e7d
BIN
.vs/AvaloniaAppApplication/DesignTimeBuild/.dtbcache.v2
Normal file
BIN
.vs/AvaloniaAppApplication/DesignTimeBuild/.dtbcache.v2
Normal file
Binary file not shown.
Binary file not shown.
BIN
.vs/AvaloniaAppApplication/v17/.futdcache.v2
Normal file
BIN
.vs/AvaloniaAppApplication/v17/.futdcache.v2
Normal file
Binary file not shown.
BIN
.vs/AvaloniaAppApplication/v17/.suo
Normal file
BIN
.vs/AvaloniaAppApplication/v17/.suo
Normal file
Binary file not shown.
97
.vs/AvaloniaAppApplication/v17/DocumentLayout.backup.json
Normal file
97
.vs/AvaloniaAppApplication/v17/DocumentLayout.backup.json
Normal file
@ -0,0 +1,97 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|c:\\users\\jauli\\desktop\\avaloniaappapplication\\avaloniaappapplication\\dto\\servicedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|solutionrelative:avaloniaappapplication\\dto\\servicedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|c:\\users\\jauli\\desktop\\avaloniaappapplication\\avaloniaappapplication\\models\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|solutionrelative:avaloniaappapplication\\models\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|c:\\users\\jauli\\desktop\\avaloniaappapplication\\avaloniaappapplication\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|solutionrelative:avaloniaappapplication\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 2,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "ServiceDTO.cs",
|
||||
"DocumentMoniker": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"RelativeDocumentMoniker": "AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"ToolTip": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"RelativeToolTip": "AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"ViewState": "AgIAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-05-15T08:08:39.169Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "Service.cs",
|
||||
"DocumentMoniker": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"RelativeDocumentMoniker": "AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"ToolTip": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"RelativeToolTip": "AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"ViewState": "AgIAAAsAAAAAAAAAAAA3wAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-05-15T08:08:05.349Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "MainWindow.axaml.cs",
|
||||
"DocumentMoniker": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"RelativeDocumentMoniker": "AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"ToolTip": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"RelativeToolTip": "AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"ViewState": "AgIAADkAAAAAAAAAAAAYwAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-05-15T08:05:40.137Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DockedWidth": 73,
|
||||
"SelectedChildIndex": -1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:1:0:{d212f56b-c48a-434c-a121-1c5d80b59b9f}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
97
.vs/AvaloniaAppApplication/v17/DocumentLayout.json
Normal file
97
.vs/AvaloniaAppApplication/v17/DocumentLayout.json
Normal file
@ -0,0 +1,97 @@
|
||||
{
|
||||
"Version": 1,
|
||||
"WorkspaceRootPath": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\",
|
||||
"Documents": [
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|c:\\users\\jauli\\desktop\\avaloniaappapplication\\avaloniaappapplication\\dto\\servicedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|solutionrelative:avaloniaappapplication\\dto\\servicedto.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|c:\\users\\jauli\\desktop\\avaloniaappapplication\\avaloniaappapplication\\models\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|solutionrelative:avaloniaappapplication\\models\\service.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
},
|
||||
{
|
||||
"AbsoluteMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|c:\\users\\jauli\\desktop\\avaloniaappapplication\\avaloniaappapplication\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
|
||||
"RelativeMoniker": "D:0:0:{8D422B75-EA6B-4567-A2B3-34A14929F3D1}|AvaloniaAppApplication\\AvaloniaAppApplication.csproj|solutionrelative:avaloniaappapplication\\mainwindow.axaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
|
||||
}
|
||||
],
|
||||
"DocumentGroupContainers": [
|
||||
{
|
||||
"Orientation": 0,
|
||||
"VerticalTabListWidth": 256,
|
||||
"DocumentGroups": [
|
||||
{
|
||||
"DockedWidth": 200,
|
||||
"SelectedChildIndex": 2,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 0,
|
||||
"Title": "ServiceDTO.cs",
|
||||
"DocumentMoniker": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"RelativeDocumentMoniker": "AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"ToolTip": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"RelativeToolTip": "AvaloniaAppApplication\\DTO\\ServiceDTO.cs",
|
||||
"ViewState": "AgIAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-05-15T08:08:39.169Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 1,
|
||||
"Title": "Service.cs",
|
||||
"DocumentMoniker": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"RelativeDocumentMoniker": "AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"ToolTip": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"RelativeToolTip": "AvaloniaAppApplication\\Models\\Service.cs",
|
||||
"ViewState": "AgIAAAsAAAAAAAAAAAA3wAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-05-15T08:08:05.349Z",
|
||||
"EditorCaption": ""
|
||||
},
|
||||
{
|
||||
"$type": "Document",
|
||||
"DocumentIndex": 2,
|
||||
"Title": "MainWindow.axaml.cs",
|
||||
"DocumentMoniker": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"RelativeDocumentMoniker": "AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"ToolTip": "C:\\Users\\jauli\\Desktop\\AvaloniaAppApplication\\AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"RelativeToolTip": "AvaloniaAppApplication\\MainWindow.axaml.cs",
|
||||
"ViewState": "AgIAADkAAAAAAAAAAAAYwAAAAAAAAAAAAAAAAA==",
|
||||
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
|
||||
"WhenOpened": "2025-05-15T08:05:40.137Z",
|
||||
"EditorCaption": ""
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"DockedWidth": 73,
|
||||
"SelectedChildIndex": -1,
|
||||
"Children": [
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:1:0:{d212f56b-c48a-434c-a121-1c5d80b59b9f}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{d78612c7-9962-4b83-95d9-268046dad23a}"
|
||||
},
|
||||
{
|
||||
"$type": "Bookmark",
|
||||
"Name": "ST:0:0:{34e76e81-ee4a-11d0-ae2e-00a0c90fffc3}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
BIN
.vs/ProjectEvaluation/avaloniaappapplication.metadata.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/avaloniaappapplication.metadata.v9.bin
Normal file
Binary file not shown.
BIN
.vs/ProjectEvaluation/avaloniaappapplication.projects.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/avaloniaappapplication.projects.v9.bin
Normal file
Binary file not shown.
BIN
.vs/ProjectEvaluation/avaloniaappapplication.strings.v9.bin
Normal file
BIN
.vs/ProjectEvaluation/avaloniaappapplication.strings.v9.bin
Normal file
Binary file not shown.
25
AvaloniaAppApplication.sln
Normal file
25
AvaloniaAppApplication.sln
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.8.34330.188
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaAppApplication", "AvaloniaAppApplication\AvaloniaAppApplication.csproj", "{8D422B75-EA6B-4567-A2B3-34A14929F3D1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8D422B75-EA6B-4567-A2B3-34A14929F3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8D422B75-EA6B-4567-A2B3-34A14929F3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8D422B75-EA6B-4567-A2B3-34A14929F3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8D422B75-EA6B-4567-A2B3-34A14929F3D1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {7A744A1E-FE08-4044-BAFF-E8C17FD6ADBA}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
90
AvaloniaAppApplication/AddEditWindow.axaml
Normal file
90
AvaloniaAppApplication/AddEditWindow.axaml
Normal file
@ -0,0 +1,90 @@
|
||||
<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" Height="550" d:DesignWidth="800" d:DesignHeight="650"
|
||||
x:Class="AvaloniaAppApplication.AddEditWindow"
|
||||
Title="AddEditWindow">
|
||||
<Grid ColumnDefinitions="*, 10*, *" RowDefinitions="*, 10*, *">
|
||||
<StackPanel Spacing="10" Orientation="Vertical" Grid.Column="1" Grid.Row="1">
|
||||
|
||||
<Grid HorizontalAlignment="Center">
|
||||
<TextBlock Name="TitleTB" Text="Добавление" FontSize="20" FontWeight="Bold"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid HorizontalAlignment="Center" ColumnDefinitions="*, *">
|
||||
<TextBlock Text="Название" Width="150" HorizontalAlignment="Left" Padding="0 6"/>
|
||||
<TextBox Grid.Column="1" Name="TitleTX" Text="{Binding Title}" Width="200"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid HorizontalAlignment="Center" ColumnDefinitions="*, *">
|
||||
<TextBlock Text="Стоимость" Width="150" Padding="0 6"/>
|
||||
<TextBox Name="CostTX" Text="{Binding Cost}" Grid.Column="1" Width="200"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid HorizontalAlignment="Center" ColumnDefinitions="*, *">
|
||||
<TextBlock Text="Длительность (сек.)" Width="150" Padding="0 6"/>
|
||||
<TextBox Grid.Column="1" Name="DurationTX" Text="{Binding Durationinseconds}" Width="200"/>
|
||||
|
||||
</Grid>
|
||||
<Grid HorizontalAlignment="Center" ColumnDefinitions="*, *">
|
||||
<TextBlock Text="Описание" Width="150" Padding="0 6"/>
|
||||
<TextBox TextWrapping="Wrap" Name="DescriptionTX" Text="{Binding Description}" Grid.Column="1" Height="60" Width="200"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid HorizontalAlignment="Center" ColumnDefinitions="*, *">
|
||||
<TextBlock Text="Скидка (%)" Width="150" Padding="0 6"/>
|
||||
<TextBox Grid.Column="1" Name="DiscountTX" Text="{Binding Discount}" Width="200"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid HorizontalAlignment="Center" ColumnDefinitions="*, *">
|
||||
<TextBlock Text="Изображение" Width="150" Padding="0 6"/>
|
||||
<Button Content="Выбрать" Name="AddPictureButton" HorizontalContentAlignment="Center" Grid.Column="1" Width="200" Click="AddPictureButton_Click"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ListBox Height="160" Width="700"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Visible"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Disabled"
|
||||
ItemsSource="{Binding ServiceBitmaps}" Name="PictureLB">
|
||||
<ListBox.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal"/>
|
||||
</ItemsPanelTemplate>
|
||||
</ListBox.ItemsPanel>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Image Height="200" Name="ImageContainer" Source="{Binding Bitmap}" Width="200"/>
|
||||
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
||||
|
||||
|
||||
</ListBox>
|
||||
|
||||
|
||||
<StackPanel Orientation="Vertical">
|
||||
<Button Content="Добавить изображение" HorizontalContentAlignment="Center" Click="AddImageButton_Click"/>
|
||||
<Button Content="Удалить изображение" HorizontalContentAlignment="Center" Click="DeleteImageButton_Click"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" Grid.Row="2">
|
||||
<Button Name="SaveButton" Content="Сохранить" HorizontalAlignment="Center" Click="SaveButton_Click"></Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
293
AvaloniaAppApplication/AddEditWindow.axaml.cs
Normal file
293
AvaloniaAppApplication/AddEditWindow.axaml.cs
Normal file
@ -0,0 +1,293 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media.Imaging;
|
||||
using AvaloniaAppApplication.DTO;
|
||||
using AvaloniaAppApplication.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MsBox.Avalonia;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace AvaloniaAppApplication;
|
||||
|
||||
public partial class AddEditWindow : Window
|
||||
{
|
||||
ServiceDTO currentService = new ServiceDTO();
|
||||
ObservableCollection<ServicePhotoDTO> serviceImages
|
||||
= new ObservableCollection<ServicePhotoDTO>();
|
||||
|
||||
|
||||
|
||||
// äîáàâëåíèå
|
||||
public AddEditWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = currentService;
|
||||
}
|
||||
|
||||
// ðåäàêòèðîâàíèå
|
||||
public AddEditWindow(ServiceDTO service)
|
||||
{
|
||||
InitializeComponent();
|
||||
currentService = service;
|
||||
DataContext = currentService;
|
||||
TitleTB.Text = "Ðåäàêòèðîâàíèå";
|
||||
LoadImages();
|
||||
|
||||
}
|
||||
|
||||
public void LoadImages()
|
||||
{
|
||||
var servicePhotosList = Manager.context.Servicephotos
|
||||
.Where(s => s.Id == currentService.Id)
|
||||
.Select(s => new ServicePhotoDTO
|
||||
{
|
||||
ServiceId = s.Serviceid,
|
||||
PhotoPath = s.Photopath
|
||||
})
|
||||
.ToList();
|
||||
|
||||
foreach (var photo in servicePhotosList)
|
||||
{
|
||||
serviceImages.Add(photo);
|
||||
}
|
||||
|
||||
|
||||
if (serviceImages.Any())
|
||||
{
|
||||
foreach (var serviceImage in serviceImages)
|
||||
{
|
||||
Bitmap bitmap = new Bitmap(AppDomain.CurrentDomain.BaseDirectory.ToString().Replace("\\bin\\Debug\\net7.0\\", "\\") + serviceImage.PhotoPath.Trim());
|
||||
currentService.ServiceBitmaps.Add(new ServicePhotoDTO
|
||||
{
|
||||
Bitmap = bitmap,
|
||||
PhotoPath = currentService.MainImagePath,
|
||||
ServiceId = currentService.Id
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private async void SaveButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder errors = new StringBuilder();
|
||||
if (string.IsNullOrEmpty(TitleTX.Text) || string.IsNullOrWhiteSpace(TitleTX.Text) ||
|
||||
string.IsNullOrEmpty(CostTX.Text) || string.IsNullOrWhiteSpace(CostTX.Text) ||
|
||||
string.IsNullOrEmpty(DescriptionTX.Text) || string.IsNullOrWhiteSpace(DescriptionTX.Text) ||
|
||||
string.IsNullOrEmpty(DiscountTX.Text) || string.IsNullOrWhiteSpace(DiscountTX.Text) ||
|
||||
string.IsNullOrEmpty(DurationTX.Text) || string.IsNullOrWhiteSpace(DurationTX.Text))
|
||||
{
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", "Çàïîëíèòå ïóñòûå ïîëÿ!");
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!DurationTX.Text.All(char.IsDigit) || !CostTX.Text.All(char.IsDigit))
|
||||
{
|
||||
errors.AppendLine("Ââåä¸ííûå äàííûå î öåíå èëè äëèòåëüíîñòè íå ÿâëÿþòñÿ ÷èñëîâûìè çíà÷åíèÿìè!");
|
||||
}
|
||||
|
||||
if (int.Parse(DurationTX.Text) > 2400)
|
||||
{
|
||||
errors.AppendLine("Äëèòåëüíîñòü îêàçàíèÿ óñëóãè íå ìîæåò áûòü áîëüøå, ÷åì 4 ÷àñà!");
|
||||
}
|
||||
|
||||
if (errors.Length > 0)
|
||||
{
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", errors.ToString());
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentService.Discount > 100)
|
||||
{
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", "Ñêèäêà íå ìîæåò áûòü áîëüøå 100%");
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (errors.Length > 0)
|
||||
{
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", errors.ToString());
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
var service = new Service()
|
||||
{
|
||||
Title = currentService.Title,
|
||||
Cost = (decimal)currentService.Cost,
|
||||
Description = currentService.Description,
|
||||
Discount = currentService.Discount,
|
||||
Mainimagepath = currentService.MainImagePath,
|
||||
Durationinseconds = (int)currentService.Durationinseconds
|
||||
};
|
||||
// äîáàâëåíèå
|
||||
if (currentService.Id == 0)
|
||||
{
|
||||
if (Manager.context.Services.Any(s => s.Title == currentService.Title))
|
||||
{
|
||||
var ms = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", "Ñåðâèñ ñ òàêèì íàçâàíèåì óæå ñóùåñòâóåò!");
|
||||
var ress = await ms.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
ManageBitmaps();
|
||||
Manager.context.Add(service);
|
||||
Manager.context.SaveChanges();
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("OK!", "Èíôîðìàöèÿ áûëà óñïåøíî äîáàâëåíà!");
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
|
||||
}
|
||||
else // ðåäàêòèðîâàíèå
|
||||
{
|
||||
var serviceToEdit = Manager.context.Services.FirstOrDefault(s => s.Id == currentService.Id);
|
||||
serviceToEdit.Title = currentService.Title;
|
||||
serviceToEdit.Cost = (decimal)currentService.Cost;
|
||||
serviceToEdit.Description = currentService.Description;
|
||||
serviceToEdit.Discount = currentService.Discount;
|
||||
serviceToEdit.Mainimagepath = currentService.MainImagePath;
|
||||
serviceToEdit.Durationinseconds = (int)currentService.Durationinseconds;
|
||||
|
||||
ManageBitmaps();
|
||||
Manager.context.Update(serviceToEdit);
|
||||
Manager.context.SaveChanges();
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("OK!", "Èíôîðìàöèÿ áûëà óñïåøíî ðåäàêòèðîâàíà!");
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
|
||||
}
|
||||
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", "Ïðîèçîøëà îøèáêà ïðè èçìåíåíèè äàííûõ!");
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void ManageBitmaps()
|
||||
{
|
||||
var servicePhotosInDB = Manager.context.Servicephotos.ToList();
|
||||
foreach (var servicePhoto in servicePhotosInDB)
|
||||
{
|
||||
if (!currentService.ServiceBitmaps.Any(b => b.ServiceId == servicePhoto.Id && b.PhotoPath == servicePhoto.Photopath))
|
||||
{
|
||||
var imageToRemove = Manager.context.Servicephotos.FirstOrDefault(b => b.Serviceid == currentService.Id
|
||||
&& b.Photopath == servicePhoto.Photopath);
|
||||
if (imageToRemove != null)
|
||||
Manager.context.Servicephotos.Remove(imageToRemove);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var serviceBitmap in currentService.ServiceBitmaps)
|
||||
{
|
||||
if (!currentService.ServiceBitmaps.Any(b => b.ServiceId == serviceBitmap.Id && b.PhotoPath == serviceBitmap.PhotoPath))
|
||||
{
|
||||
var newServicePhotoToAdd = new Servicephoto
|
||||
{
|
||||
Serviceid = currentService.Id,
|
||||
Photopath = serviceBitmap.PhotoPath
|
||||
};
|
||||
Manager.context.Add(newServicePhotoToAdd);
|
||||
|
||||
}
|
||||
}
|
||||
Manager.context.SaveChanges();
|
||||
}
|
||||
|
||||
private async void AddPictureButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filters.Add(new FileDialogFilter { Name = "Âûáîð èçîáðàæåíèÿ", Extensions = { "jpg", "jpeg", "png", "bmp" } });
|
||||
openFileDialog.AllowMultiple = false;
|
||||
|
||||
var result = await openFileDialog.ShowAsync(this);
|
||||
if (result != null && result.Length > 0)
|
||||
{
|
||||
var picToAdd = new Bitmap(result[0]);
|
||||
string picName = "asset" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg";
|
||||
string appDataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString().Replace("\\bin\\Debug\\net7.0\\", "\\"), "Óñëóãè àâòîñåðâèñà");
|
||||
|
||||
using (var fileStream = new FileStream(Path.Combine(appDataPath, picName), FileMode.Create))
|
||||
{
|
||||
picToAdd.Save(fileStream);
|
||||
}
|
||||
|
||||
currentService.ImageBitmap = picToAdd;
|
||||
currentService.MainImagePath = Path.Combine("Óñëóãè àâòîñåðâèñà", picName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", ex.Message);
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private async void AddImageButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
var openFileDialog = new OpenFileDialog();
|
||||
openFileDialog.Filters.Add(new FileDialogFilter { Extensions = { "png", "jpeg", "jpg", "bmp" } });
|
||||
openFileDialog.AllowMultiple = false;
|
||||
|
||||
try
|
||||
{
|
||||
var result = await openFileDialog.ShowAsync(this);
|
||||
if (result != null && result.Length > 0)
|
||||
{
|
||||
string imagePath = result[0].ToString();
|
||||
Bitmap bitmap = new Bitmap(imagePath);
|
||||
|
||||
string assetsFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString().Replace("\\bin\\Debug\\net7.0\\", "\\"), "Óñëóãè àâòîñåðâèñà");
|
||||
string fileName = Guid.NewGuid().ToString() + ".jpg";
|
||||
string savedImagePath = Path.Combine(assetsFolderPath, fileName);
|
||||
|
||||
if (currentService.ServiceBitmaps.Any(b => b.PhotoPath == ("Óñëóãè àâòîñåðâèñà/" + fileName).Trim()))
|
||||
{
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà", "Âû íå ìîæåòå äîáàâèòü îäíî è òî æå ôîòî äâàæäû!");
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
using (var stream = File.OpenWrite(savedImagePath))
|
||||
{
|
||||
bitmap.Save(stream);
|
||||
}
|
||||
|
||||
var imageToAdd = new ServicePhotoDTO
|
||||
{
|
||||
Bitmap = bitmap,
|
||||
PhotoPath = ("Óñëóãè àâòîñåðâèñà/" + fileName).Trim(),
|
||||
ServiceId = currentService.Id
|
||||
};
|
||||
currentService.ServiceBitmaps.Add(imageToAdd);
|
||||
|
||||
currentService.MainImagePath = ("Óñëóãè àâòîñåðâèñà/" + fileName).Trim();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteImageButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
if (currentService.ServicePhotos.Count > 0)
|
||||
currentService.ServiceBitmaps.RemoveAt(PictureLB.SelectedIndex);
|
||||
}
|
||||
}
|
10
AvaloniaAppApplication/App.axaml
Normal file
10
AvaloniaAppApplication/App.axaml
Normal file
@ -0,0 +1,10 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="AvaloniaAppApplication.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
</Application.Styles>
|
||||
</Application>
|
24
AvaloniaAppApplication/App.axaml.cs
Normal file
24
AvaloniaAppApplication/App.axaml.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace AvaloniaAppApplication
|
||||
{
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = new AuthWindow();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
}
|
17
AvaloniaAppApplication/AuthWindow.axaml
Normal file
17
AvaloniaAppApplication/AuthWindow.axaml
Normal file
@ -0,0 +1,17 @@
|
||||
<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="AvaloniaAppApplication.AuthWindow"
|
||||
Title="AuthWindow">
|
||||
<Grid ColumnDefinitions="*, 5*, *" RowDefinitions="*, 3*, *">
|
||||
<Grid Grid.Column="1" Grid.Row="1" RowDefinitions="Auto, *, *">
|
||||
<TextBlock HorizontalAlignment="Center" FontSize="25">Авторизация</TextBlock>
|
||||
<TextBox TextChanged="TextBox_TextChanged" Name="EntertextBox" Height="40" Width="169" Grid.Row="1" HorizontalAlignment="Center"></TextBox>
|
||||
<StackPanel Grid.Row="2" HorizontalAlignment="Center" Orientation="Vertical">
|
||||
<Button Name="GuestNodeButton" Click="Button_Click_1" Content="Режим гостя"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
33
AvaloniaAppApplication/AuthWindow.axaml.cs
Normal file
33
AvaloniaAppApplication/AuthWindow.axaml.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace AvaloniaAppApplication;
|
||||
|
||||
public partial class AuthWindow : Window
|
||||
{
|
||||
public AuthWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
||||
private void Button_Click_1(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
Manager.isAdmin = false;
|
||||
new MainWindow().Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void TextBox_TextChanged(object? sender, Avalonia.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
if (EntertextBox.Text == "0000")
|
||||
{
|
||||
Manager.isAdmin = true;
|
||||
new MainWindow().Show();
|
||||
|
||||
Close();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
41
AvaloniaAppApplication/AvaloniaAppApplication.csproj
Normal file
41
AvaloniaAppApplication/AvaloniaAppApplication.csproj
Normal file
@ -0,0 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AvaloniaXaml Remove="Assets\**" />
|
||||
<AvaloniaXaml Remove="Услуги автосервиса\**" />
|
||||
<Compile Remove="Assets\**" />
|
||||
<Compile Remove="Услуги автосервиса\**" />
|
||||
<EmbeddedResource Remove="Assets\**" />
|
||||
<EmbeddedResource Remove="Услуги автосервиса\**" />
|
||||
<None Remove="Assets\**" />
|
||||
<None Remove="Услуги автосервиса\**" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.3.0" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.0" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.0" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.0" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.3.0" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<UpToDateCheckInput Remove="ClientServiceWindow.axaml" />
|
||||
</ItemGroup>
|
||||
</Project>
|
49
AvaloniaAppApplication/ClientAppointmentsWindow.axaml
Normal file
49
AvaloniaAppApplication/ClientAppointmentsWindow.axaml
Normal file
@ -0,0 +1,49 @@
|
||||
<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="AvaloniaAppApplication.ClientAppointmentsWindow"
|
||||
Title="ClientAppointmentsWindow">
|
||||
<Grid RowDefinitions="*, 10*, *" ColumnDefinitions="*, 10*, *">
|
||||
<ListBox Name="ClientAppointmentLB" Grid.Column="1" Grid.Row="1">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ListBoxItem>
|
||||
<Grid RowDefinitions="*, *, *, *, *, *">
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<TextBlock Text="Наименование услуги: " FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding Title}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBlock Text="ФИО клиента: " FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding ClientFIO}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2" Orientation="Horizontal">
|
||||
<TextBlock Text="Эл. почта: " FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding Email}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="3" Orientation="Horizontal">
|
||||
<TextBlock Text="Телефон: " FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding Phone}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal">
|
||||
<TextBlock Text="Дата и время записи: " FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding StartTime}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Background="{Binding ColorString}" Grid.Row="5" Orientation="Horizontal">
|
||||
<TextBlock Text="До начала услуги осталось: " FontWeight="Bold"/>
|
||||
<TextBlock Text="{Binding RemainingTime, StringFormat='{}{0} минут'}"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ListBoxItem>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Window>
|
62
AvaloniaAppApplication/ClientAppointmentsWindow.axaml.cs
Normal file
62
AvaloniaAppApplication/ClientAppointmentsWindow.axaml.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Threading;
|
||||
using AvaloniaAppApplication.DTO;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace AvaloniaAppApplication;
|
||||
|
||||
public partial class ClientAppointmentsWindow : Window
|
||||
{
|
||||
private DispatcherTimer timer;
|
||||
ObservableCollection<ClientServiceDTO> appointments;
|
||||
public ClientAppointmentsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext= this;
|
||||
LoadData();
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
public void LoadData()
|
||||
{
|
||||
string todayDate = DateTime.Today.ToString("dd.MM.yy");
|
||||
string tommorowDate = DateTime.Today.AddDays(1).ToString("dd.MM.yy");
|
||||
var moscowTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time");
|
||||
|
||||
var appointmentList = Manager.context.Clientservices.AsNoTracking()
|
||||
.Include(c => c.Client)
|
||||
.Include(s => s.Service)
|
||||
.Where(a => a.Starttime.Contains(todayDate) || a.Starttime.Contains(tommorowDate))
|
||||
.Select(a => new ClientServiceDTO
|
||||
{
|
||||
Title = a.Service.Title,
|
||||
ClientFIO = a.Client.Lastname + " " + a.Client.Firstname + " " + a.Client.Patronymic,
|
||||
Email = a.Client.Email,
|
||||
StartTime = a.Starttime,
|
||||
Phone = a.Client.Phone,
|
||||
RemainingTime = (int)((DateTime.ParseExact(a.Starttime, "dd.MM.yy H:mm", CultureInfo.InvariantCulture) -
|
||||
TimeZoneInfo.ConvertTime(DateTime.Now, moscowTimeZone)).TotalSeconds / 60)
|
||||
})
|
||||
.ToList();
|
||||
|
||||
appointments = new ObservableCollection<ClientServiceDTO>(appointmentList);
|
||||
ClientAppointmentLB.ItemsSource = appointments;
|
||||
}
|
||||
|
||||
private void StartTimer()
|
||||
{
|
||||
timer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(30) // Set the interval to 30 seconds
|
||||
};
|
||||
|
||||
timer.Tick += (sender, e) => LoadData(); // Reload data on tick
|
||||
timer.Start(); // Start the timer
|
||||
}
|
||||
}
|
45
AvaloniaAppApplication/ClientServiceWindow.axaml
Normal file
45
AvaloniaAppApplication/ClientServiceWindow.axaml
Normal file
@ -0,0 +1,45 @@
|
||||
<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="AvaloniaAppApplication.ClientServiceWindow"
|
||||
Title="ClientServiceWindow">
|
||||
<Grid RowDefinitions="*, 10*, *" ColumnDefinitions="*, 10*, *">
|
||||
<Grid Grid.Column="1" Grid.Row="1" ColumnDefinitions="*, *">
|
||||
<StackPanel Spacing="10" Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Наименование услуги: " TextWrapping="Wrap" FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Title}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Длительность услуги: " FontWeight="Bold" />
|
||||
<TextBlock Name="DurationInMinutesTN" Text="{Binding DurationInMinutes}"/>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Время начала: " FontWeight="Bold" />
|
||||
<Border CornerRadius="5" x:Name="ServiceStartTimeBorder" BorderThickness="2" Padding="0">
|
||||
<TextBox BorderBrush="Transparent" TextChanged="TextBox_TextChanged" x:Name="ServiceStartTimeTX" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="Время окончания: " FontWeight="Bold" />
|
||||
<TextBlock Name="ServiceEndTimeTB"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" Orientation="Vertical">
|
||||
<TextBlock Text="Дата услуги: " FontWeight="Bold" />
|
||||
<Calendar SelectedDatesChanged="Calendar_SelectedDatesChanged" Name="CalendarControl"/>
|
||||
<ComboBox Name="ComboClients" PlaceholderText="Выберите клиента"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<Button Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" Click="Button_Click" Content="Оформить услугу"/>
|
||||
</Grid>
|
||||
</Window>
|
146
AvaloniaAppApplication/ClientServiceWindow.axaml.cs
Normal file
146
AvaloniaAppApplication/ClientServiceWindow.axaml.cs
Normal file
@ -0,0 +1,146 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using AvaloniaAppApplication.Context;
|
||||
using AvaloniaAppApplication.DTO;
|
||||
using AvaloniaAppApplication.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MsBox.Avalonia;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace AvaloniaAppApplication;
|
||||
|
||||
public partial class ClientServiceWindow : Window
|
||||
{
|
||||
string time = "";
|
||||
string date = "";
|
||||
ServiceDTO currentService;
|
||||
User19Context dbContext = new User19Context();
|
||||
public ClientServiceWindow(ServiceDTO service)
|
||||
{
|
||||
InitializeComponent();
|
||||
currentService = service;
|
||||
DataContext = currentService;
|
||||
ComboClients.ItemsSource = dbContext.Clients.Select(c => c.Firstname + " " + c.Lastname + " " + c.Patronymic);
|
||||
}
|
||||
|
||||
private void TextBox_TextChanged(object? sender, Avalonia.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime parsedStartTime;
|
||||
string characters = "0123456789.:";
|
||||
string processedText = ServiceStartTimeTX.Text ?? string.Empty;
|
||||
|
||||
string[] timeFormats = {
|
||||
"HH.mm",
|
||||
"H.mm",
|
||||
"HH:mm",
|
||||
"H:mm"
|
||||
};
|
||||
|
||||
if (DateTime.TryParseExact(processedText, timeFormats, CultureInfo.InvariantCulture, DateTimeStyles.None, out parsedStartTime))
|
||||
{
|
||||
ServiceStartTimeBorder.BorderBrush = new SolidColorBrush(Colors.Green);
|
||||
time = parsedStartTime.ToString("HH:mm");
|
||||
ManageEndDateTime();
|
||||
}
|
||||
else
|
||||
{
|
||||
ServiceStartTimeBorder.BorderBrush = new SolidColorBrush(Colors.Red);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
string startDateTimeString;
|
||||
public void ManageEndDateTime()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(date) && !string.IsNullOrEmpty(time) && int.TryParse(DurationInMinutesTN.Text, out int minutes))
|
||||
{
|
||||
startDateTimeString = date + " " + time;
|
||||
string[] formats = { "dd.MM.yy HH:mm", "d.M.yyyy H:mm" };
|
||||
if (DateTime.TryParseExact(startDateTimeString, formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime startDateTime))
|
||||
{
|
||||
DateTime endDateTime = startDateTime.AddMinutes(minutes);
|
||||
string endDateTimeString = endDateTime.ToString("dd.MM.yyyy HH.mm", CultureInfo.InvariantCulture); // Èñïîëüçóåì CultureInfo
|
||||
ServiceEndTimeTB.Text = endDateTimeString;
|
||||
}
|
||||
else
|
||||
{
|
||||
ServiceEndTimeTB.Text = string.Empty; // Î÷èñòêà ïîëÿ ïðè îøèáêå
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Calendar_SelectedDatesChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
var selectedDate = (DateTime)((Avalonia.Controls.Calendar)sender).SelectedDate;
|
||||
date = selectedDate.ToString("dd.MM.yy");
|
||||
ManageEndDateTime();
|
||||
}
|
||||
|
||||
// äîáàâëÿåì çàïèñü êëèåíòà íà óñëóãó (ñîõðàíÿåì)
|
||||
private async void Button_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
StringBuilder errors = new StringBuilder();
|
||||
IBrush red = new SolidColorBrush(Colors.Red);
|
||||
bool isBorderBrushRed = ServiceStartTimeBorder.BorderBrush is SolidColorBrush solidBrush
|
||||
&& solidBrush.Color == Colors.Red;
|
||||
if (ComboClients.SelectedIndex == -1)
|
||||
errors.AppendLine("Êëèåíò íå óêàçàí!");
|
||||
if (isBorderBrushRed
|
||||
|| ServiceStartTimeTX.Text == null
|
||||
|| CalendarControl.SelectedDate == null)
|
||||
errors.AppendLine("Äàòà è âðåìÿ îêàçàíèÿ óñëóãè âûáðàíû íåêîððåêòíî!");
|
||||
|
||||
if (errors != null && errors.Length > 0)
|
||||
{
|
||||
var msBox = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", errors.ToString());
|
||||
var rs = msBox.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
|
||||
Clientservice newClientService = new Clientservice()
|
||||
{
|
||||
Clientid = ComboClients.SelectedIndex + 1,
|
||||
Starttime = startDateTimeString,
|
||||
Serviceid = currentService.Id
|
||||
};
|
||||
|
||||
|
||||
dbContext.Clientservices.Add(newClientService);
|
||||
dbContext.SaveChanges();
|
||||
|
||||
var msbox = MessageBoxManager.GetMessageBoxStandard("OK!", "Çàïèñü îá óñëóãå äëÿ êëèåíòà áûëà óñïåøíî îôîðìëåíà!");
|
||||
var res = await msbox.ShowWindowDialogAsync(this);
|
||||
Close();
|
||||
}
|
||||
catch
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
333
AvaloniaAppApplication/Context/User19Context.cs
Normal file
333
AvaloniaAppApplication/Context/User19Context.cs
Normal file
@ -0,0 +1,333 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using AvaloniaAppApplication.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace AvaloniaAppApplication.Context;
|
||||
|
||||
public partial class User19Context : DbContext
|
||||
{
|
||||
public User19Context()
|
||||
{
|
||||
}
|
||||
|
||||
public User19Context(DbContextOptions<User19Context> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Client> Clients { get; set; }
|
||||
|
||||
public virtual DbSet<Clientservice> Clientservices { get; set; }
|
||||
|
||||
public virtual DbSet<Documentbyservice> Documentbyservices { get; set; }
|
||||
|
||||
public virtual DbSet<Gender> Genders { get; set; }
|
||||
|
||||
public virtual DbSet<Manufacturer> Manufacturers { get; set; }
|
||||
|
||||
public virtual DbSet<Product> Products { get; set; }
|
||||
|
||||
public virtual DbSet<Productphoto> Productphotos { get; set; }
|
||||
|
||||
public virtual DbSet<Productsale> Productsales { get; set; }
|
||||
|
||||
public virtual DbSet<Service> Services { get; set; }
|
||||
|
||||
public virtual DbSet<Servicephoto> Servicephotos { get; set; }
|
||||
|
||||
public virtual DbSet<Tag> Tags { 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;Database=user19;Username=user19;Password=oplwLVnn");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Client>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("client_pkey");
|
||||
|
||||
entity.ToTable("client", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Birthday).HasColumnName("birthday");
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(255)
|
||||
.HasColumnName("email");
|
||||
entity.Property(e => e.Firstname)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("firstname");
|
||||
entity.Property(e => e.Gendercode)
|
||||
.HasMaxLength(1)
|
||||
.HasColumnName("gendercode");
|
||||
entity.Property(e => e.Lastname)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("lastname");
|
||||
entity.Property(e => e.Patronymic)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("patronymic");
|
||||
entity.Property(e => e.Phone)
|
||||
.HasMaxLength(20)
|
||||
.HasColumnName("phone");
|
||||
entity.Property(e => e.Photopath)
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnName("photopath");
|
||||
entity.Property(e => e.Registrationdate).HasColumnName("registrationdate");
|
||||
|
||||
entity.HasOne(d => d.GendercodeNavigation).WithMany(p => p.Clients)
|
||||
.HasForeignKey(d => d.Gendercode)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_client_gender");
|
||||
|
||||
entity.HasMany(d => d.Tags).WithMany(p => p.Clients)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"Tagofclient",
|
||||
r => r.HasOne<Tag>().WithMany()
|
||||
.HasForeignKey("Tagid")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("tagofclient_tag_fk"),
|
||||
l => l.HasOne<Client>().WithMany()
|
||||
.HasForeignKey("Clientid")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_tagofclient_client"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Clientid", "Tagid").HasName("tagofclient_pkey");
|
||||
j.ToTable("tagofclient", "firstdemo");
|
||||
j.IndexerProperty<int>("Clientid").HasColumnName("clientid");
|
||||
j.IndexerProperty<int>("Tagid").HasColumnName("tagid");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Clientservice>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("clientservice_pkey");
|
||||
|
||||
entity.ToTable("clientservice", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Clientid).HasColumnName("clientid");
|
||||
entity.Property(e => e.Comment).HasColumnName("comment");
|
||||
entity.Property(e => e.Serviceid).HasColumnName("serviceid");
|
||||
entity.Property(e => e.Starttime).HasColumnName("starttime");
|
||||
|
||||
entity.HasOne(d => d.Client).WithMany(p => p.Clientservices)
|
||||
.HasForeignKey(d => d.Clientid)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("clientservice_client_fk");
|
||||
|
||||
entity.HasOne(d => d.Service).WithMany(p => p.Clientservices)
|
||||
.HasForeignKey(d => d.Serviceid)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("clientservice_service_fk");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Documentbyservice>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("documentbyservice_pkey");
|
||||
|
||||
entity.ToTable("documentbyservice", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Clientserviceid).HasColumnName("clientserviceid");
|
||||
entity.Property(e => e.Documentpath)
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnName("documentpath");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Gender>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Code).HasName("gender_pkey");
|
||||
|
||||
entity.ToTable("gender", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Code)
|
||||
.HasMaxLength(1)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnName("code");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(10)
|
||||
.HasColumnName("name");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Manufacturer>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("manufacturer_pkey");
|
||||
|
||||
entity.ToTable("manufacturer", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Name)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("name");
|
||||
entity.Property(e => e.Startdate).HasColumnName("startdate");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Product>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("product_pkey");
|
||||
|
||||
entity.ToTable("product", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Cost)
|
||||
.HasPrecision(19, 4)
|
||||
.HasColumnName("cost");
|
||||
entity.Property(e => e.Description).HasColumnName("description");
|
||||
entity.Property(e => e.Isactive).HasColumnName("isactive");
|
||||
entity.Property(e => e.Mainimagepath)
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnName("mainimagepath");
|
||||
entity.Property(e => e.Manufacturerid).HasColumnName("manufacturerid");
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("title");
|
||||
|
||||
entity.HasOne(d => d.Manufacturer).WithMany(p => p.Products)
|
||||
.HasForeignKey(d => d.Manufacturerid)
|
||||
.HasConstraintName("fk_product_manufacturer");
|
||||
|
||||
entity.HasMany(d => d.Attachedproducts).WithMany(p => p.Mainproducts)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"Attachedproduct",
|
||||
r => r.HasOne<Product>().WithMany()
|
||||
.HasForeignKey("Attachedproductid")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_attachedproduct_product1"),
|
||||
l => l.HasOne<Product>().WithMany()
|
||||
.HasForeignKey("Mainproductid")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_attachedproduct_product"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pkey");
|
||||
j.ToTable("attachedproduct", "firstdemo");
|
||||
j.IndexerProperty<int>("Mainproductid").HasColumnName("mainproductid");
|
||||
j.IndexerProperty<int>("Attachedproductid").HasColumnName("attachedproductid");
|
||||
});
|
||||
|
||||
entity.HasMany(d => d.Mainproducts).WithMany(p => p.Attachedproducts)
|
||||
.UsingEntity<Dictionary<string, object>>(
|
||||
"Attachedproduct",
|
||||
r => r.HasOne<Product>().WithMany()
|
||||
.HasForeignKey("Mainproductid")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_attachedproduct_product"),
|
||||
l => l.HasOne<Product>().WithMany()
|
||||
.HasForeignKey("Attachedproductid")
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_attachedproduct_product1"),
|
||||
j =>
|
||||
{
|
||||
j.HasKey("Mainproductid", "Attachedproductid").HasName("attachedproduct_pkey");
|
||||
j.ToTable("attachedproduct", "firstdemo");
|
||||
j.IndexerProperty<int>("Mainproductid").HasColumnName("mainproductid");
|
||||
j.IndexerProperty<int>("Attachedproductid").HasColumnName("attachedproductid");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Productphoto>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("productphoto_pkey");
|
||||
|
||||
entity.ToTable("productphoto", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Photopath)
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnName("photopath");
|
||||
entity.Property(e => e.Productid).HasColumnName("productid");
|
||||
|
||||
entity.HasOne(d => d.Product).WithMany(p => p.Productphotos)
|
||||
.HasForeignKey(d => d.Productid)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_productphoto_product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Productsale>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("productsale_pkey");
|
||||
|
||||
entity.ToTable("productsale", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Clientserviceid).HasColumnName("clientserviceid");
|
||||
entity.Property(e => e.Productid).HasColumnName("productid");
|
||||
entity.Property(e => e.Quantity).HasColumnName("quantity");
|
||||
entity.Property(e => e.Saledate)
|
||||
.HasColumnType("timestamp(6) without time zone")
|
||||
.HasColumnName("saledate");
|
||||
|
||||
entity.HasOne(d => d.Clientservice).WithMany(p => p.Productsales)
|
||||
.HasForeignKey(d => d.Clientserviceid)
|
||||
.HasConstraintName("fk_productsale_clientservice");
|
||||
|
||||
entity.HasOne(d => d.Product).WithMany(p => p.Productsales)
|
||||
.HasForeignKey(d => d.Productid)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_productsale_product");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Service>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("service_pkey");
|
||||
|
||||
entity.ToTable("service", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Cost)
|
||||
.HasPrecision(19, 4)
|
||||
.HasColumnName("cost");
|
||||
entity.Property(e => e.Description).HasColumnName("description");
|
||||
entity.Property(e => e.Discount).HasColumnName("discount");
|
||||
entity.Property(e => e.Durationinseconds).HasColumnName("durationinseconds");
|
||||
entity.Property(e => e.Mainimagepath)
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnName("mainimagepath");
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(100)
|
||||
.HasColumnName("title");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Servicephoto>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("servicephoto_pkey");
|
||||
|
||||
entity.ToTable("servicephoto", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id).HasColumnName("id");
|
||||
entity.Property(e => e.Photopath)
|
||||
.HasMaxLength(1000)
|
||||
.HasColumnName("photopath");
|
||||
entity.Property(e => e.Serviceid).HasColumnName("serviceid");
|
||||
|
||||
entity.HasOne(d => d.Service).WithMany(p => p.Servicephotos)
|
||||
.HasForeignKey(d => d.Serviceid)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("fk_servicephoto_service");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Tag>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Id).HasName("tag_pkey");
|
||||
|
||||
entity.ToTable("tag", "firstdemo");
|
||||
|
||||
entity.Property(e => e.Id)
|
||||
.ValueGeneratedNever()
|
||||
.HasColumnName("id");
|
||||
entity.Property(e => e.Color)
|
||||
.HasMaxLength(8)
|
||||
.IsFixedLength()
|
||||
.HasColumnName("color");
|
||||
entity.Property(e => e.Title)
|
||||
.HasMaxLength(30)
|
||||
.HasColumnName("title");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
118
AvaloniaAppApplication/DTO/ServiceDTO.cs
Normal file
118
AvaloniaAppApplication/DTO/ServiceDTO.cs
Normal file
@ -0,0 +1,118 @@
|
||||
using Avalonia.Platform;
|
||||
using AvaloniaAppApplication.Models;
|
||||
//using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Media.Imaging;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace AvaloniaAppApplication.DTO
|
||||
{
|
||||
public class ServiceDTO
|
||||
{
|
||||
private string _mainimagePath;
|
||||
public ServiceDTO()
|
||||
{
|
||||
}
|
||||
public int Id { get; set; }
|
||||
|
||||
public string? Title { get; set; }
|
||||
|
||||
public float Cost { get; set; }
|
||||
|
||||
public float? CostWithDiscount {
|
||||
get
|
||||
{
|
||||
if (Discount > 0)
|
||||
return Cost - (Cost * Discount / 100);
|
||||
else
|
||||
return Cost;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int? Durationinseconds
|
||||
{ get; set; }
|
||||
|
||||
|
||||
public float? DurationInMinutes {
|
||||
get
|
||||
{
|
||||
if (Durationinseconds != null)
|
||||
return Durationinseconds / 60;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public float? Discount { get; set; }
|
||||
|
||||
|
||||
public string? MainImagePath { get; set; }
|
||||
|
||||
public virtual ICollection<Clientservice> ClientServices { get; set; } = new List<Clientservice>();
|
||||
|
||||
public virtual ICollection<Servicephoto> ServicePhotos { get; set; } = new List<Servicephoto>();
|
||||
|
||||
public virtual ICollection<Product> MainProducts { get; set; } = new List<Product>();
|
||||
|
||||
public Bitmap ImageBitmap
|
||||
{ get; set; }
|
||||
|
||||
public string DiscountColor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Discount > 0)
|
||||
return "LightGreen";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<ServicePhotoDTO> ServiceBitmaps { get; set; } = new ObservableCollection<ServicePhotoDTO>();
|
||||
|
||||
}
|
||||
|
||||
public class ServicePhotoDTO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int ServiceId { get; set; }
|
||||
|
||||
public string PhotoPath { get; set; } = null!;
|
||||
public Avalonia.Media.Imaging.Bitmap Bitmap { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ClientServiceDTO
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string ClientFIO { get; set; }
|
||||
public string Email { get; set; }
|
||||
|
||||
|
||||
public string StartTime { get; set; }
|
||||
|
||||
public string Phone { get; set; }
|
||||
|
||||
public int? RemainingTime { get; set; }
|
||||
public string ColorString {
|
||||
get
|
||||
{
|
||||
if (RemainingTime < 60)
|
||||
return "Red";
|
||||
else
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
14
AvaloniaAppApplication/LoadImagesWindow.axaml
Normal file
14
AvaloniaAppApplication/LoadImagesWindow.axaml
Normal file
@ -0,0 +1,14 @@
|
||||
<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="AvaloniaAppApplication.LoadImagesWindow"
|
||||
Title="LoadImagesWindow">
|
||||
<Grid RowDefinitions="*, *, Auto, *">
|
||||
<Grid HorizontalAlignment="Center">
|
||||
<Button Name="AddImageTB" Content="Добавление" FontWeight="Bold"/>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
13
AvaloniaAppApplication/LoadImagesWindow.axaml.cs
Normal file
13
AvaloniaAppApplication/LoadImagesWindow.axaml.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace AvaloniaAppApplication;
|
||||
|
||||
public partial class LoadImagesWindow : Window
|
||||
{
|
||||
public LoadImagesWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
71
AvaloniaAppApplication/MainWindow.axaml
Normal file
71
AvaloniaAppApplication/MainWindow.axaml
Normal file
@ -0,0 +1,71 @@
|
||||
<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="AvaloniaAppApplication.MainWindow"
|
||||
Title="AvaloniaAppApplication">
|
||||
<Grid ColumnDefinitions="*, 10*, *" RowDefinitions="*, 10*, *">
|
||||
<StackPanel Spacing="3" Grid.Column="1" Orientation="Horizontal">
|
||||
<TextBox Watermark="Поиск" TextChanged="ServiceSearchTextBox_TextChanged" Height="30" Width="190" Name="ServiceSearchTextBox"/>
|
||||
<ComboBox PlaceholderText="Сортировать по" SelectionChanged="ComboPrice_SelectionChanged" Margin="0 6" Height="30" Name="ComboPrice"/>
|
||||
<ComboBox PlaceholderText="Размер скидки" SelectionChanged="ComboDiscount_SelectionChanged" Margin="0 6" Height="30" Name="ComboDiscount"/>
|
||||
</StackPanel>
|
||||
<ListBox Name="ProductListBox" Grid.Column="1" Grid.Row="1">
|
||||
|
||||
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ListBoxItem>
|
||||
|
||||
<ListBoxItem.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Записать на услугу" Click="MenuItem_Click_1"/>
|
||||
</ContextMenu>
|
||||
</ListBoxItem.ContextMenu>
|
||||
<Border BorderThickness="2" BorderBrush="Gray">
|
||||
<Grid ColumnDefinitions="Auto, *">
|
||||
<Image Height="100" Width="200" Source="{Binding ImageBitmap}" Grid.Column="0" />
|
||||
<Grid RowDefinitions="*, *, *, *" Grid.Column="1">
|
||||
<TextBlock Text="{Binding Title}" FontSize="17"/>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Cost}" TextDecorations="Strikethrough" FontSize="17"/>
|
||||
<TextBlock Text="{Binding CostWithDiscount}" Margin="4 0" FontSize="17"/>
|
||||
<TextBlock Text="рублей за" FontSize="17"/>
|
||||
<TextBlock Text="{Binding DurationInMinutes}" Margin="4 0" FontSize="17"/>
|
||||
<TextBlock Text="минут" FontSize="17"/>
|
||||
|
||||
|
||||
|
||||
|
||||
</StackPanel>
|
||||
<TextBlock Background="{Binding DiscountColor}" Grid.Row="2" Text="{Binding Discount, StringFormat='* скидка {0} %'}"/>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="3">
|
||||
<Button Content="Редактировать" Click="EditButton_Click"/>
|
||||
<Button Content="Удалить" Click="DeleteButton_Click"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Border>
|
||||
</ListBoxItem>
|
||||
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<StackPanel Grid.Row="3" Grid.Column="1" Orientation="Horizontal">
|
||||
<Button Name="ViewClosestAppointments" IsVisible="False" Content="Посмотреть ближайшие записи" Click="Button_Click_2"/>
|
||||
<Button Name="AddServiceButton" Content="Добавить сервис" IsVisible="False" Click="AddServiceButton_Click"/>
|
||||
<Button Name="LogOutButton" Content="Выйти" Click="LogOutButton_Click"/>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Margin="0 5" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<TextBlock Name="DisplayedItemsNumber"/>
|
||||
<TextBlock Name="BlankTextBlock" Text=" из "/>
|
||||
<TextBlock Name="TotalItemsNumber"/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
210
AvaloniaAppApplication/MainWindow.axaml.cs
Normal file
210
AvaloniaAppApplication/MainWindow.axaml.cs
Normal file
@ -0,0 +1,210 @@
|
||||
using Avalonia.Controls;
|
||||
using AvaloniaAppApplication.DTO;
|
||||
using AvaloniaAppApplication.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MsBox.Avalonia;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using static System.Net.WebRequestMethods;
|
||||
|
||||
namespace AvaloniaAppApplication
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public List<ServiceDTO> filteredServices = new List<ServiceDTO>();
|
||||
public List<ServiceDTO> servicesList = new List<ServiceDTO>();
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
if (Manager.isAdmin == true)
|
||||
{
|
||||
AddServiceButton.IsVisible = true;
|
||||
ViewClosestAppointments.IsVisible = true;
|
||||
}
|
||||
loadServices();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void loadServices()
|
||||
{
|
||||
servicesList = Manager.context.Services.Select(s =>
|
||||
new ServiceDTO
|
||||
{
|
||||
Id = s.Id,
|
||||
Title = s.Title,
|
||||
Discount = (float?)s.Discount,
|
||||
Description = s.Description,
|
||||
Durationinseconds = s.Durationinseconds,
|
||||
ClientServices = s.Clientservices,
|
||||
Cost = (float)s.Cost,
|
||||
MainImagePath = s.Mainimagepath,
|
||||
ImageBitmap = s.Mainimagepath != null ? new Avalonia.Media.Imaging.Bitmap(AppDomain.CurrentDomain.BaseDirectory.ToString() + s.Mainimagepath.Trim()) : null
|
||||
}).ToList();
|
||||
|
||||
|
||||
var comboPriceList = new List<string>() { "Ïî óìîë÷àíèþ", "Ïî âîçðàñòàíèþ öåíû", "Ïî óáûâàíèþ öåíû" };
|
||||
var comboFilterList = new List<string>() { "Âñå âàðèàíòû", " îò 0 äî 5%", "îò 5% äî 15%", " îò 15% äî 30%", "îò 30% äî 70%", "îò 70% äî 100%" };
|
||||
ComboPrice.ItemsSource = comboPriceList;
|
||||
ComboDiscount.ItemsSource = comboFilterList;
|
||||
ProductListBox.ItemsSource = servicesList;
|
||||
|
||||
DisplayedItemsNumber.Text = servicesList.Count.ToString();
|
||||
TotalItemsNumber.Text = servicesList.Count.ToString();
|
||||
|
||||
ComboDiscount.SelectedIndex = -1;
|
||||
ComboPrice.SelectedIndex = -1;
|
||||
ServiceSearchTextBox.Text = null;
|
||||
|
||||
}
|
||||
|
||||
public void method()
|
||||
{
|
||||
var list = Manager.context.Services.ToList();
|
||||
foreach ( var item in list )
|
||||
{
|
||||
if (item.Discount < 1)
|
||||
item.Discount = item.Discount * 100;
|
||||
}
|
||||
Manager.context.SaveChanges();
|
||||
}
|
||||
private async void AddServiceButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
await new AddEditWindow().ShowDialog(this);
|
||||
loadServices();
|
||||
}
|
||||
|
||||
private void ServiceSearchTextBox_TextChanged(object? sender, Avalonia.Controls.TextChangedEventArgs e)
|
||||
{
|
||||
UpdateListBox();
|
||||
}
|
||||
|
||||
private void ComboPrice_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
UpdateListBox();
|
||||
|
||||
}
|
||||
|
||||
private void ComboDiscount_SelectionChanged(object? sender, Avalonia.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
UpdateListBox();
|
||||
|
||||
}
|
||||
|
||||
public void UpdateListBox()
|
||||
{
|
||||
filteredServices = servicesList;
|
||||
|
||||
// ïîèñê
|
||||
if (!string.IsNullOrEmpty(ServiceSearchTextBox.Text))
|
||||
{
|
||||
string searchText = ServiceSearchTextBox.Text.ToLower().Trim();
|
||||
filteredServices = filteredServices.Where(s => s.Title.ToLower().Trim().Contains(searchText) || s.Description != null && s.Description.ToLower().Trim().Contains(searchText)).ToList();
|
||||
}
|
||||
|
||||
// ôèëüòðàöèÿ
|
||||
if (ComboDiscount.SelectedIndex > 0)
|
||||
{
|
||||
switch (ComboDiscount.SelectedIndex)
|
||||
{
|
||||
case 1:
|
||||
filteredServices = filteredServices.Where(s => s.Discount >= 0 && s.Discount < 5).ToList();
|
||||
break;
|
||||
case 2:
|
||||
filteredServices = filteredServices.Where(s => s.Discount >= 5 && s.Discount < 15).ToList();
|
||||
break;
|
||||
|
||||
case 3:
|
||||
filteredServices = filteredServices.Where(s => s.Discount >= 15 && s.Discount < 30).ToList();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
filteredServices = filteredServices.Where(s => s.Discount >= 30 && s.Discount < 70).ToList();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
filteredServices = filteredServices.Where(s => s.Discount >= 70 && s.Discount < 100).ToList();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ñîðòèðîâêà
|
||||
switch (ComboPrice.SelectedIndex)
|
||||
{
|
||||
case 1:
|
||||
filteredServices = filteredServices.OrderBy(s => s.CostWithDiscount).ToList();
|
||||
break;
|
||||
case 2:
|
||||
filteredServices = filteredServices.OrderByDescending(s => s.CostWithDiscount).ToList();
|
||||
break;
|
||||
}
|
||||
|
||||
ProductListBox.ItemsSource = filteredServices;
|
||||
DisplayedItemsNumber.Text = filteredServices.Count.ToString();
|
||||
TotalItemsNumber.Text = servicesList.Count.ToString();
|
||||
}
|
||||
|
||||
private async void EditButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
if (Manager.isAdmin == false)
|
||||
{
|
||||
var mes = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", "Òîëüêî àäìèíèñòðàòîð ìîæåò ïðàâèòü äàííûå!");
|
||||
var res = await mes.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
var serviceToEdit = (sender as Button).DataContext as ServiceDTO;
|
||||
await new AddEditWindow(serviceToEdit).ShowDialog(this);
|
||||
loadServices();
|
||||
}
|
||||
|
||||
private async void DeleteButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
if (Manager.isAdmin == false)
|
||||
{
|
||||
|
||||
var msss = MessageBoxManager.GetMessageBoxStandard("Îøèáêà!", "Òîëüêî àäìèíèñòðàòîð ìîæåò ïðàâèòü äàííûå!");
|
||||
var bb = await msss.ShowWindowDialogAsync(this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var serviceFressed = (sender as Button).DataContext as ServiceDTO;
|
||||
var serviceToDelete = Manager.context.Services.FirstOrDefault(s => s.Id == serviceFressed.Id);
|
||||
var clientServicesToDelete = Manager.context.Clientservices
|
||||
.Where(cs => cs.Serviceid == serviceToDelete.Id);
|
||||
Manager.context.Clientservices.RemoveRange(clientServicesToDelete);
|
||||
Manager.context.Services.Remove(serviceToDelete);
|
||||
Manager.context.SaveChanges();
|
||||
var mes = MessageBoxManager.GetMessageBoxStandard("OK!", "Èíôîðìàöèÿ óäàëåíà óñïåøíî!");
|
||||
var res = await mes.ShowWindowDialogAsync(this);
|
||||
loadServices();
|
||||
return;
|
||||
}
|
||||
|
||||
private async void LogOutButton_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
|
||||
AuthWindow authW = new AuthWindow();
|
||||
authW.Show();
|
||||
Close();
|
||||
}
|
||||
|
||||
private void MenuItem_Click_1(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
if (Manager.isAdmin == true)
|
||||
{
|
||||
var selectedService = (sender as MenuItem).DataContext as ServiceDTO;
|
||||
if (selectedService != null)
|
||||
new ClientServiceWindow(selectedService).ShowDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click_2(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
new ClientAppointmentsWindow().ShowDialog(this);
|
||||
}
|
||||
}
|
||||
}
|
18
AvaloniaAppApplication/Manager.cs
Normal file
18
AvaloniaAppApplication/Manager.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using Avalonia.Controls;
|
||||
using AvaloniaAppApplication.Context;
|
||||
using AvaloniaAppApplication.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AvaloniaAppApplication
|
||||
{
|
||||
public static class Manager
|
||||
{
|
||||
public static bool isAdmin;
|
||||
public static User19Context context = new User19Context();
|
||||
public static Client currentClient;
|
||||
}
|
||||
}
|
33
AvaloniaAppApplication/Models/Client.cs
Normal file
33
AvaloniaAppApplication/Models/Client.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Client
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Firstname { get; set; } = null!;
|
||||
|
||||
public string Lastname { get; set; } = null!;
|
||||
|
||||
public string? Patronymic { get; set; }
|
||||
|
||||
public DateOnly? Birthday { get; set; }
|
||||
|
||||
public string Registrationdate { get; set; } = null!;
|
||||
|
||||
public string? Email { get; set; }
|
||||
|
||||
public string Phone { get; set; } = null!;
|
||||
|
||||
public char Gendercode { get; set; }
|
||||
|
||||
public string? Photopath { get; set; }
|
||||
|
||||
public virtual ICollection<Clientservice> Clientservices { get; set; } = new List<Clientservice>();
|
||||
|
||||
public virtual Gender GendercodeNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Tag> Tags { get; set; } = new List<Tag>();
|
||||
}
|
23
AvaloniaAppApplication/Models/Clientservice.cs
Normal file
23
AvaloniaAppApplication/Models/Clientservice.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Clientservice
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Clientid { get; set; }
|
||||
|
||||
public int Serviceid { get; set; }
|
||||
|
||||
public string Starttime { get; set; } = null!;
|
||||
|
||||
public string? Comment { get; set; }
|
||||
|
||||
public virtual Client Client { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Productsale> Productsales { get; set; } = new List<Productsale>();
|
||||
|
||||
public virtual Service Service { get; set; } = null!;
|
||||
}
|
13
AvaloniaAppApplication/Models/Documentbyservice.cs
Normal file
13
AvaloniaAppApplication/Models/Documentbyservice.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Documentbyservice
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Clientserviceid { get; set; }
|
||||
|
||||
public string Documentpath { get; set; } = null!;
|
||||
}
|
13
AvaloniaAppApplication/Models/Gender.cs
Normal file
13
AvaloniaAppApplication/Models/Gender.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Gender
|
||||
{
|
||||
public char Code { get; set; }
|
||||
|
||||
public string? Name { get; set; }
|
||||
|
||||
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
|
||||
}
|
15
AvaloniaAppApplication/Models/Manufacturer.cs
Normal file
15
AvaloniaAppApplication/Models/Manufacturer.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Manufacturer
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public DateOnly? Startdate { get; set; }
|
||||
|
||||
public virtual ICollection<Product> Products { get; set; } = new List<Product>();
|
||||
}
|
31
AvaloniaAppApplication/Models/Product.cs
Normal file
31
AvaloniaAppApplication/Models/Product.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Product
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public decimal Cost { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public string? Mainimagepath { get; set; }
|
||||
|
||||
public int Isactive { get; set; }
|
||||
|
||||
public int? Manufacturerid { get; set; }
|
||||
|
||||
public virtual Manufacturer? Manufacturer { get; set; }
|
||||
|
||||
public virtual ICollection<Productphoto> Productphotos { get; set; } = new List<Productphoto>();
|
||||
|
||||
public virtual ICollection<Productsale> Productsales { get; set; } = new List<Productsale>();
|
||||
|
||||
public virtual ICollection<Product> Attachedproducts { get; set; } = new List<Product>();
|
||||
|
||||
public virtual ICollection<Product> Mainproducts { get; set; } = new List<Product>();
|
||||
}
|
15
AvaloniaAppApplication/Models/Productphoto.cs
Normal file
15
AvaloniaAppApplication/Models/Productphoto.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Productphoto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Productid { get; set; }
|
||||
|
||||
public string Photopath { get; set; } = null!;
|
||||
|
||||
public virtual Product Product { get; set; } = null!;
|
||||
}
|
21
AvaloniaAppApplication/Models/Productsale.cs
Normal file
21
AvaloniaAppApplication/Models/Productsale.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Productsale
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public DateTime Saledate { get; set; }
|
||||
|
||||
public int Productid { get; set; }
|
||||
|
||||
public int Quantity { get; set; }
|
||||
|
||||
public int? Clientserviceid { get; set; }
|
||||
|
||||
public virtual Clientservice? Clientservice { get; set; }
|
||||
|
||||
public virtual Product Product { get; set; } = null!;
|
||||
}
|
25
AvaloniaAppApplication/Models/Service.cs
Normal file
25
AvaloniaAppApplication/Models/Service.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Service
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public decimal Cost { get; set; }
|
||||
|
||||
public int Durationinseconds { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public double? Discount { get; set; }
|
||||
|
||||
public string? Mainimagepath { get; set; }
|
||||
|
||||
public virtual ICollection<Clientservice> Clientservices { get; set; } = new List<Clientservice>();
|
||||
|
||||
public virtual ICollection<Servicephoto> Servicephotos { get; set; } = new List<Servicephoto>();
|
||||
}
|
15
AvaloniaAppApplication/Models/Servicephoto.cs
Normal file
15
AvaloniaAppApplication/Models/Servicephoto.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Servicephoto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public int Serviceid { get; set; }
|
||||
|
||||
public string Photopath { get; set; } = null!;
|
||||
|
||||
public virtual Service Service { get; set; } = null!;
|
||||
}
|
15
AvaloniaAppApplication/Models/Tag.cs
Normal file
15
AvaloniaAppApplication/Models/Tag.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AvaloniaAppApplication.Models;
|
||||
|
||||
public partial class Tag
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public string Title { get; set; } = null!;
|
||||
|
||||
public string Color { get; set; } = null!;
|
||||
|
||||
public virtual ICollection<Client> Clients { get; set; } = new List<Client>();
|
||||
}
|
22
AvaloniaAppApplication/Program.cs
Normal file
22
AvaloniaAppApplication/Program.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
|
||||
namespace AvaloniaAppApplication
|
||||
{
|
||||
internal 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();
|
||||
}
|
||||
}
|
18
AvaloniaAppApplication/app.manifest
Normal file
18
AvaloniaAppApplication/app.manifest
Normal 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="AvaloniaAppApplication.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>
|
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Base.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Base.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Controls.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Controls.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Desktop.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Desktop.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Diagnostics.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Diagnostics.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Dialogs.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Dialogs.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Fonts.Inter.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Fonts.Inter.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.FreeDesktop.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.FreeDesktop.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Markup.Xaml.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Markup.Xaml.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Markup.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Markup.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Metal.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Metal.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.MicroCom.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.MicroCom.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Native.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Native.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.OpenGL.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.OpenGL.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Skia.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Skia.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Win32.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.Win32.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.X11.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.X11.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Avalonia.dll
Normal file
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.
@ -0,0 +1,13 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net7.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "7.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Reflection.NullabilityInfoContext.IsSupported": true,
|
||||
"System.Runtime.InteropServices.BuiltInComInterop.IsSupported": true
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/DialogHost.Avalonia.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/DialogHost.Avalonia.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/HarfBuzzSharp.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/HarfBuzzSharp.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Humanizer.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Humanizer.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Markdown.Avalonia.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Markdown.Avalonia.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/MicroCom.Runtime.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/MicroCom.Runtime.dll
Normal file
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.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Mono.TextTemplating.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Mono.TextTemplating.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/MsBox.Avalonia.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/MsBox.Avalonia.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Npgsql.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/Npgsql.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/SkiaSharp.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/SkiaSharp.dll
Normal file
Binary file not shown.
BIN
AvaloniaAppApplication/bin/Debug/net7.0/System.CodeDom.dll
Normal file
BIN
AvaloniaAppApplication/bin/Debug/net7.0/System.CodeDom.dll
Normal file
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
Block a user