Ejemplo n.º 1
0
        private void SnackGrd_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TBikeDAL  MyDAL      = new TBikeDAL();
            int       index      = SnackGrd.Items.IndexOf(SnackGrd.CurrentItem);
            DataTable SnackTable = MyDAL.ShowAllSnackTable();

            if (index == -1)
            {
                index = 0;
            }
            else
            {
                string    SnackID     = Convert.ToString(SnackTable.Rows[index]["SnackID"]).Trim();
                DataTable ResultTable = MyDAL.SelectSnackSalesBySnackID(SnackID);

                TBSnackID.Text = "Sales Details for: " + Convert.ToString(SnackTable.Rows[index]["SnackName"]).Trim();

                SColumn1.Header                    = "Sales ID";
                SColumn1.Binding                   = new Binding("SalesID");
                SColumn2.Header                    = "Booking ID";
                SColumn2.Binding                   = new Binding("BookingID");
                SColumn3.Header                    = "Snack ID";
                SColumn3.Binding                   = new Binding("SnackID");
                SColumn4.Header                    = "Quantity";
                SColumn4.Binding                   = new Binding("Quantity");
                SColumn5.Header                    = "Customer";
                SColumn5.Binding                   = new Binding("Customer");
                SColumn6.Header                    = "Total Price";
                SColumn6.Binding                   = new Binding("TotalPrice");
                SColumn7.Header                    = "Created By";
                SColumn7.Binding                   = new Binding("CreatedBy");
                SColumn8.Header                    = "Created At";
                SColumn8.Binding                   = new Binding("CreatedAt");
                detailSnackGrd.ItemsSource         = ResultTable.DefaultView;
                detailSnackGrd.AutoGenerateColumns = false;
            }
        }