private void Show_Order_Click(object sender, RoutedEventArgs e)
        {
            DBMS      dbms = new DBMS();
            DataTable dt   = new DataTable();

            dt = dbms.DisplayOrders();
            Orders.ItemsSource = dt.DefaultView;
        }
Пример #2
0
        private void Show_Orders_Click(object sender, RoutedEventArgs e)
        {
            DBMS      dbms = new DBMS();
            DataTable dt   = new DataTable();

            if (Orders.Columns.Count == 7 || Orders.Columns.Count == 0)
            {
                DataGridTemplateColumn col1 = new DataGridTemplateColumn();
                col1.Header = "Refund";

                FrameworkElementFactory factory1 = new FrameworkElementFactory(typeof(Button));
                factory1.SetValue(Button.ContentProperty, "Refund");
                factory1.AddHandler(Button.ClickEvent, new RoutedEventHandler(RefundBtn_Click));
                DataTemplate cellTemplate1 = new DataTemplate();
                cellTemplate1.VisualTree = factory1;
                col1.CellTemplate        = cellTemplate1;
                Orders.Columns.Add(col1);
            }
            dt = dbms.DisplayOrders();
            Orders.ItemsSource = dt.DefaultView;
        }