50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
using LDBproject.Reports;
|
|
using Unity;
|
|
namespace LDBproject.AdditionalForms;
|
|
|
|
public partial class FullReportsF : Form
|
|
{
|
|
|
|
private readonly IUnityContainer _container;
|
|
|
|
public FullReportsF(IUnityContainer container)
|
|
{
|
|
InitializeComponent();
|
|
_container = container ?? throw new ArgumentNullException(nameof(container));
|
|
}
|
|
|
|
private void ConfBuildBtn_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (!BookChBox.Checked && !EmployeeChBox.Checked && !ReadersChBox.Checked)
|
|
{
|
|
throw new Exception("There are no options chosen [!]");
|
|
}
|
|
|
|
var sfd = new SaveFileDialog()
|
|
{
|
|
Filter = "Docx Files | *.docx"
|
|
};
|
|
|
|
if (sfd.ShowDialog() != DialogResult.OK)
|
|
{
|
|
throw new Exception("No file chosen [!]");
|
|
}
|
|
|
|
if (_container.Resolve<DocReport>().CreateDoc(sfd.FileName, BookChBox.Checked, EmployeeChBox.Checked, ReadersChBox.Checked))
|
|
{
|
|
MessageBox.Show("< The DOCument was made : Report done >", "Process result", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("< ERROR : see logs >", "Document creation", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "< ERROR : while creating report >", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
}
|