private void purchaseClick(object sender, EventArgs e) { ItemtoPurchase item = new ItemtoPurchase(); item.Product = this.book; item.Quantity = 1; MainForm.shoppingcart.addProduct(item); MessageBox.Show("Product/Products added to Shoppingcart", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnPurchase_Click(object sender, EventArgs e) { ItemtoPurchase item = new ItemtoPurchase(); item.Product = this.book; item.Quantity = Convert.ToInt32(nudPurchase.Value); MainForm.shoppingcart.addProduct(item); MessageBox.Show("ürün listeniize eklendi", "bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void btnpurchase_Click(object sender, EventArgs e) { ItemtoPurchase item = new ItemtoPurchase(); item.Product = this.musicCD; item.Quantity = Convert.ToInt32(nudmussicCD.Value); MainForm.shoppingcart.addProduct(item); MessageBox.Show("Product/Products added to Shoppingcart", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void deleteProduct(ItemtoPurchase itemtopurchase) { ItemstoPurchase.Remove(itemtopurchase); }
public void addProduct(ItemtoPurchase itemtopurchase) { ItemstoPurchase.Add(itemtopurchase); }
public ShoppingCartPanel(ItemtoPurchase item, ShoppingCartForm shopping) { this.item = item; this.shopping = shopping; this.Size = new Size(470, 85); this.BorderStyle = BorderStyle.FixedSingle; //NAME lblProductName = new Label(); lblProductName.AutoSize = false; lblProductName.Size = new Size(200, 20); lblProductName.Text = item.Product.Name; lblProductName.BackColor = Color.Transparent; lblProductName.Font = new Font("OCR A", (float)11.25); this.Controls.Add(lblProductName); //Price lblPrice = new Label(); lblPrice.AutoSize = false; lblPrice.Size = new Size(200, 20); lblPrice.Text = (item.Quantity * item.Product.Price).ToString() + " TL"; lblPrice.BackColor = Color.Transparent; lblPrice.Font = new Font("OCR A", (float)11.25); this.Controls.Add(lblPrice); //quantity nudQuantity = new NumericUpDown(); nudQuantity.Value = item.Quantity; nudQuantity.Minimum = 1; nudQuantity.Size = new Size(85, 20); nudQuantity.ValueChanged += new EventHandler(nudQuantityChanged); this.Controls.Add(nudQuantity); //remove btnRemove = new Button(); btnRemove.Text = "X"; btnRemove.TextAlign = ContentAlignment.MiddleCenter; btnRemove.Size = new Size(25, 25); btnRemove.FlatStyle = FlatStyle.Flat; btnRemove.FlatAppearance.BorderSize = 0; btnRemove.Cursor = Cursors.Hand; btnRemove.FlatAppearance.MouseDownBackColor = Color.Transparent; btnRemove.FlatAppearance.MouseOverBackColor = Color.Transparent; btnRemove.BackColor = Color.Transparent; btnRemove.Click += new EventHandler(btnRemoveClick); // btnRemove.Image = Properties.Resources.removeitem; //btnRemove.ImageAlign = ContentAlignment.MiddleLeft; this.Controls.Add(btnRemove); pbProduct = new PictureBox(); pbProduct.Size = new Size(48, 48); try { pbProduct.BackgroundImage = Image.FromFile(Application.StartupPath + @"\resources\" + item.Product.Picture); } catch { pbProduct.BackgroundImage = Image.FromFile(Application.StartupPath + @"\resources\not-found.png"); } pbProduct.BackgroundImageLayout = ImageLayout.Zoom; this.Controls.Add(pbProduct); this.Controls[0].Location = new Point(63, 24); // Name label this.Controls[0].BringToFront(); this.Controls[1].Location = new Point(63, 54); // Price label this.Controls[1].BringToFront(); this.Controls[2].Location = new Point(366, 26); //nud this.Controls[2].BringToFront(); this.Controls[3].Location = new Point(392, 58); //tutton this.Controls[3].BringToFront(); this.Controls[4].Location = new Point(16, 16); // image this.Controls[4].BringToFront(); }
public void deleteProduct(ItemtoPurchase itemtopurchase) { PaymentAmount -= itemtopurchase.Product.Price * itemtopurchase.Quantity; itemstoPurchase.Remove(itemtopurchase); }
public void addProduct(ItemtoPurchase itemtopurchase) { PaymentAmount += itemtopurchase.Product.Price * itemtopurchase.Quantity; itemstoPurchase.Add(itemtopurchase); }