示例#1
0
        private void btnAssign_Click(object sender, RoutedEventArgs e)
        {
            if (lstEmployees.SelectedIndex == -1 || lstOrders.SelectedIndex == -1)
            {
                MessageBox.Show("Please select both an employee and an order", "Error");
            }
            else
            {
                try
                {
                    selectedEmployee = (UserModel)lstEmployees.SelectedItem;
                    selectedOrder    = (OrderModel)lstOrders.SelectedItem;

                    OrderProcessor.AssignEmployeeToOrder(selectedEmployee.UserID, selectedOrder.OrderID, currentUser.Token);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }