public void LinkToSnackWindow() { TBikeDAL MyDAL = new TBikeDAL(); int index = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem); DataTable ResultTable = MyDAL.ShowAllSnackTable(); if (index == -1) { index = 0; } else { string SnackID = Convert.ToString(ResultTable.Rows[index]["SnackID"]); string Status = Convert.ToString(ResultTable.Rows[index]["SnackStatus"]); InventoryModi modi = new InventoryModi(); modi.PopulateDataFromLogin(username); modi.PopulateID(SnackID, "Snacks", "Modification"); modi.ShowDialog(); } }
public void LinkToBicycleWindow() { TBikeDAL MyDAL = new TBikeDAL(); int index = dataGrid1.Items.IndexOf(dataGrid1.CurrentItem); DataTable ResultTable = MyDAL.ShowAllBikeTable(); if (index == -1) { index = 0; } else { string BicycleID = Convert.ToString(ResultTable.Rows[index]["BicycleID"]); string Status = Convert.ToString(ResultTable.Rows[index]["BicycleStatus"]); if (Status == "M") { Service ret = new Service(); ret.PopulateDataFromLogin(username); ret.PopulateID(BicycleID, Status); ret.ShowDialog(); } else if (Status == "I") { Service ret = new Service(); ret.PopulateDataFromLogin(username); ret.PopulateID(BicycleID, Status); ret.ShowDialog(); } else { InventoryModi mod = new InventoryModi(); mod.PopulateDataFromLogin(username); mod.PopulateID(BicycleID, "Bicycle", "Modification"); mod.ShowDialog(); } } }