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)
{
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.ComponentModel.DataAnnotations;
namespace Demka_2.Use;
public class Service
{
[Key]
public Guid guid { get; set; }
public string Name { get; set; }
public string ImagePath { get; set; }

View File

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

View File

@ -5,6 +5,7 @@ using System.Linq;
using Demka_2.Use;
using System;
using Avalonia.Interactivity;
using DynamicData;
namespace Demka_2.Views;
@ -70,7 +71,7 @@ public partial class MainWindow : Window
private void LoadServices()
{
using (var context = new AppDbContext())
/*using (var context = new AppDbContext())
{
var services = context.Services.ToList();
foreach (var service in services)
@ -78,7 +79,29 @@ public partial class MainWindow : Window
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()