private void btnCancelOrder_click(object sender, RoutedEventArgs e)
        {
            DataRowView dataRow = (DataRowView)((Button)e.Source).DataContext;

            if (dataRow[0].ToString() == "False")
            {
                int orderId = int.Parse(dataRow[1].ToString());
                if (ServiceOrders.cancelOrder(orderId))
                {
                    String           info      = "successfully cancelled order";
                    String           caption   = "info";
                    MessageBoxButton boxButton = MessageBoxButton.OK;
                    MessageBoxImage  image     = MessageBoxImage.Information;
                    MessageBox.Show(info, caption, boxButton, image);
                    dgOrderHistory.DataContext = ServiceOrders.getCustomerOrderHistoryToDisplay(currentUserEmail).DefaultView;
                }
            }
            else
            {
                String           info      = "you can't cancel a confirmed order";
                String           caption   = "info";
                MessageBoxButton boxButton = MessageBoxButton.OK;
                MessageBoxImage  image     = MessageBoxImage.Information;
                MessageBox.Show(info, caption, boxButton, image);
            }
        }
Example #2
0
        public AdminOrdersWindow()
        {
            InitializeComponent();
            UniversalFunctions.setUpWindow(this);
            btnConfirmOrder.IsEnabled         = false;
            btnSeeUnconfirmedOrders.IsEnabled = false;

            dgOrders.DataContext = ServiceOrders.getOrdersToDisplay();
        }
Example #3
0
        private void btnSelectOrder_Click(object sender, RoutedEventArgs e)
        {
            DataRowView dataRowView = (DataRowView)((Button)e.Source).DataContext;
            int         ID          = int.Parse(dataRowView["ID"].ToString());

            dgOrderSpecs.DataContext = ServiceOrders.getOrderSpecsToDisplay(ID).DefaultView;


            Console.WriteLine("testclick");
        }
Example #4
0
        private void btnConfirmOrder_Click(object sender, RoutedEventArgs e)
        {
            DataRowView data        = (DataRowView)((Button)e.Source).DataContext;
            int         OrderID     = int.Parse(data["OrderID"].ToString());
            Boolean     isSuccesful = ServiceOrders.UpdateIsConfirmed(OrderID);

            if (isSuccesful)
            {
                dgOrderSpecs.DataContext  = null;
                btnConfirmOrder.IsEnabled = false;
                dgOrders.DataContext      = ServiceOrders.getOrdersToDisplay().DefaultView;
            }
            else
            {
                Console.WriteLine("error with confirming order");
            }
        }
Example #5
0
 public static Boolean deleteProduct(int pc)
 {
     if (ServiceOrders.isProductOrederd(pc))
     {
         return(false);
     }
     else
     {
         String cmd = "alter table orderedProducts nocheck constraint all;alter table activeDiscounts nocheck constraint all;delete from products where Code = ('" + pc + "');alter table activeDiscounts check constraint all;alter table orderedProducts check constraint all";
         //   String cmd = "DELETE FROM products WHERE code = ('" + pc + "')";
         if (dbConnection.insertQuery(cmd) == 1)
         {
             return(true);
         }
     }
     return(false);
 }
 private void BtnDeleteProduct_Click(object sender, RoutedEventArgs e)
 {
     if (ServiceOrders.isProductOrederd(productCode))
     {
         MessageBox.Show("can not delete an ordered product", "info", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         if (productCode != -1 && ServiceProducts.deleteProduct(productCode))
         {
             loadProductsToDataGrid();
             clearInputs();
         }
         else
         {
             MessageBox.Show("something went wrong deleting a product", "info", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
 }
Example #7
0
 private void btnSeeAllOrders_Click(object sender, RoutedEventArgs e)
 {
     dgOrders.DataContext = ServiceOrders.getOrdersToDisplay().DefaultView;
 }
 private void btnOrderHistory_Click(object sender, RoutedEventArgs e)
 {
     DataGridProducts.Visibility = Visibility.Hidden;
     dgOrderHistory.Visibility   = Visibility.Visible;
     dgOrderHistory.DataContext  = ServiceOrders.getCustomerOrderHistoryToDisplay(currentUserEmail).DefaultView;
 }
        private void BtnConfirmOrder_Click(object sender, RoutedEventArgs e)
        {
            DataView data = (DataView)DataGridProducts.ItemsSource;

            ServiceOrders.customerConfirmOrder(currentUserEmail, data.ToTable());
        }