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 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace Pizza{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void buttonTemizle_Click(object sender, EventArgs e) { //Textbox de�erlerini temizliyoruz textBoxAdSoyad.Text = ""; textBoxTelefon.Text = ""; textBoxAdres.Text = ""; //combobox de�erlerini temizliyoruz comboBoxIcecek.Text = ""; comboBoxPizzaBoy.Text = ""; //numericupdown de�erlerini temizliyoruz numericUpDownPizza.Value = 0; numericUpDownIcecek.Value = 0; //checkbox de�erlerini temizliyoruz checkBoxSucuk.Checked = false; checkBoxSosis.Checked = false; checkBoxMantar.Checked = false; checkBoxKasar.Checked = false; checkBoxPeynir.Checked = false; checkBoxSebze.Checked = false; } private void Form1_Load(object sender, EventArgs e) { } private void buttonSiparisAl_Click(object sender, EventArgs e) { //ucret ve ekstra ad�nda de�i�kenler tan�ml�yoruz decimal ucret = 0; string ekstra = ""; //E�er checkbox'lar se�ili ise ekstra de�i�kenine aktar�l�yor. if (checkBoxSucuk.Checked == true) { ekstra += "Sucuk";} if (checkBoxSosis.Checked == true) { ekstra += " - " + "Sosis";} if (checkBoxMantar.Checked == true) { ekstra += " - " + "Mantar" ; } if (checkBoxKasar.Checked == true) { ekstra += " - " + "Ka�ar" ; } if (checkBoxPeynir.Checked == true) { ekstra += " - " + "Peynir" ; } if (checkBoxSebze.Checked == true) { ekstra += " - " + "Sebze" ; } //Se�ili olan de�eri ucret de�i�kenine adet bilgisi ile �arparak ekliyoruz. if (comboBoxPizzaBoy.Text =="K���k") {ucret = numericUpDownPizza.Value * 10;} else if (comboBoxPizzaBoy.Text == "Orta") {ucret = numericUpDownPizza.Value * 15;} else if (comboBoxPizzaBoy.Text == "B�y�k") {ucret = numericUpDownPizza.Value * 20;} if(comboBoxIcecek.Text=="2,5lt Coca Cola") {ucret += numericUpDownIcecek.Value * 5;} else if(comboBoxIcecek.Text=="1lt Fanta") {ucret += numericUpDownIcecek.Value * 3;} else if (comboBoxIcecek.Text == "1lt Sprite") {ucret += numericUpDownIcecek.Value * 3;} //Listbox'a de�erleri yazd�r�yoruz. listBoxAdSoyad.Items.Add(textBoxAdSoyad.Text); listBoxTelefon.Items.Add(textBoxTelefon.Text); listBoxAdres.Items.Add(textBoxAdres.Text); listBoxPizza.Items.Add(numericUpDownPizza.Value + " adet " + comboBoxPizzaBoy.Text); listBoxIcecek.Items.Add(numericUpDownIcecek.Value + " adet " + comboBoxIcecek.Text); listBoxEkstra.Items.Add(ekstra); listBoxUcret.Items.Add(ucret + "TL"); } private void buttonSiparisTemizle_Click(object sender, EventArgs e) {//Listbox'lar� temizliyoruz. listBoxAdSoyad.Items.Clear(); listBoxTelefon.Items.Clear(); listBoxAdres.Items.Clear(); listBoxPizza.Items.Clear(); listBoxIcecek.Items.Clear(); listBoxEkstra.Items.Clear(); listBoxUcret.Items.Clear(); } }} |
C SHARP � FORM APPL�CAT�ON �LE P�ZZA S�PAR�� S�STEM�
Bu �rnekte kullan�c�dan textbox ile kullan�c� bilgilerini al�yoruz.Daha sonra combobox ve numericupdown aral�yla sipari�e ait detaylar� al�yoruz.Ekstra b�l�m�nde checkbox ile istenilen bilgileri dahil ediyoruz.Bilgiler sipari� al butonuna t�kland���nda listboxlara yazd�r�l�yor. 
Etiketler:
C# Dersleri
Recent Posts
https://www.rentacarantalya.net/
Yorum Gönder