private void btmildavis_Click(object sender, EventArgs e) { MusicCDs tmp = new MusicCDs(); dtmusic.CurrentCell = dtmusic.Rows[0].Cells[0]; if (dtmusic.SelectedRows.Count == 0) { MessageBox.Show("Please Select Products !"); } else { foreach (DataGridViewRow row in dtmusic.Rows) { if (row.Selected == true) { tmp.ProductID = int.Parse(row.Cells[0].Value.ToString()); purchase = new ItemToPurchase(tmp, 1); shopping.AddProductToShoppingCart(purchase); } } //dtlistshpcrd.DataSource = shopping.PrintShoppingCartProducts(); lbltutar.Text = shopping.PaymentAmount().ToString() + "TL"; } }
private void button4_Click(object sender, EventArgs e) { MusicCDs tmp = new MusicCDs(); if (dtpurchased.SelectedRows.Count == 0) { MessageBox.Show("Please Select Products !"); } else { foreach (DataGridViewRow row in dtpurchased.Rows) { if (row.Selected == true) { tmp.ProductID = int.Parse(row.Cells[0].Value.ToString()); purchase = new ItemToPurchase(tmp, 1); shopping.RemoveProductToShoppingCart(purchase); } } } dtpurchased.DataSource = shopping.PrintShoppingCartProducts(); lbltutarpurchase.Text = shopping.PaymentAmount().ToString() + "TL"; }