public Form1() { InitializeComponent(); try { myRfidReader = new RFID(); myRfidReader.Tag += new TagEventHandler(RfidReaderTag); } catch (PhidgetException e) { MessageBox.Show(e.Message); } ReadChip(); bar = new BarApp(); connection = new DataHelper(); order = new Order(); connection.connect(); bar.GetAllDrinks(); bar.GetAllSnacks(); getAllSnackFromDb(); getAllDrinksFromDb(); toPay = false; if (bar.CheckEmpty() == 0) { bar.InitializeOrder(order, 777777, 0); } }
public void getAllDrinksFromDb() { int counter = 0; MyButton[] drinksButtons = new MyButton[100]; int wOfButton = 110; //width int hOfButton = 100; //hight Point xy = new Point(10, 10); int space = 130; int maxPossition = 4; List <Drink> tempDrinksList = bar.GetAllDrinks(); int possition; for (int y = 0; y < 3; y++) { for (int x = 0; x < maxPossition; x++) { possition = (y * (maxPossition) + x); drinksButtons[possition] = new MyButton(); drinksButtons[possition].Location = xy; drinksButtons[possition].Price = tempDrinksList[possition].Price; drinksButtons[possition].Text = tempDrinksList[possition].Name; drinksButtons[possition].ProductId1 = tempDrinksList[possition].ProductId; drinksButtons[possition].Image = imageList2.Images[(tempDrinksList[possition].ProductId - 13)]; drinksButtons[possition].Size = new System.Drawing.Size(wOfButton, hOfButton); tabPage2.Controls.Add(drinksButtons[possition]); drinksButtons[possition].Click += new EventHandler(onClick); xy.X += space; counter++; if (counter >= 12) { counter = 0; } } xy.Y += space; xy.X = 10; } }