39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using Avalonia.Controls;
|
||
using Avalonia.Interactivity;
|
||
using demo_hard.Models;
|
||
|
||
namespace demo_hard;
|
||
|
||
public partial class NewOrderWindow : Window
|
||
{
|
||
|
||
public NewOrderWindow()
|
||
{
|
||
InitializeComponent();
|
||
}
|
||
public NewOrderWindow(string OrderNumber, Client client, List<Service> selectedServices )
|
||
{
|
||
InitializeComponent();
|
||
OrderNumberText.Text = OrderNumber;
|
||
ClientCode.Text = client.ClientCode.ToString();
|
||
TimeOrder.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
|
||
FIO.Text = client.Fio;
|
||
Address.Text = client.Address;
|
||
ServicesList.ItemsSource = selectedServices.Select(it => it.ServiceName).ToList();
|
||
var totalcost = selectedServices.Sum(it =>
|
||
{
|
||
var serviceCost = decimal.TryParse(it.ServiceCost, out var cost) ? cost : 0;
|
||
return cost;
|
||
});
|
||
Cost.Text = $"{totalcost}.00 руб.";
|
||
|
||
}
|
||
|
||
private void ButtonBack_OnClick(object? sender, RoutedEventArgs e)
|
||
{
|
||
new OrderWindow().ShowDialog(this);
|
||
}
|
||
} |