Advertisement
Luca_Codorean

Pizza app order v1

Feb 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.55 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13.     public partial class frmMain : Form
  14.     {
  15.         public frmMain()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         public double pret = 0;
  21.         public short aux = 0;
  22.  
  23.         private void Form1_Load(object sender, EventArgs e)
  24.         {
  25.             pnlComanda.Visible = false;
  26.             pnlMain.Visible = true;
  27.             pnlMeniu.Visible = false;
  28.             pnlMeniu.Location = pnlMain.Location;
  29.             pnlMeniu.Size = pnlMain.Size;
  30.             pnlComanda.Location = pnlMain.Location;
  31.             pnlComanda.Size = pnlMain.Size;
  32.             lbBack.Visible = false;
  33.             lstpreturi.Visible = false;
  34.             pnlDespre.Size = pnlMain.Size;
  35.             pnlDespre.Location = pnlMain.Location;
  36.         }
  37.  
  38.         private void lbBack_Click(object sender, EventArgs e)
  39.         {
  40.             pnlComanda.Visible = false;
  41.             pnlMeniu.Visible = false;
  42.             pnlMain.Visible = true;
  43.             pnlDespre.Visible = false;
  44.         }
  45.  
  46.         private void btnComanda_Click(object sender, EventArgs e)
  47.         {
  48.             pnlComanda.Visible = true;
  49.             pnlMain.Visible = false;
  50.             lbBack.Visible = true;
  51.             pictureBox1.Visible = false;
  52.         }
  53.  
  54.         private void btnMeniu_Click(object sender, EventArgs e)
  55.         {
  56.             pnlComanda.Visible = false;
  57.             pnlMain.Visible = false;
  58.             pnlMeniu.Visible = true;
  59.             lbBack.Visible = true;
  60.         }
  61.  
  62.         private void btnConfirm_Click(object sender, EventArgs e)
  63.         {
  64.             MessageBox.Show("Comanda ta a fost plasată cu succes!", "Confirmare");
  65.         }
  66.  
  67.         private void btnReset_Click(object sender, EventArgs e)
  68.         {
  69.             MessageBox.Show("Comanda ta a fost restată.", "Restare");
  70.  
  71.             foreach (Control ceva in gBstuff.Controls)
  72.             {
  73.        
  74.                 if ((ceva as CheckBox)!=null)
  75.                 {
  76.                     (ceva as CheckBox).Checked = false;
  77.                 }
  78.             }
  79.             foreach (Control ceva in gbMarime.Controls)
  80.             {
  81.                 if ((ceva as RadioButton)!=null)
  82.                 {
  83.                     (ceva as RadioButton).Checked = false;
  84.                 }
  85.             }
  86.             comboBox1.Text = "";
  87.             pictureBox1.Visible = false;
  88.             lbpretfinal.Text = " ";
  89.             rBmic.Enabled = true;
  90.             rbMedie.Enabled = true;
  91.             rbMare.Enabled = true;
  92.         }
  93.         private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  94.         {
  95.             pictureBox1.Image = new Bitmap("img/" + comboBox1.Text + ".jpg");
  96.             pictureBox1.Visible = true;
  97.             lbpretfinal.Text =  lstpreturi.Items[comboBox1.SelectedIndex].ToString();
  98.             pret = double.Parse(lbpretfinal.Text);
  99.             foreach (Control ceva in gBstuff.Controls)
  100.             {
  101.  
  102.                 if ((ceva as CheckBox) != null)
  103.                 {
  104.                     (ceva as CheckBox).Checked = false;
  105.                 }
  106.             }
  107.             foreach (Control ceva in gbMarime.Controls)
  108.             {
  109.                 if ((ceva as RadioButton) != null)
  110.                 {
  111.                     (ceva as RadioButton).Checked = false;
  112.                 }
  113.             }
  114.             rbMedie.Enabled = false;
  115.         }
  116.  
  117.         private void btnDespre_Click(object sender, EventArgs e)
  118.         {
  119.             pnlComanda.Visible = false;
  120.             pnlMain.Visible = false;
  121.             pnlMeniu.Visible = false;
  122.             lbBack.Visible = true;
  123.             pnlDespre.Visible = true;
  124.         }
  125.  
  126.         private void rBmic_Click(object sender, EventArgs e)
  127.         {
  128.            
  129.             if (rBmic.Checked == true)
  130.             {
  131.                 pret -= (double.Parse(lbpretfinal.Text) * (1 / 3.0));
  132.                 aux++;
  133.             }
  134.             else if (rBmic.Checked == false)
  135.             {
  136.                 pret += (double.Parse(lbpretfinal.Text) * (1 / 3.0));
  137.             }
  138.             if (aux > 0)
  139.             {
  140.                 rBmic.Enabled = false;
  141.             }
  142.             if (rbMare.Enabled==false)
  143.             {
  144.                 rbMare.Enabled = true;
  145.             }
  146.             if (rbMedie.Enabled == false)
  147.             {
  148.                 rbMedie.Enabled = true;
  149.             }
  150.             pret = double.Parse(String.Format("{0:0.00}", pret));
  151.             lbpretfinal.Text = pret.ToString();
  152.         }
  153.  
  154.         private double aux2 = 0;
  155.  
  156.         private void rbMedie_Click(object sender, EventArgs e)
  157.         {
  158.            
  159.             if (rbMedie.Checked == true)
  160.             {
  161.                 lbpretfinal.ResetText();
  162.                 aux2++;
  163.             }
  164.             if (aux2>0)
  165.             {
  166.                 rbMedie.Enabled = false;
  167.             }
  168.             if (rbMare.Enabled == false)
  169.             {
  170.                 rbMare.Enabled = true;
  171.             }
  172.             if (rBmic.Enabled == false)
  173.             {
  174.                 rBmic.Enabled = true;
  175.             }
  176.             pret = double.Parse(String.Format("{0:0.00}", pret));
  177.             lbpretfinal.Text = pret.ToString();
  178.         }
  179.  
  180.         private double aux3 = 0;
  181.  
  182.         private void rbMare_Click(object sender, EventArgs e)
  183.         {
  184.  
  185.             if (rbMare.Checked == true)
  186.             {
  187.                 pret += (double.Parse(lbpretfinal.Text) * (2 / 3.0));
  188.                 aux3++;
  189.             }
  190.             else
  191.             {
  192.                 if (rbMare.Checked==false)
  193.                 {
  194.                     pret -= double.Parse(lbpretfinal.Text);
  195.                 }
  196.                
  197.             }
  198.             if (aux3 > 0)
  199.             {
  200.                 rbMare.Enabled = false;
  201.             }
  202.             if (rbMedie.Enabled == false)
  203.             {
  204.                 rbMedie.Enabled = true;
  205.             }
  206.             if (rBmic.Enabled == false)
  207.             {
  208.                 rBmic.Enabled = true;
  209.             }
  210.             pret = double.Parse(String.Format("{0:0.00}", pret));
  211.             lbpretfinal.Text = pret.ToString();
  212.         }
  213.  
  214.         private void chbPorumb_Click(object sender, EventArgs e)
  215.         {
  216.             if (chbPorumb.Checked==true)
  217.             {
  218.                 pret += 2;
  219.             }    
  220.             else
  221.             {
  222.                 pret -= 2;
  223.             }
  224.             lbpretfinal.Text = pret.ToString();
  225.         }
  226.  
  227.         private void chbCiuperci_Click(object sender, EventArgs e)
  228.         {
  229.             if (chbCiuperci.Checked==true)
  230.             {
  231.                 pret += 2.5;
  232.             }
  233.             else
  234.             {
  235.                 pret -= 2.5;
  236.             }
  237.             lbpretfinal.Text = pret.ToString();
  238.         }
  239.  
  240.         private void chbMozza_Click(object sender, EventArgs e)
  241.         {
  242.             if (chbMozza.Checked==true)
  243.             {
  244.                 pret += 3;
  245.             }
  246.             else
  247.             {
  248.                 pret -= 3;
  249.             }
  250.             lbpretfinal.Text = pret.ToString();
  251.         }
  252.  
  253.         private void chbKetchup_Click(object sender, EventArgs e)
  254.         {
  255.             if (chbKetchup.Checked==true)
  256.             {
  257.                 pret += 2;
  258.             }
  259.             else
  260.             {
  261.                 pret -= 2;
  262.             }
  263.             lbpretfinal.Text = pret.ToString();
  264.         }
  265.     }
  266. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement