private void BuyButton_Click(object sender, EventArgs e) { SetsProductControl product = (sender as Control).Parent as SetsProductControl; //MessageBox.Show("Кнопка " + m.Name + " есть!"); Functions functions = new Functions(); functions.AddBasketProduct(product.ID, 1); if (functions.basketOut == "1") { (Application.OpenForms["MainForm"] as MainForm).basketControl1.ReloadBasket(); } }
public void Display(Functions functions, int i, int id) { //MessageBox.Show(functions.Adress); int stepY = 220; products[i] = new SetsProductControl { ID = id, Title = functions.ProductName, Description = functions.DescriptionGoods, Price = Convert.ToString(functions.Price), Picture = functions.URL_Photo, Location = new Point(24, 28 + stepY * i), Name = "ProductPanel " + id.ToString() }; products[i].productBuy.Click += new EventHandler(this.BuyButton_Click); Controls.Add(products[i]); }