private void DeleteOrder_Click(object sender, EventArgs e) { UserOrderControl order = (sender as Control).Parent as UserOrderControl; Functions functions = new Functions(); functions.DeleteOrder(order.IdLable); (Application.OpenForms["MainForm"] as MainForm).ordersControl1.ReloadOrders(); }
public void Display(int i, string id, string NameSurname, string NumerOrders, string NameProducts, string CountOrders, string DateOrders, string TypeOfPayments) { int stepY = 30; orders[i] = new UserOrderControl { IdLable = Convert.ToInt32(id), Id = Convert.ToString(i + 1), NameSurname = NameSurname, NumOrder = NumerOrders, CountProd = CountOrders, TypeOfPay = TypeOfPayments, DateOrd = DateOrders, Location = new Point(24, 55 + stepY * i), Name = "ProductPanel " + id.ToString() }; //orders[i].productBuy.Click += new EventHandler(this.BuyButton_Click); Controls.Add(orders[i]); }