master
yarou6 2026-04-16 14:03:27 +10:00
commit e11bd5a5ee
159 changed files with 6623 additions and 0 deletions

View File

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/modules.xml
/.idea.AutoService.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AvaloniaProject">
<option name="projectPerEditor">
<map>
<entry key="AutoService/App.axaml" value="AutoService/AutoService.csproj" />
<entry key="AutoService/Views/MainWindow.axaml" value="AutoService/AutoService.csproj" />
<entry key="AutoService/Views/ReceiptWindow.axaml" value="AutoService/AutoService.csproj" />
<entry key="AutoService/Views/WorksWindow.axaml" value="AutoService/AutoService.csproj" />
</map>
</option>
</component>
</project>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

16
AutoService.sln Normal file
View File

@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoService", "AutoService\AutoService.csproj", "{4521FEC2-AC35-4F3B-82CE-C07700BE4FC7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4521FEC2-AC35-4F3B-82CE-C07700BE4FC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4521FEC2-AC35-4F3B-82CE-C07700BE4FC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4521FEC2-AC35-4F3B-82CE-C07700BE4FC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4521FEC2-AC35-4F3B-82CE-C07700BE4FC7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AActivatorUtilities_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002Econfig_003FJetBrains_003FRider2025_002E2_003Fresharper_002Dhost_003FSourcesCache_003Fc47895ba6b912859c18f6f292c2618bc91575407698ba56ea04290a963ed_003FActivatorUtilities_002Ecs/@EntryIndexedValue">ForceIncluded</s:String></wpf:ResourceDictionary>

16
AutoService/App.axaml Normal file
View File

@ -0,0 +1,16 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="AutoService.App"
xmlns:local="using:AutoService"
RequestedThemeVariant="Default">
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
<Application.DataTemplates>
<local:ViewLocator/>
</Application.DataTemplates>
<Application.Styles>
<FluentTheme/>
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
</Application.Styles>
</Application>

58
AutoService/App.axaml.cs Normal file
View File

@ -0,0 +1,58 @@
using System;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Data.Core;
using Avalonia.Data.Core.Plugins;
using System.Linq;
using AutoService.ViewModels;
using AutoService.Views;
using Avalonia.Markup.Xaml;
using Microsoft.Extensions.DependencyInjection;
namespace AutoService;
public partial class App : Application
{
private readonly IServiceProvider _serviceProvider;
public App(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public override void Initialize()
{
AvaloniaXamlLoader.Load(this);
}
public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
// Avoid duplicate validations from both Avalonia and the CommunityToolkit.
// More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins
DisableAvaloniaDataAnnotationValidation();
var vm = _serviceProvider.GetRequiredService<MainWindowViewModel>();
var win = _serviceProvider.GetRequiredService<MainWindow>();
win.DataContext = vm;
desktop.MainWindow = win;
}
base.OnFrameworkInitializationCompleted();
}
private void DisableAvaloniaDataAnnotationValidation()
{
// Get an array of plugins to remove
var dataValidationPluginsToRemove =
BindingPlugins.DataValidators.OfType<DataAnnotationsValidationPlugin>().ToArray();
// remove each entry found
foreach (var plugin in dataValidationPluginsToRemove)
{
BindingPlugins.DataValidators.Remove(plugin);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

View File

@ -0,0 +1,37 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.4"/>
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.3" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.4"/>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.4"/>
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.4"/>
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.4">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="11.0.0-preview.2.26159.112" />
<PackageReference Include="MySqlConnector" Version="2.5.0" />
</ItemGroup>
<ItemGroup>
<None Remove="appsetting.json" />
<Content Include="appsetting.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -0,0 +1,50 @@
using System;
using Microsoft.Extensions.Options;
using MySqlConnector;
namespace AutoService.DB;
public abstract class BaseRepository : IDisposable
{
protected MySqlConnection connection;
public BaseRepository(IOptions<DataBaseConnection> databaseConnection)
{
connection = new MySqlConnection(databaseConnection.Value.ConnectionString);
}
public bool OpenConnection()
{
try
{
connection.Open();
return true;
}
catch (Exception e)
{
Console.WriteLine(e);
return false;
}
}
public bool CloseConnection()
{
try
{
connection.Close();
return true;
}
catch (Exception e)
{
Console.WriteLine(e);
return false;
}
}
public void Dispose()
{
connection.Dispose();
}
}

View File

@ -0,0 +1,6 @@
namespace AutoService.DB;
public class DataBaseConnection
{
public string ConnectionString { get; set; }
}

View File

@ -0,0 +1,8 @@
namespace AutoService.DB;
public interface IRepository<T> where T : class
{
bool OpenConnection();
bool CloseConnection();
}

View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using AutoService.Models;
using AutoService.Views;
using CommunityToolkit.Mvvm.ComponentModel.__Internals;
using Microsoft.Extensions.Options;
using MySqlConnector;
namespace AutoService.DB.Repository;
public class OrderRep : BaseRepository
{
public OrderRep(IOptions<DataBaseConnection> databaseConnection) : base(databaseConnection)
{
OpenConnection();
}
public bool SendOrders(Order order, List<Work> worksList)
{
string sql =
"INSERT INTO `orders` values (0, @ClientName,@CarModel,@ServiceId,@TotalAmount,@DiscountPercent,@OrderDate)";
string sql2 = "SELECT MAX(id) as id FROM `orders`";
string sql3 = "INSERT INTO `order_items` values(0, @OrderId, @WorkId, @WorkPrice)";
using var transaction = connection.BeginTransaction();
try
{
using var mc = new MySqlCommand(sql, connection, transaction);
mc.Parameters.AddWithValue("@ClientName", order.ClientName);
mc.Parameters.AddWithValue("@CarModel", order.CarModel);
mc.Parameters.AddWithValue("@ServiceId", order.ServiceID);
mc.Parameters.AddWithValue("@TotalAmount", order.TotalAmount);
mc.Parameters.AddWithValue("@DiscountPercent", order.Discount);
mc.Parameters.AddWithValue("@OrderDate", order.OrderDate);
mc.ExecuteNonQuery();
var id = 0;
using (var mc2 = new MySqlCommand(sql2, connection, transaction))
{
using (var reader = mc2.ExecuteReader())
{
while (reader.Read())
{
id = reader.GetInt32("id");
}
}
}
foreach (var work in worksList)
{
using var mc3 = new MySqlCommand(sql3, connection, transaction);
mc3.Parameters.AddWithValue("@OrderId", id);
mc3.Parameters.AddWithValue("@WorkPrice", work.Price);
mc3.Parameters.AddWithValue("@WorkId", work.Id);
mc3.ExecuteNonQuery();
}
transaction.Commit();
return true;
}
catch (Exception ex)
{
Console.WriteLine(ex);
transaction.Rollback();
return false;
}
}
}

View File

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using AutoService.Models;
using Microsoft.Extensions.Options;
using MySqlConnector;
namespace AutoService.DB.Repository;
public class ServicesRepository:BaseRepository
{
public ServicesRepository(IOptions<DataBaseConnection> databaseConnection):base(databaseConnection)
{
OpenConnection();
}
public List<Services> GetServices()
{
List<Services> services = new List<Services>();
string sql = @"SELECT `id`,`title`
FROM `services`";
try
{
using var cmd = new MySqlCommand(sql, connection);
using var reader = cmd.ExecuteReader();
while (reader.Read())
services.Add(new ()
{
Id = reader.GetInt32("id"),
Title = reader.GetString("title"),
});
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return services;
}
public void Dispose()
{
CloseConnection();
}
}

View File

@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using AutoService.Models;
using Microsoft.Extensions.Options;
using MySqlConnector;
namespace AutoService.DB.Repository;
public class WorksRep:BaseRepository
{
public WorksRep(IOptions<DataBaseConnection> databaseConnection):base(databaseConnection)
{
OpenConnection();
}
public List<Work> GetWorks(int serviceID)
{
List<Work> works = new List<Work>();
string sql = @"SELECT *
FROM `works`
WHERE `service_id` = @serviceID";
try
{
using var cmd = new MySqlCommand(sql, connection);
cmd.Parameters.AddWithValue("@serviceID", serviceID);
using var reader = cmd.ExecuteReader();
while (reader.Read())
works.Add(new ()
{
Id = reader.GetInt32("id"),
ServiceID = reader.GetInt32("service_id"),
Name = reader.GetString("work_name"),
Price = reader.GetDecimal("price"),
});
}
catch (Exception e)
{
Console.WriteLine(e);
}
return works;
}
public void Dispose()
{
CloseConnection();
}
}

View File

@ -0,0 +1,14 @@
using System;
namespace AutoService.Models;
public class Order
{
public int Id { get; set; }
public string ClientName { get; set; }
public string CarModel { get; set; }
public int ServiceID { get; set; }
public decimal TotalAmount { get; set; }
public decimal Discount { get; set; }
public DateTime? OrderDate { get; set; }
}

View File

@ -0,0 +1,9 @@
namespace AutoService.Models;
public class OrdersItem
{
public int Id { get; set; }
public int OrderId { get; set; }
public int WorkId { get; set; }
public int WorkPrice { get; set; }
}

View File

@ -0,0 +1,14 @@
using System.Collections.Generic;
namespace AutoService.Models;
public class SelectedWork
{
public Work Work { get; set; }
public bool IsSelected { get; set; }
public SelectedWork(Work work)
{
Work = work;
}
}

View File

@ -0,0 +1,8 @@
namespace AutoService.Models;
public class Services
{
public int Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
}

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace AutoService.Models;
public class Work
{
public int Id { get; set; }
public int ServiceID { get; set; }
public string Name { get; set; }
public decimal Price { get; set; }
}

54
AutoService/Program.cs Normal file
View File

@ -0,0 +1,54 @@
using Avalonia;
using System;
using AutoService.DB;
using AutoService.DB.Repository;
using AutoService.Models;
using AutoService.ViewModels;
using AutoService.Views;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace AutoService;
sealed 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)
{
var host = Host.CreateDefaultBuilder()
.ConfigureAppConfiguration((context, config) =>
{
config.SetBasePath(AppContext.BaseDirectory)
.AddJsonFile("appsetting.json")
.AddEnvironmentVariables();
})
.ConfigureServices((c, s) =>
{
s.Configure<DataBaseConnection>(c.Configuration.GetSection("DataBaseConnection"));
s.AddTransient<MainWindow>();
s.AddTransient<MainWindowViewModel>();
s.AddTransient<ServicesRepository>();
s.AddTransient<WorksWindow>();
s.AddTransient<WorksWindowVM>();
s.AddTransient<WorksRep>();
s.AddTransient<ReceiptWindowVM>();
s.AddTransient<ReceiptWindow>();
s.AddTransient<OrderRep>();
s.AddTransient<Order>();
s.AddTransient<OrdersItem>();
}).Build();
BuildAvaloniaApp(host.Services)
.StartWithClassicDesktopLifetime(args);
}
// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp(IServiceProvider serviceProvider)
=> AppBuilder.Configure(()=> new App(serviceProvider))
.UsePlatformDetect()
.WithInterFont()
.LogToTrace();
}

View File

@ -0,0 +1,30 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using AutoService.ViewModels;
namespace AutoService;
public class ViewLocator : IDataTemplate
{
public Control? Build(object? param)
{
if (param is null)
return null;
var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
var type = Type.GetType(name);
if (type != null)
{
return (Control)Activator.CreateInstance(type)!;
}
return new TextBlock { Text = "Not Found: " + name };
}
public bool Match(object? data)
{
return data is ViewModelBase;
}
}

View File

@ -0,0 +1,64 @@
using System;
using System.Collections.ObjectModel;
using System.Xml;
using AutoService.DB.Repository;
using AutoService.Models;
using AutoService.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
namespace AutoService.ViewModels;
public partial class MainWindowViewModel : ViewModelBase
{
private readonly IServiceProvider _serviceProvider;
[ObservableProperty] private ObservableCollection<Services> _services = new();
private Services _service;
[ObservableProperty] private string _userName;
[ObservableProperty]private string _auto;
[ObservableProperty]private Services _selectedService;
private Order _order;
private Work _work;
private MainWindow _currentWind;
public MainWindowViewModel(IServiceProvider serviceProvider,Order order)
{
_serviceProvider = serviceProvider;
_order = order;
using (var rep = serviceProvider.GetService<ServicesRepository>())
{
Services = new ObservableCollection<Services>(rep.GetServices());
};
SelectedService = Services[0];
}
[RelayCommand]
public void SetWindow(MainWindow window)
{
_currentWind = window;
}
[RelayCommand]
public void StartWorkWindow()
{
_order.ClientName = UserName;
_order.CarModel = Auto;
_order.ServiceID = SelectedService.Id;
var vm = ActivatorUtilities.CreateInstance<WorksWindowVM>(
_serviceProvider,
SelectedService,
_order);
var win = _serviceProvider.GetRequiredService<WorksWindow>();
win.DataContext = vm;
win.Show();
}
}

View File

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using AutoService.DB.Repository;
using AutoService.Models;
using AutoService.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
namespace AutoService.ViewModels;
public partial class ReceiptWindowVM : ViewModelBase
{
private readonly IServiceProvider _serviceProvider;
[ObservableProperty] private List<Work> _worksList;
[ObservableProperty] private decimal _totalAmount;
[ObservableProperty] private int _totalSale;
[ObservableProperty] private decimal _sale;
[ObservableProperty] private decimal _totalSum;
private ReceiptWindow _currentWindow;
private Order _order;
private OrdersItem _ordersItem;
public ReceiptWindowVM(IServiceProvider serviceProvider, List<Work> worksList, Order order, OrdersItem ordersItem)
{
_order = order;
_ordersItem = ordersItem;
_serviceProvider = serviceProvider;
WorksList = new List<Work>(worksList);
TotalSale = 0;
TotalAmount = 0;
Sale = 0;
TotalSum = 0;
Sum();
}
void Sum()
{
foreach (var work in WorksList)
{
TotalAmount += work.Price;
}
if (TotalAmount >= 10000)
{
TotalSale = 10;
Sale = TotalAmount;
Sale *= (decimal)(10 / 100f);
}
else if (TotalAmount >= 5000)
{
TotalSale = 5;
Sale = TotalAmount;
Sale *= (decimal)(5 / 100f);
}
TotalSum = TotalAmount - Sale;
}
public void SetWindow(ReceiptWindow window)
{
_currentWindow = window;
}
[RelayCommand]
void NewOrder()
{
_currentWindow.Close();
var win = _serviceProvider.GetRequiredService<MainWindow>();
win.Show();
}
[RelayCommand]
void Confirm()
{
_order.TotalAmount = TotalAmount;
_order.Discount = TotalSale;
_order.OrderDate = DateTime.Now;
using (var rep = _serviceProvider.GetRequiredService<OrderRep>())
{
rep.SendOrders(_order,_worksList);
}
}
}

View File

@ -0,0 +1,7 @@
using CommunityToolkit.Mvvm.ComponentModel;
namespace AutoService.ViewModels;
public class ViewModelBase : ObservableObject
{
}

View File

@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using AutoService.DB.Repository;
using AutoService.Models;
using AutoService.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.DependencyInjection;
namespace AutoService.ViewModels;
public partial class WorksWindowVM:ViewModelBase
{
private readonly IServiceProvider _serviceProvider;
[ObservableProperty] private ObservableCollection<SelectedWork> _worksList = new();
[ObservableProperty] private Services _selectedService;
[ObservableProperty] private Work _selectedWork;
private Order _order;
private WorksWindow _currentWindow;
public WorksWindowVM(IServiceProvider serviceProvider, Services selectedService, Order order)
{
_serviceProvider = serviceProvider;
_selectedService = selectedService;
_order = order;
using (var rep = serviceProvider.GetService<WorksRep>())
{
WorksList = new ObservableCollection<SelectedWork>(rep.GetWorks(SelectedService.Id).Select(s => new SelectedWork(s)));
}
}
[RelayCommand]
public void StartReceiptWindow()
{
List<Work> worksList = new List<Work>();
foreach (var selectedWork in WorksList)
{
if (selectedWork.IsSelected)
{
worksList.Add(selectedWork.Work);
}
}
var vm = ActivatorUtilities.CreateInstance<ReceiptWindowVM>(
_serviceProvider,
_order,
worksList);
var win = _serviceProvider.GetRequiredService<ReceiptWindow>();
win.DataContext = vm;
vm.SetWindow(win);
win.Show();
}
public void SetWindow(WorksWindow window)
{
_currentWindow = window;
}
[RelayCommand]
void PreviourButton()
{
var win = _serviceProvider.GetRequiredService<MainWindow>();
win.Show();
}
}

View File

@ -0,0 +1,35 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:AutoService.ViewModels"
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="AutoService.Views.MainWindow"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/avalonia-logo.ico"
Width="500"
Height="300"
Title="AutoService"
WindowStartupLocation="CenterScreen">
<Design.DataContext>
<vm:MainWindowViewModel/>
</Design.DataContext>
<StackPanel>
<TextBox Watermark="Name" Text="{Binding UserName }" Width="300"/>
<TextBox Watermark="Auto" Text="{Binding Auto}" Width="300"/>
<StackPanel HorizontalAlignment="Center">
<ComboBox ItemsSource="{Binding Services}" SelectedItem="{Binding SelectedService}" Width="300">
<ComboBox.ItemTemplate>
<DataTemplate>
<Label Content="{Binding Title}"/>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<Button Content="Перейти к работам" HorizontalAlignment="Center" Command="{Binding StartWorkWindowCommand}"/>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,13 @@
using AutoService.ViewModels;
using Avalonia.Controls;
namespace AutoService.Views;
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}

View File

@ -0,0 +1,32 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:AutoService.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="viewModels:ReceiptWindowVM"
x:Class="AutoService.Views.ReceiptWindow"
Width="500"
Height="400"
WindowStartupLocation="CenterScreen"
Title="ReceiptWindow">
<StackPanel>
<DataGrid ItemsSource="{Binding WorksList}">
<DataGrid.Columns>
<DataGridTextColumn Header="Название" Binding="{Binding Name}"/>
<DataGridTextColumn Header="Цена" Binding="{Binding Price}"/>
</DataGrid.Columns>
</DataGrid>
<Label Content="Общая стоимость"/>
<Label Content="{Binding TotalAmount}"/>
<Label Content="Скидка"/>
<Label Content="{Binding Sale}"/>
<Label Content="Итого"/>
<Label Content="{Binding TotalSum}"/>
<StackPanel Orientation="Horizontal">
<Button Content="Новый заказ" Command="{Binding NewOrderCommand}"/>
<Button Content="Подтвердить" Command="{Binding ConfirmCommand}"/>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace AutoService.Views;
public partial class ReceiptWindow : Window
{
public ReceiptWindow()
{
InitializeComponent();
}
}

View File

@ -0,0 +1,30 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:AutoService.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="viewModels:WorksWindowVM"
x:Class="AutoService.Views.WorksWindow"
WindowStartupLocation="CenterScreen"
Height="300"
Width="500"
Title="WorksWindow">
<StackPanel>
<DataGrid ItemsSource="{Binding WorksList}" SelectedItem="{Binding SelectedWork}">
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{Binding IsSelected}" />
<DataGridTextColumn Header="Название работы" Binding="{Binding Work.Name}"/>
<DataGridTextColumn Header="Цена" Binding="{Binding Work.Price}"/>
</DataGrid.Columns>
</DataGrid>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<Button Content="Рассчитать стоимость" Command="{Binding StartReceiptWindowCommand}"/>
<Button Content="Назад" Command="{Binding PreviourButtonCommand}"/>
</StackPanel>
</StackPanel>
</Window>

View File

@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace AutoService.Views;
public partial class WorksWindow : Window
{
public WorksWindow()
{
InitializeComponent();
}
}

18
AutoService/app.manifest Normal file
View 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="AutoService.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>

View File

@ -0,0 +1,5 @@
{
"DataBaseConnection": {
"ConnectionString" :"server=192.168.200.13;userid=student;password=student;database=auto_service_db"
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,13 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.InteropServices.BuiltInComInterop.IsSupported": true,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More