лаб4 upd

This commit is contained in:
Артем Харламов 2023-12-12 22:12:29 +04:00
parent e7a226e28c
commit 109bbe518a
11 changed files with 36 additions and 32 deletions

View File

@ -33,7 +33,41 @@ namespace Library
public UserControl GetControl
{
get { return _controlDataTable; }
get
{
Load();
return _controlDataTable;
}
}
private void Load()
{
_controlDataTable.TableConfiguration(5, new List<TableParameters>
{
new TableParameters("Id", 80, false, "Id"),
new TableParameters("Название", 100, true, "Name"),
new TableParameters("Автор", 180, true, "Author"),
new TableParameters("Обложка", 80, false, "PicturePath"),
new TableParameters("Дата издания", 150, true, "PublicationDate")
});
LoadData();
}
private void LoadData()
{
try
{
_controlDataTable.ClearRows();
var list = _bookLogic.Read(null);
foreach (var row in list)
{
_controlDataTable.AddRow(row);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
public PluginsConvention()
@ -87,37 +121,7 @@ namespace Library
public void ReloadData()
{
try
{
var list = _bookLogic.Read(null);
if (list != null)
{
_controlDataTable.ClearRows();
_controlDataTable.TableConfiguration(5, new List<TableParameters>
{
new TableParameters("Id", 80, false, "Id"),
new TableParameters("Название", 100, true, "Name"),
new TableParameters("Автор", 180, true, "Author"),
new TableParameters("Обложка", 80, false, "PicturePath"),
new TableParameters("Дата издания", 150, true, "PublicationDate")
});
foreach (var row in list)
{
_controlDataTable.AddRow(row);
}
}
}
catch (Exception ex)
{
MessageBox.Show(
ex.Message,
"Ошибка",
MessageBoxButtons.OK,
MessageBoxIcon.Error
);
}
LoadData();
}
public bool CreateSimpleDocument(PluginsConventionSaveDocument saveDocument)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.