2024-11-19 14:49:58 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using ProjectLibrary.Entites;
|
|
|
|
|
|
|
|
|
|
namespace ProjectLibrary.Forms
|
|
|
|
|
{
|
|
|
|
|
public partial class FBook_Orders : Form
|
|
|
|
|
{
|
|
|
|
|
private Book_Orders _bookOrders;
|
|
|
|
|
|
|
|
|
|
public FBook_Orders(Book_Orders bookOrders)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_bookOrders = bookOrders;
|
|
|
|
|
LoadOrderData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadOrderData()
|
|
|
|
|
{
|
|
|
|
|
txtBookID.Text = _bookOrders.BookID.ToString();
|
|
|
|
|
txtOrderID.Text = _bookOrders.OrderID.ToString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Создание новой сущности с обновленными данными
|
|
|
|
|
var updatedBookOrders = Book_Orders.CreateEntity(
|
|
|
|
|
int.Parse(txtBookID.Text),
|
|
|
|
|
int.Parse(txtOrderID.Text)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Обновление внутренней переменной
|
|
|
|
|
_bookOrders = updatedBookOrders;
|
|
|
|
|
|
|
|
|
|
MessageBox.Show("Данные успешно сохранены!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void buttonCancel_Click_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2024-11-19 15:04:19 +04:00
|
|
|
|
// Закрытие формы без сохранения
|
|
|
|
|
this.Close();
|
2024-11-19 14:49:58 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|