Ejemplo n.º 1
0
        private void BarbtnSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            gridView1.PostEditor();
            SalesOrder SO = (SalesOrder)SalesOrderBindingSource.DataSource;

            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;
            }

            if (SO.Save())
            {
                MessageBox.Show($"Sales Order '{SO.DocumentNumber}' saved successfully.", "Processed", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("An error has occured and details could not be saved. \r\n\r\nTry again or contact support for assistance.");
            }
        }
Ejemplo n.º 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();
            }
        }