Basit C# Alışveriş Uygulaması Merhaba arkadaşlar bu yazımızda sizlere if yapısını kullanarak basit bir C# Alışveriş Uygulaması nı Windows Form ortamında hazırlayacağız. C# Alışveriş Uygulaması Kodlarımızı paylaşmadan önce uygulamamızı biraz açıklayalım. Formumuzda ürünler ve bu ürünlere ait modeller bulunmaktadır. Ürünlerden hangisini seçersek modellerde o ürüne ait modeller listelenmektedir. Ürünü ve modeli seçtikten sonra kaç adet satın almak istediğimizi belirtiyoruz Satın Al butonuna tıkladığımızda Alışveriş Sepetinde örneğin 2 adet TOSHIBA T200 LABTOP şekline alınan ürün listelenmektedir. Birden fazla ürün satın aldığımızda alt alta listelenecektir. Alışverişi Tamamla butonuna tıkladığımızda ise alınan ürünler için toplam fiyat gösterilecektir. [Üye Olmadan Linkleri Göremezsiniz. Üye Olmak için TIKLAYIN...] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 public partial class Form1 : Form { public Form1() { InitializeComponent(); } int Top; private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { comboBox2.Items.Clear(); if (comboBox1.SelectedItem.ToString() == "HP") { comboBox2.Items.Add("HP150"); comboBox2.Items.Add("HPM100"); } else if (comboBox1.SelectedItem.ToString() == "TOSHIBA") { comboBox2.Items.Add("T200"); comboBox2.Items.Add("TB100"); } else if (comboBox1.SelectedItem.ToString() == "SIEMENS") { comboBox2.Items.Add("S400"); comboBox2.Items.Add("SM300"); } } private void button2_Click(object sender, EventArgs e)//Satın Al { if (comboBox2.SelectedItem.ToString() == "HP150") { listBox1.Items.Add(textBox1.Text + " adet " + comboBox1.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString() + " LAPTOP"); Top = Top + int.Parse(textBox1.Text) * 50; } else if (comboBox2.SelectedItem.ToString() == "HPM100") { listBox1.Items.Add(textBox1.Text + " adet " + comboBox1.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString() + " LAPTOP"); Top = Top + int.Parse(textBox1.Text) * 75; } else if (comboBox2.SelectedItem.ToString() == "T200") { listBox1.Items.Add(textBox1.Text + " adet " + comboBox1.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString() + " LAPTOP"); Top = Top + int.Parse(textBox1.Text) * 100; } else if (comboBox2.SelectedItem.ToString() == "TB100") { listBox1.Items.Add(textBox1.Text + " adet " + comboBox1.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString() + " LAPTOP"); Top = Top + int.Parse(textBox1.Text) * 150; } else if (comboBox2.SelectedItem.ToString() == "S400") { listBox1.Items.Add(textBox1.Text + " adet " + comboBox1.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString() + " LAPTOP"); Top = Top + int.Parse(textBox1.Text) * 200; } else if (comboBox2.SelectedItem.ToString() == "SM300") { listBox1.Items.Add(textBox1.Text + " adet " + comboBox1.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString() + " LAPTOP"); Top = Top + int.Parse(textBox1.Text) * 250; } } private void button1_Click(object sender, EventArgs e)//Alışverişi Tamamla { label5.Text = "TOPLAM " + Top.ToString() + " TL DİR"; } private void Form1_Load(object sender, EventArgs e) { label5.Text = ""; } } |
Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 23:59. |
Powered by vBulletin® Version 3.8.8 Beta 3
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO
Copyright ©2004 - 2024 IRCForumlari.Net