2024-11-19 14:49:58 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
using ProjectLibrary.Entities;
|
|
|
|
|
|
|
|
|
|
namespace ProjectLibrary.Forms
|
|
|
|
|
{
|
|
|
|
|
public partial class FReader : Form
|
|
|
|
|
{
|
|
|
|
|
private Reader _reader;
|
|
|
|
|
|
|
|
|
|
public FReader(Reader reader)
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
_reader = reader;
|
|
|
|
|
LoadReaderData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void LoadReaderData()
|
|
|
|
|
{
|
|
|
|
|
txtId.Text = _reader.Id.ToString();
|
|
|
|
|
txtName.Text = _reader.Name;
|
|
|
|
|
txtReaderTicket.Text = _reader.ReaderTicket.ToString();
|
|
|
|
|
txtRegistrationDate.Text = _reader.RegistrationDateRT.ToShortDateString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void btnSave_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
// Создание новой сущности с обновленными данными
|
|
|
|
|
var updatedReader = Reader.CreateEntity(
|
|
|
|
|
int.Parse(txtId.Text),
|
|
|
|
|
txtName.Text,
|
|
|
|
|
int.Parse(txtReaderTicket.Text),
|
|
|
|
|
DateTime.Parse(txtRegistrationDate.Text)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// Обновление внутренней переменной
|
|
|
|
|
_reader = updatedReader;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|