Blagodat/OknaRoley/StarshiyWindow.axaml.cs

66 lines
1.5 KiB
C#
Raw Normal View History

2025-02-11 10:23:14 +00:00
using Avalonia.Controls;
using Avalonia.Interactivity;
2025-04-25 07:00:58 +00:00
using Demka_Snova_1.Hardik.Conect;
2025-03-05 09:12:58 +00:00
using Demka_Snova_1.Hardik.Conect.Dao;
using Demka_Snova_1.OknaFunciy;
using System.Collections.Generic;
2025-02-11 10:23:14 +00:00
namespace Demka_Snova_1.OknaRoley;
public partial class StarshiyWindow : Window
{
2025-03-05 09:12:58 +00:00
private List<ordersDao> ordersList;
2025-02-11 10:23:14 +00:00
public StarshiyWindow()
{
InitializeComponent();
2025-04-25 07:00:58 +00:00
LoadOrders();
}
2025-03-05 09:12:58 +00:00
2025-04-25 07:00:58 +00:00
private void LoadOrders()
{
using (var db = new DatabaseConnection())
{
var orders = db.GetAllOrders();
OrdersListBox.ItemsSource = orders;
}
2025-03-05 09:12:58 +00:00
}
private void FormatZakaz_Click(object sender, RoutedEventArgs e)
{
var login = new AddZakazWindow();
login.Show();
this.Close();
}
private void PrinatZakaz_Click(object sender, RoutedEventArgs e)
{
var selectedOrder = OrdersListBox.SelectedItem as ordersDao;
if (selectedOrder != null)
{
selectedOrder.Status = "<22> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
else
{
ShowError("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.");
}
}
2025-05-07 11:41:56 +00:00
private void Exitka(object sender, RoutedEventArgs e) // <20><><EFBFBD><EFBFBD><EFBFBD>
2025-03-05 09:12:58 +00:00
{
var login = new MainWindow();
login.Show();
this.Close();
2025-02-11 10:23:14 +00:00
}
2025-03-05 09:12:58 +00:00
async void ShowError(string mes)
{
var dialog = new Window
{
Title = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",
Content = mes,
Width = 300,
Height = 200
};
await dialog.ShowDialog(this);
2025-02-11 10:23:14 +00:00
}
}