| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using Quadarax.Foundation.Core.IO;
- using System.IO.Abstractions;
- namespace qdr.app.studiou.orders2printpack
- {
- public partial class dlgProtocol : Form
- {
- #region *** Properties ***
- public string ExternalOrder => tbExternalOrder.Text;
- public DateTime ExternalOrderDate => dtExternaOrderDate.Value;
- public string ProtocolFile => tbProtocolFile.Text;
- #endregion
- #region *** Fields ***
- private readonly IFileSystem _fs = new FileSystem();
- #endregion
- #region *** Contructor ***
- public dlgProtocol()
- {
- InitializeComponent();
- }
- #endregion
- #region *** Form Handlers ***
- private void dlgProtocol_Load(object sender, EventArgs e)
- {
- tbExternalOrder.Text = string.Empty;
- tbProtocolFile.Text = string.Empty;
- }
- private void butOk_Click(object sender, EventArgs e)
- {
- if(tbExternalOrder.Text.Trim().Length == 0)
- {
- MessageBox.Show("Zadejte číslo externí objednávky", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- tbExternalOrder.Focus();
- return;
- }
- if(tbProtocolFile.Text.Trim().Length == 0)
- {
- MessageBox.Show("Zadejte název souboru protokolu (*.csv)", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- butOpenProt.Focus();
- return;
- }
- DialogResult = DialogResult.OK;
- Close();
- }
- private void butCancel_Click(object sender, EventArgs e)
- {
- DialogResult = DialogResult.Cancel;
- Close();
- }
- private void butOpenProt_Click(object sender, EventArgs e)
- {
- dlgSave.FileName = FileUtils.SanitizedFileName(_fs, $"protocol_border_{tbExternalOrder.Text}.csv", "_");
- if (dlgSave.ShowDialog() == DialogResult.OK)
- {
- tbProtocolFile.Text = dlgSave.FileName;
- }
- }
- #endregion
- }
- }
|