61 lines
1.3 KiB
C#

namespace LDBproject.AdditionalForms;
public partial class BookF : Form
{
private int? _bookID;
public BookF()
{
InitializeComponent();
}
public int ID
{
set
{
try
{
_bookID = value;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "BookF [ Error : wrong data ]", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
}
}
private void SaveBtn_Click(object sender, EventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(TitleTb.Text)
|| GenresChBoxList.CheckedItems.Count == 0
|| StatusCbox.SelectedIndex < 1)
{
throw new Exception("BookF [ Blank spaces were left, not enough information ]");
}
if (_bookID.HasValue)
{
}
else
{
}
Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "BookF [ Error : while saving ]",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void DiscardBtn_Click(object sender, EventArgs e) => Close();
private object CreateBook(int id) { return null; }
}