コード例 #1
0
        private void BarbtnPrint_ItemClick(object sender, ItemClickEventArgs e)
        {
            SalesOrder so = (SalesOrder)SalesOrderBindingSource.DataSource;

            if (so.State == CTechCore.Enums.Document.State.New)
            {
                MessageBox.Show("Document was not saved and cannot be printed", "Action not possible.");
                return;
            }
            so.PrintDocument();
        }
コード例 #2
0
        private void BarbtnProcess_ItemClick(object sender, ItemClickEventArgs e)
        {
            gridView1.PostEditor();
            SalesOrder so = SalesOrderBindingSource.DataSource as SalesOrders.SalesOrder;

            if (!so.Validate())
            {
                string errs = string.Join("", so.Errors.Select(s => $"\r\n- {s}"));
                MessageBox.Show($"Please review the following errors in order to save successfully:\r\n {errs}", "Cannot proceed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            DialogResult dlg = MessageBox.Show("Please confirm you want to process.\r\n\r\nNo changes will be allowed afterwards.", "Please Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dlg == DialogResult.Yes)
            {
                so.Process();
                so.PrintDocument();
                so.eMailDocument();
                MessageBox.Show($"Sales Order '{so.DocumentNumber}' processed successfully.", "Processed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                SalesOrderBindingSource.DataSource = new SalesOrder();
            }
        }