ProjectLib/ProjectLibrary/Forms/FTicket_Extension.cs

50 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Windows.Forms;
using ProjectLibrary.Entites;
using ProjectLibrary.Entities;
namespace ProjectLibrary.Forms
{
public partial class FTicket_Extension : Form
{
private TicketExtensions _ticketExtensions;
public FTicket_Extension(TicketExtensions ticketExtensions)
{
InitializeComponent();
_ticketExtensions = ticketExtensions;
LoadTicketExtensionData();
}
private void LoadTicketExtensionData()
{
txtReaderID.Text = _ticketExtensions.ReaderID.ToString();
txtExtensionID.Text = _ticketExtensions.ExtensionID.ToString();
txtLastUpdateDate.Text = _ticketExtensions.LastUpdateDate.ToShortDateString();
txtNextUpdateDate.Text = _ticketExtensions.NextUpdateDate.ToShortDateString();
}
private void btnSave_Click(object sender, EventArgs e)
{
// Создание новой сущности с обновленными данными
var updatedTicketExtensions = TicketExtensions.CreateEntity(
int.Parse(txtReaderID.Text),
int.Parse(txtExtensionID.Text),
DateTime.Parse(txtLastUpdateDate.Text),
DateTime.Parse(txtNextUpdateDate.Text)
);
// Обновление внутренней переменной
_ticketExtensions = updatedTicketExtensions;
MessageBox.Show("Данные успешно сохранены!");
}
private void buttonCancel_Click_Click(object sender, EventArgs e)
{
// Закрытие формы без сохранения
this.Close();
}
}
}