private void button1_Click(object sender, EventArgs e) { OrderItem.getInstance().Refresh(); string name = menuNameL.Text; int price; //중복체크 for (int i = 0; i < MainForm.getInstance().cart_data_list.Count; i++) { if (name == MainForm.getInstance().cart_data_list[i].Menu_name) //중복 { MainForm.getInstance().cart_data_list[i].Menu_count++; MainForm.list[i].setNum(MainForm.getInstance().cart_data_list[i].Menu_count); MainForm.getInstance().reAllPrice(); goto jump; } else { } } price = Convert.ToInt32(menuPriceL.Text); Cartdata cd = new Cartdata(name, price, 1); MainForm.getInstance().initPriceList(cd); jump :; }
//장바구니 #region public void initPriceList(Cartdata cd) { cart_data_list.Add(cd); OrderItem item = new OrderItem(); list.Add(item); for (int i = 0; i < cart_data_list.Count; i++) { item.getItem(cart_data_list[i].Menu_name, cart_data_list[i].Menu_price, cart_data_list[i].Menu_count); reAllPrice(); } orderBy.Controls.Add(item); }