Exemplo n.º 1
0
        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataRowView dataRow = (DataRowView)dataGrid1.SelectedItem;
            int         index   = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem);

            if (index == -1)
            {
                index    = 0;
                Category = "";
            }
            TBikeDAL MyDAL = new TBikeDAL();

            if (Category == "Bicycle")
            {
                DataTable ResultTable = MyDAL.ShowAllBikeTable();
                string    BicycleID   = Convert.ToString(ResultTable.Rows[index]["BicycleID"]);

                if (BicycleID != null)
                {
                    InventoryModi mod = new InventoryModi();
                    mod.Show();
                    mod.PopulateDataFromLogin(username);
                    mod.PopulateID(BicycleID, Category, "Modification");
                    this.Close();
                }
            }
            else if (Category == "Snacks")
            {
                DataTable ResultTable = MyDAL.ShowAllSnackTable();
                string    SnackID     = Convert.ToString(ResultTable.Rows[index]["SnackID"]);
                if (SnackID != null)
                {
                    InventoryModi mod = new InventoryModi();
                    mod.Show();
                    mod.PopulateDataFromLogin(username);
                    mod.PopulateID(SnackID, Category, "Modification");
                    this.Close();
                }
            }
        }
Exemplo n.º 2
0
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            //ADD NEW INVENTORY
            TBikeDAL MyDAL = new TBikeDAL();

            if (Category == "Bicycle")
            {
                InventoryModi mod = new InventoryModi();
                mod.Show();
                mod.PopulateDataFromLogin(username);
                mod.PopulateID("", Category, "Add");
                this.Close();
            }
            else if (Category == "Snacks")
            {
                InventoryModi mod = new InventoryModi();
                mod.Show();
                mod.PopulateDataFromLogin(username);
                mod.PopulateID("", Category, "Add");
                this.Close();
            }
        }