This commit is contained in:
Userok 2024-12-27 15:48:34 +03:00
parent 0db1698097
commit 42f723d759
4 changed files with 34 additions and 9 deletions

View File

@ -8,6 +8,6 @@ public class AppDbContext : DbContext
protected override void OnConfiguring(DbContextOptionsBuilder oB) protected override void OnConfiguring(DbContextOptionsBuilder oB)
{ {
oB.UseSqlServer("Host=45.67.56.214;Port=5421;Username=user16;Password=dZ28IVE5;Database=user16"); oB.UseSqlServer("Server=45.67.56.214,5421;Database=user16;User Id=user16;Password=dZ28IVE5;");
} }
} }

View File

@ -1,8 +1,10 @@
using System; using System;
using System.ComponentModel.DataAnnotations;
namespace Demka_2.Use; namespace Demka_2.Use;
public class Service public class Service
{ {
[Key]
public Guid guid { get; set; } public Guid guid { get; set; }
public string Name { get; set; } public string Name { get; set; }
public string ImagePath { get; set; } public string ImagePath { get; set; }

View File

@ -15,11 +15,11 @@
<TextBlock Text="30-70%" /> <TextBlock Text="30-70%" />
<TextBlock Text="70-100%" /> <TextBlock Text="70-100%" />
</ComboBox.Items> </ComboBox.Items>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="5">
<TextBox Width="200" Watermark="Код администратора..." Name="AdminCodeBox" />
<Button Content="Войти как администратор" Name="AdminLoginButton" Margin="5" />
</StackPanel>
</ComboBox> </ComboBox>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="5">
<TextBox Width="200" Watermark="Код администратора..." Name="AdminCodeBox" />
<Button Content="Войти как администратор" Name="AdminLoginButton" Margin="5" />
</StackPanel>
<Button Content="Сортировка ↑" Name="SortAscButton" Margin="5" /> <Button Content="Сортировка ↑" Name="SortAscButton" Margin="5" />
<Button Content="Сортировка ↓" Name="SortDescButton" /> <Button Content="Сортировка ↓" Name="SortDescButton" />
</StackPanel> </StackPanel>
@ -28,7 +28,7 @@
<Button Content="Добавить услугу" Name="AddServiceButton" Margin="5" /> <Button Content="Добавить услугу" Name="AddServiceButton" Margin="5" />
<Button Content="Редактировать услугу" Name="EditServiceButton" Margin="5" /> <Button Content="Редактировать услугу" Name="EditServiceButton" Margin="5" />
<Button Content="Удалить услугу" Name="DeleteServiceButton" Margin="5" /> <Button Content="Удалить услугу" Name="DeleteServiceButton" Margin="5" />
<Button Content="Открыть форму для добавления товаров" Name="OpenServiceFormWindow" Click="OpenServiceFormWindow_Click" Margin="5" /> <!-- <Button Content="Открыть форму для добавления товаров" Name="OpenServiceFormWindow" Click="OpenServiceFormWindow_Click" Margin="5" />-->
</StackPanel> </StackPanel>
<ListBox Name="ServiceList" Margin="5"> <ListBox Name="ServiceList" Margin="5">
@ -47,6 +47,6 @@
</ListBox.ItemTemplate> </ListBox.ItemTemplate>
</ListBox> </ListBox>
<TextBlock Name="ServiceCountText" DockPanel.Dock="Bottom" Margin="5" HorizontalAlignment="Center" /> <TextBlock Name="ServiceCountText" DockPanel.Dock="Left" Margin="5" HorizontalAlignment="Center" />
</DockPanel> </DockPanel>
</Window> </Window>

View File

@ -5,6 +5,7 @@ using System.Linq;
using Demka_2.Use; using Demka_2.Use;
using System; using System;
using Avalonia.Interactivity; using Avalonia.Interactivity;
using DynamicData;
namespace Demka_2.Views; namespace Demka_2.Views;
@ -70,7 +71,7 @@ public partial class MainWindow : Window
private void LoadServices() private void LoadServices()
{ {
using (var context = new AppDbContext()) /*using (var context = new AppDbContext())
{ {
var services = context.Services.ToList(); var services = context.Services.ToList();
foreach (var service in services) foreach (var service in services)
@ -78,7 +79,29 @@ public partial class MainWindow : Window
Services.Add(service); Services.Add(service);
} }
} }*/
Services.Add(new Service { Name = "Услуга 1", Price = 100, Duration = 30, Discount = 0 });
Services.Add(new Service { Name = "Услуга 2", Price = 200, Duration = 60, Discount = 10 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
Services.Add(new Service { Name = "Услуга 3", Price = 150, Duration = 45, Discount = 20 });
} }
private void UpdateFilteredServices() private void UpdateFilteredServices()