Exemple #1
0
        private void copyItemsButton_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            SalesOrder    salesOrder    = (SalesOrder)m_order.GetContract <SalesOrder>();
            PurchaseOrder purchaseOrder = (PurchaseOrder)m_order.GetContract <PurchaseOrder>();

            if (salesOrder == null | purchaseOrder == null)
            {
                MessageBox.Show("This order does not contain a sales order and a purchase order",
                                Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (salesOrder.CartItems.Count > 0)
            {
                purchaseOrder.CopyItemsFromSalesOrder(salesOrder);
            }
            else
            {
                salesOrder.CopyItemsFromPurchaseOrder(purchaseOrder);
            }
        }