Session1;EZEZ
This commit is contained in:
parent
a8277c9d7e
commit
6d23bbdf24
51
HistoryOrdersWindow.axaml
Normal file
51
HistoryOrdersWindow.axaml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<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="dmeo040225.HistoryOrdersWindow"
|
||||||
|
x:CompileBindings="False"
|
||||||
|
Title="HistoryOrdersWindow">
|
||||||
|
<Border Background="Bisque">
|
||||||
|
<DockPanel Background="Bisque">
|
||||||
|
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal" Background="Gray" Height="30">
|
||||||
|
<Button Content="Назад" Click="Back_OnClick" Width="120" Background="LightGray" Foreground="Black" HorizontalAlignment="Left" DockPanel.Dock="Left"/>
|
||||||
|
<TextBlock x:Name="TimerText" Foreground="White" Margin="10,5,0,0" HorizontalAlignment="Center"/>
|
||||||
|
<ComboBox VerticalAlignment="Center" Width="100" x:Name="FilterComboboxUsers" SelectionChanged="FilterComboboxUsers_OnSelectionChanged"/>
|
||||||
|
<ComboBox VerticalAlignment="Center" Width="100" x:Name="FilterComboboxServices" SelectionChanged="FilterComboboxServices_OnSelectionChanged"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<ScrollViewer DockPanel.Dock="Top" VerticalScrollBarVisibility="Auto">
|
||||||
|
<ListBox x:Name="ListBoxHistory">
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border BorderBrush="Gray" BorderThickness="1" Padding="5">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
|
<TextBlock Text="{Binding Code}" TextWrapping="Wrap" TextAlignment="Center" />
|
||||||
|
<TextBlock Text="{Binding Orderdata}" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding Status}" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding Status}" TextWrapping="Wrap" TextAlignment="Center"/>
|
||||||
|
<ItemsControl ItemsSource="{Binding ServicesNames}">
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}" TextAlignment="Center"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Border.ContextMenu>
|
||||||
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Сформировать" Click="FormOrder_OnClick"/>
|
||||||
|
</ContextMenu>
|
||||||
|
</Border.ContextMenu>
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
|
</ScrollViewer>
|
||||||
|
</DockPanel>
|
||||||
|
</Border>
|
||||||
|
</Window>
|
162
HistoryOrdersWindow.axaml.cs
Normal file
162
HistoryOrdersWindow.axaml.cs
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Markup.Xaml;
|
||||||
|
using dmeo040225.Models;
|
||||||
|
using dmeo040225.Services;
|
||||||
|
using PdfSharpCore.Drawing;
|
||||||
|
using PdfSharpCore.Pdf;
|
||||||
|
|
||||||
|
namespace dmeo040225;
|
||||||
|
|
||||||
|
public partial class HistoryOrdersWindow : Window
|
||||||
|
{
|
||||||
|
ObservableCollection<Order> Orders = new ObservableCollection<Order>();
|
||||||
|
List<Service> dataSourceServices;
|
||||||
|
List<OrderPresenter> dataSourceOrders;
|
||||||
|
public HistoryOrdersWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
using var context = new DatabaseContext();
|
||||||
|
dataSourceOrders = context.Orders.Select(order => new OrderPresenter
|
||||||
|
{
|
||||||
|
Id = order.Id,
|
||||||
|
Code = order.Code,
|
||||||
|
Orderdata = order.Orderdata,
|
||||||
|
Ordertime = order.Ordertime,
|
||||||
|
UserId = order.UserId,
|
||||||
|
Status = order.Status,
|
||||||
|
Prokattime = order.Prokattime,
|
||||||
|
Services = order.OrdersServices.Select(os => os.Service).ToList(),
|
||||||
|
UserFio = context.Users.FirstOrDefault(u => u.Id == order.UserId).Fio,
|
||||||
|
|
||||||
|
ServicesNames = new ObservableCollection<string>(
|
||||||
|
order.OrdersServices.Select(os => os.Service.Name).ToList()
|
||||||
|
)
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
dataSourceServices = context.Services.Select(order => new Service()).ToList();
|
||||||
|
|
||||||
|
ListBoxHistory.ItemsSource = Orders;
|
||||||
|
FilterComboboxUsers.ItemsSource = context.Users.Select(user => user.Fio).ToList();
|
||||||
|
FilterComboboxServices.ItemsSource = context.Services.Select(service => service.Name).ToList();
|
||||||
|
DisplayServices();
|
||||||
|
|
||||||
|
TimerService.Instance.TimeUpdated += UpdateTimerText;
|
||||||
|
TimerService.Instance.TimerExpired += LogoutUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OrderPresenter() : Order
|
||||||
|
{
|
||||||
|
public List<Service> Services { get; set; } = new();
|
||||||
|
public String UserFio;
|
||||||
|
public ObservableCollection<string> ServicesNames { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisplayServices()
|
||||||
|
{
|
||||||
|
var temp = dataSourceOrders;
|
||||||
|
Orders.Clear();
|
||||||
|
|
||||||
|
if (FilterComboboxUsers.SelectionBoxItem != null)
|
||||||
|
{
|
||||||
|
temp = temp.Where(u => u.UserFio == FilterComboboxUsers.SelectionBoxItem.ToString()).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FilterComboboxServices.SelectionBoxItem != null)
|
||||||
|
{
|
||||||
|
var selectedServiceName = FilterComboboxServices.SelectionBoxItem.ToString();
|
||||||
|
temp = temp.Where(o => o.Services.Any(s => s.Name == selectedServiceName)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var item in temp)
|
||||||
|
{
|
||||||
|
Orders.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FilterComboboxUsers_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
DisplayServices();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FilterComboboxServices_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
DisplayServices();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Back_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateTimerText(TimeSpan time)
|
||||||
|
{
|
||||||
|
TimerText.Text = $"Осталось: {time:mm\\:ss}";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LogoutUser()
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
var mainWindow = new MainWindow();
|
||||||
|
mainWindow.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClosed(EventArgs e)
|
||||||
|
{
|
||||||
|
TimerService.Instance.TimeUpdated -= UpdateTimerText;
|
||||||
|
TimerService.Instance.TimerExpired -= LogoutUser;
|
||||||
|
base.OnClosed(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormOrder_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (ListBoxHistory.SelectedItem is OrderPresenter selectedOrder)
|
||||||
|
{
|
||||||
|
var resultSum = 0;
|
||||||
|
var serviceNames = "";
|
||||||
|
|
||||||
|
using var document = new PdfDocument();
|
||||||
|
var page = document.AddPage();
|
||||||
|
var gfx = XGraphics.FromPdfPage(page);
|
||||||
|
|
||||||
|
var font = new XFont("Arial", 14, XFontStyle.Regular);
|
||||||
|
|
||||||
|
foreach (var service in selectedOrder.Services)
|
||||||
|
{
|
||||||
|
resultSum += int.Parse(service.Cost);
|
||||||
|
serviceNames += service.Name + " ";
|
||||||
|
}
|
||||||
|
|
||||||
|
var lines = new List<string>
|
||||||
|
{
|
||||||
|
$"Дата заказа: {selectedOrder.Orderdata}",
|
||||||
|
$"ID пользователя: {selectedOrder.UserId}",
|
||||||
|
$"Код заказа: {selectedOrder.Code}",
|
||||||
|
$"ФИО пользователя: {selectedOrder.UserFio}",
|
||||||
|
$"Время заказа: {selectedOrder.Ordertime}",
|
||||||
|
$"Услуги: {serviceNames}",
|
||||||
|
$"Итоговая сумма: {resultSum}"
|
||||||
|
};
|
||||||
|
|
||||||
|
double x = 50, y = 50;
|
||||||
|
double lineHeight = 20;
|
||||||
|
|
||||||
|
foreach (var line in lines)
|
||||||
|
{
|
||||||
|
gfx.DrawString(line, font, XBrushes.Black, new XPoint(x, y));
|
||||||
|
y += lineHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), $"Order_{selectedOrder.Id}.pdf");
|
||||||
|
document.Save(filePath);
|
||||||
|
|
||||||
|
Console.WriteLine($"PDF сохранен: {filePath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -61,18 +61,19 @@ public partial class DatabaseContext : DbContext
|
|||||||
|
|
||||||
modelBuilder.Entity<OrdersService>(entity =>
|
modelBuilder.Entity<OrdersService>(entity =>
|
||||||
{
|
{
|
||||||
entity
|
entity.HasKey(e => e.Id).HasName("orders_services_pk");
|
||||||
.HasNoKey()
|
|
||||||
.ToTable("orders_services");
|
|
||||||
|
|
||||||
|
entity.ToTable("orders_services");
|
||||||
|
|
||||||
|
entity.Property(e => e.Id).HasColumnName("id");
|
||||||
entity.Property(e => e.OrderId).HasColumnName("order_id");
|
entity.Property(e => e.OrderId).HasColumnName("order_id");
|
||||||
entity.Property(e => e.ServiceId).HasColumnName("service_id");
|
entity.Property(e => e.ServiceId).HasColumnName("service_id");
|
||||||
|
|
||||||
entity.HasOne(d => d.Order).WithMany()
|
entity.HasOne(d => d.Order).WithMany(p => p.OrdersServices)
|
||||||
.HasForeignKey(d => d.OrderId)
|
.HasForeignKey(d => d.OrderId)
|
||||||
.HasConstraintName("orders_services_order_id_fkey");
|
.HasConstraintName("orders_services_order_id_fkey");
|
||||||
|
|
||||||
entity.HasOne(d => d.Service).WithMany()
|
entity.HasOne(d => d.Service).WithMany(p => p.OrdersServices)
|
||||||
.HasForeignKey(d => d.ServiceId)
|
.HasForeignKey(d => d.ServiceId)
|
||||||
.HasConstraintName("orders_services_service_id_fkey");
|
.HasConstraintName("orders_services_service_id_fkey");
|
||||||
});
|
});
|
||||||
|
@ -21,5 +21,7 @@ public partial class Order
|
|||||||
|
|
||||||
public int Prokattime { get; set; }
|
public int Prokattime { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<OrdersService> OrdersServices { get; set; } = new List<OrdersService>();
|
||||||
|
|
||||||
public virtual User User { get; set; } = null!;
|
public virtual User User { get; set; } = null!;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ public partial class OrdersService
|
|||||||
|
|
||||||
public int ServiceId { get; set; }
|
public int ServiceId { get; set; }
|
||||||
|
|
||||||
|
public int Id { get; set; }
|
||||||
|
|
||||||
public virtual Order Order { get; set; } = null!;
|
public virtual Order Order { get; set; } = null!;
|
||||||
|
|
||||||
public virtual Service Service { get; set; } = null!;
|
public virtual Service Service { get; set; } = null!;
|
||||||
|
@ -12,4 +12,6 @@ public partial class Service
|
|||||||
public string Code { get; set; } = null!;
|
public string Code { get; set; } = null!;
|
||||||
|
|
||||||
public string Cost { get; set; } = null!;
|
public string Cost { get; set; } = null!;
|
||||||
|
|
||||||
|
public virtual ICollection<OrdersService> OrdersServices { get; set; } = new List<OrdersService>();
|
||||||
}
|
}
|
||||||
|
@ -115,15 +115,15 @@ public partial class NewOrder : Window
|
|||||||
context.Orders.Add(newOrder);
|
context.Orders.Add(newOrder);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
|
|
||||||
// foreach (var service in services)
|
foreach (var service in services)
|
||||||
// {
|
{
|
||||||
// var orderService = new OrdersService
|
var orderService = new OrdersService
|
||||||
// {
|
{
|
||||||
// OrderId = newOrder.Id,
|
OrderId = newOrder.Id,
|
||||||
// ServiceId = service.Id
|
ServiceId = service.Id
|
||||||
// };
|
};
|
||||||
// context.OrdersServices.Add(orderService);
|
context.OrdersServices.Add(orderService);
|
||||||
// }
|
}
|
||||||
|
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
LoadOrderId();
|
LoadOrderId();
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
<Window xmlns="https://github.com/avaloniaui"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
||||||
x:Class="dmeo040225.NewOrderWindow"
|
|
||||||
Title="NewOrderWindow">
|
|
||||||
<StackPanel Spacing="5" VerticalAlignment="Center" HorizontalAlignment="Center">
|
|
||||||
<TextBlock Text="ID заказа:"/>
|
|
||||||
<TextBox x:Name="OrderIdTextBox" IsReadOnly="True"/>
|
|
||||||
|
|
||||||
<TextBlock Text="Время проката в минутах:"/>
|
|
||||||
<TextBox x:Name="PeriodTextBox"/>
|
|
||||||
|
|
||||||
<TextBlock Text="Выберите клиента:"/>
|
|
||||||
<ComboBox x:Name="OrderClientComboBox"/>
|
|
||||||
|
|
||||||
<TextBlock Text="Выберите услуги:"/>
|
|
||||||
<ListBox x:Name="OrderServicesListBox" SelectionMode="Multiple"/>
|
|
||||||
|
|
||||||
<Button Content="Сформировать заказ" Click="CreateOrderButton_OnClick"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Window>
|
|
@ -1,158 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Interactivity;
|
|
||||||
using ZXing;
|
|
||||||
using ZXing.Common;
|
|
||||||
using PdfSharpCore.Drawing;
|
|
||||||
using PdfSharpCore.Pdf;
|
|
||||||
using SixLabors.ImageSharp;
|
|
||||||
using SixLabors.ImageSharp.PixelFormats;
|
|
||||||
using SixLabors.ImageSharp.Processing;
|
|
||||||
using dmeo040225.Models;
|
|
||||||
using dmeo040225.Models;
|
|
||||||
|
|
||||||
namespace dmeo040225;
|
|
||||||
|
|
||||||
public partial class NewOrderWindow : Window
|
|
||||||
{
|
|
||||||
public List<string> OrderServicesList { get; }
|
|
||||||
public List<string> OrderClientsList { get; }
|
|
||||||
|
|
||||||
public NewOrderWindow()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
LoadOrderId();
|
|
||||||
using var context = new DatabaseContext();
|
|
||||||
|
|
||||||
OrderClientsList = context.Users.Select(it => it.Fio).ToList();
|
|
||||||
OrderClientComboBox.ItemsSource = OrderClientsList;
|
|
||||||
|
|
||||||
OrderServicesList = context.Services.Select(it => it.Name).ToList();
|
|
||||||
OrderServicesListBox.ItemsSource = OrderServicesList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LoadOrderId()
|
|
||||||
{
|
|
||||||
using var context = new DatabaseContext();
|
|
||||||
var maxId = context.Orders.Any() ? context.Orders.Max(order => order.Id) : 0;
|
|
||||||
var newOrderId = maxId + 1;
|
|
||||||
OrderIdTextBox.Text = newOrderId.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateOrderButton_OnClick(object? sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
using var context = new DatabaseContext();
|
|
||||||
|
|
||||||
var maxId = context.Orders.Any() ? context.Orders.Max(order => order.Id) : 0;
|
|
||||||
var newOrderId = maxId + 1;
|
|
||||||
var newCodeOrder = $"{newOrderId}/{DateTime.Now:dd.MM.yyyy}";
|
|
||||||
var newPeriod = int.TryParse(PeriodTextBox.Text, out int period) ? period : 0;
|
|
||||||
|
|
||||||
var selectedClientFio = OrderClientComboBox.SelectedItem as string;
|
|
||||||
if (string.IsNullOrEmpty(selectedClientFio))
|
|
||||||
{
|
|
||||||
Console.WriteLine("Выберите клиента!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var client = context.Users.FirstOrDefault(it => it.Fio == selectedClientFio);
|
|
||||||
if (client == null)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Ошибка: клиент не найден!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selectedServices = OrderServicesListBox.SelectedItems.Cast<string>().ToList();
|
|
||||||
if (selectedServices.Count == 0)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Выберите хотя бы одну услугу!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var services = context.Services.Where(s => selectedServices.Contains(s.Name)).ToList();
|
|
||||||
|
|
||||||
var newOrder = new Order
|
|
||||||
{
|
|
||||||
Id = newOrderId,
|
|
||||||
Code = newCodeOrder,
|
|
||||||
Orderdata = DateTime.Now,
|
|
||||||
Ordertime = TimeOnly.FromDateTime(DateTime.Now),
|
|
||||||
UserId = client.Id,
|
|
||||||
Status = "Открыт",
|
|
||||||
Prokattime = newPeriod
|
|
||||||
};
|
|
||||||
|
|
||||||
context.Orders.Add(newOrder);
|
|
||||||
context.SaveChanges();
|
|
||||||
|
|
||||||
foreach (var service in services)
|
|
||||||
{
|
|
||||||
var orderService = new OrdersService
|
|
||||||
{
|
|
||||||
OrderId = newOrder.Id,
|
|
||||||
ServiceId = service.Id
|
|
||||||
};
|
|
||||||
context.OrdersServices.Add(orderService);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.SaveChanges();
|
|
||||||
LoadOrderId();
|
|
||||||
|
|
||||||
Console.WriteLine("Заказ создан");
|
|
||||||
|
|
||||||
GenerateBarcodeAndSavePdf(newOrderId, DateTime.Now, newPeriod);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GenerateBarcodeAndSavePdf(int orderId, DateTime orderDate, int rentalPeriod)
|
|
||||||
{
|
|
||||||
var random = new Random();
|
|
||||||
string uniqueCode = string.Concat(Enumerable.Range(0, 6).Select(_ => random.Next(0, 10)));
|
|
||||||
|
|
||||||
string barcodeData = $"{orderId}{orderDate:ddMMyy}{rentalPeriod}{uniqueCode}";
|
|
||||||
|
|
||||||
var writer = new BarcodeWriterPixelData
|
|
||||||
{
|
|
||||||
Format = BarcodeFormat.CODE_128,
|
|
||||||
Options = new EncodingOptions
|
|
||||||
{
|
|
||||||
Height = 229,
|
|
||||||
Width = 350,
|
|
||||||
Margin = 0
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var pixelData = writer.Write(barcodeData);
|
|
||||||
|
|
||||||
using var image = new Image<Rgba32>(pixelData.Width, pixelData.Height);
|
|
||||||
image.Mutate(ctx =>
|
|
||||||
{
|
|
||||||
for (int y = 0; y < pixelData.Height; y++)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < pixelData.Width; x++)
|
|
||||||
{
|
|
||||||
byte value = pixelData.Pixels[(y * pixelData.Width + x) * 4];
|
|
||||||
image[x, y] = new Rgba32(value, value, value, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
using var ms = new MemoryStream();
|
|
||||||
image.SaveAsPng(ms);
|
|
||||||
ms.Position = 0;
|
|
||||||
|
|
||||||
using var document = new PdfDocument();
|
|
||||||
var page = document.AddPage();
|
|
||||||
var gfx = XGraphics.FromPdfPage(page);
|
|
||||||
|
|
||||||
using var img = XImage.FromStream(() => new MemoryStream(ms.ToArray()));
|
|
||||||
gfx.DrawImage(img, 10, 10, 150, 50);
|
|
||||||
|
|
||||||
gfx.DrawString(barcodeData, new XFont("Arial", 10), XBrushes.Black, new XPoint(10, 70));
|
|
||||||
|
|
||||||
string filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), $"Order_{orderId}.pdf");
|
|
||||||
document.Save(filePath);
|
|
||||||
Console.WriteLine($"PDF сохранен: {filePath}");
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,6 +17,7 @@
|
|||||||
<TextBlock x:Name="FioName" Foreground="Black"/>
|
<TextBlock x:Name="FioName" Foreground="Black"/>
|
||||||
<TextBlock x:Name="RoleName" Foreground="Black"/>
|
<TextBlock x:Name="RoleName" Foreground="Black"/>
|
||||||
<Button Content="Сформировать заказ" Click="NewOrder_OnClick" Background="LightGray" Width="170"/>
|
<Button Content="Сформировать заказ" Click="NewOrder_OnClick" Background="LightGray" Width="170"/>
|
||||||
|
<Button Content="История заказов" Click="HistoryOrder_OnClick" Background="LightGray" Width="170"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
@ -50,13 +50,17 @@ public partial class SellerWindow : Window
|
|||||||
NewOrder newOrder = new NewOrder();
|
NewOrder newOrder = new NewOrder();
|
||||||
newOrder.ShowDialog(this);
|
newOrder.ShowDialog(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void HistoryOrder_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
HistoryOrdersWindow historyOrdersWindow = new HistoryOrdersWindow();
|
||||||
|
historyOrdersWindow.ShowDialog(this);
|
||||||
|
}
|
||||||
|
|
||||||
private void Back_OnClick(object? sender, RoutedEventArgs e)
|
private void Back_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
TimerService.Instance.Reset();
|
TimerService.Instance.Reset();
|
||||||
Close();
|
Close();
|
||||||
// MainWindow mainWindow = new MainWindow();
|
|
||||||
// mainWindow.Show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnClosed(EventArgs e)
|
protected override void OnClosed(EventArgs e)
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
dcee2ff9ab40261eababb0bda80a1213a097f630882dc250b9c305771c0c60e5
|
f68245289585a316c95c6a0242ee82c924ad78226a6ee4e9159c267738ab4ad4
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("dmeo040225")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("dmeo040225")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9425badd58264bf54d3df7b654468fb3dae859ad")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a8277c9d7e311c951210e8ad35e67aecd086b064")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("dmeo040225")]
|
[assembly: System.Reflection.AssemblyProductAttribute("dmeo040225")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("dmeo040225")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("dmeo040225")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
@ -1 +1 @@
|
|||||||
b11ea1593792717964ae904d80c98bb22d4fc3dfa03cb4c0d43a71cbebe1429f
|
e1a77b8fdfe801510641ec14b3733bcc12e9d5034f11027fcc8d1ef274e02dc3
|
||||||
|
@ -31,6 +31,9 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
|||||||
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/GetOrderWindow.axaml]
|
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/GetOrderWindow.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
|
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/HistoryOrdersWindow.axaml]
|
||||||
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/HistoryWindow.axaml]
|
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/HistoryWindow.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
@ -40,9 +43,6 @@ build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
|||||||
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/NewOrder.axaml]
|
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/NewOrder.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/NewOrderWindow.axaml]
|
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
|
||||||
|
|
||||||
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/OlderWindow.axaml]
|
[/Users/rinchi/RiderProjects/dmeo040225/dmeo040225/OlderWindow.axaml]
|
||||||
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
build_metadata.AdditionalFiles.SourceItemGroup = AvaloniaXaml
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
8b5634db08a8828528f53df4df6209bd6d04c5d6962844fc6083067c58d2ad06
|
3d1af8b94265d0f974c99c7ade78a323d9abeff7a6afeeeb9b7f8c80a3981b0b
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1 +1 @@
|
|||||||
17409191325846449
|
17409191358158990
|
Loading…
Reference in New Issue
Block a user