Esempio n. 1
0
        private void button3_Click(object sender, EventArgs e)
        {//dessert
            SqlConnection connection = BDD.open();
            string        ord;

            //tool.sw1(button3.Text, connection, label1.Text, cmdtps.Text, archi.Text, objcmd.Text);
            //Update(res[0].ToString(), res[1].ToString(), res[2].ToString(), res[3].ToString());

            //voir button.click pour plus d'informations
            switch (button3.Text)
            {
            case "Desserts":
                archi.Text = "2d";
                cmdtmp.Add("Desserts");
                break;

            case "fish":
                archi.Text = "3f";
                cmdtmp.Add("long fish");
                ord         = "SELECT prix, reduction FROM BURGERS WHERE burger='fish'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "crudite":
                archi.Text = "3cr";
                cmdtmp.Add("crudite");
                ord         = "SELECT prix, reduction FROM SALADES WHERE salade='crudite'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "cookie":
                archi.Text = "3co";
                cmdtmp.Add("cookie");
                ord         = "SELECT prix, reduction FROM DESSERTS WHERE dessert='cookie'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case ".":
                archi.Text = "4m";
                cmdtmp.Add("mayonaise");
                break;

            case "sans sauce":
                archi.Text = "4ss";
                cmdtmp.Add("sans sauce");
                break;

            case "sans coulis":
                archi.Text = "4sc";
                cmdtmp.Add("sans coul");
                break;

            default:
                break;
            }
            connection.Close();
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {//salades
            SqlConnection connection = BDD.open();
            string        ord;

            //tool.sw1(button2.Text, connection, label1.Text, cmdtps.Text, archi.Text, objcmd.Text);
            //Update(res[0].ToString(), res[1].ToString(), res[2].ToString(), res[3].ToString());

            //voir button1.click pour plus d'informations
            switch (button2.Text)
            {
            case "Salades":
                archi.Text = "2s";
                cmdtmp.Add("Salade");
                break;

            case "big mac":
                archi.Text = "3b";
                cmdtmp.Add("big mac");
                ord         = "SELECT prix, reduction FROM BURGERS WHERE burger='big_mac'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "oriental":
                archi.Text = "3or";
                cmdtmp.Add("oriental");
                ord         = "SELECT prix, reduction FROM SALADES WHERE salade='oriental'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "sun day":
                archi.Text = "3s";
                cmdtmp.Add("sun day");
                ord         = "SELECT prix, reduction FROM DESSERTS WHERE dessert='sun_day'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "'":
                archi.Text = "4k";
                cmdtmp.Add("ketchup");
                break;

            case "balsamic":
                archi.Text = "4b";
                cmdtmp.Add("balsamic");
                break;

            case "caramel":
                archi.Text = "4ca";
                cmdtmp.Add("caramel");
                break;

            default:
                break;
            }
            connection.Close();
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {//burgers
            SqlConnection connection = BDD.open();
            string        ord;

            //tool.sw1(button1.Text, connection, label1.Text, cmdtps.Text,archi.Text,objcmd.Text);
            //Update(res[0].ToString(),res[1].ToString(),res[2].ToString(),res[3].ToString());

            //suivant le texte du boutton 1 differents produits sont ajoutes dans la commande temporaire
            //ainsi que le prix apres calcul de la reduction du produit dans un label objcmd
            //enfin on passe au niveau d'architecture suivant (menu -> choix plat -> produit -> sauce )
            switch (button1.Text)
            {
            case "Burgers":
                archi.Text = "2b";
                cmdtmp.Add("Burger");
                break;

            case "chicken":
                archi.Text = "3c";
                cmdtmp.Add("chicken");
                ord         = "SELECT prix, reduction FROM BURGERS WHERE burger='chicken'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "fromage":
                archi.Text = "3fr";
                cmdtmp.Add("fromage");
                ord         = "SELECT prix, reduction FROM SALADES WHERE salade='fromage'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "mac flury":
                archi.Text = "3m";
                cmdtmp.Add("macflury");
                ord         = "SELECT prix, reduction FROM DESSERTS WHERE dessert='mac_flurry'";
                objcmd.Text = BDD.GetPrixReduc(ord, connection);
                break;

            case "poivre":
                archi.Text = "4p";
                cmdtmp.Add("poivre");
                break;

            case "vinaigrette":
                archi.Text = "4v";
                cmdtmp.Add("vinaigrette");
                break;

            case "chocolat":
                archi.Text = "4c";
                cmdtmp.Add("chocolat");
                break;

            case "confirmer":
                archi.Text = "1";
                //le label cmdtps est la commande finale des produits commandes par l'utilisateur, string join permet de concatener une liste avec une virgule comme separateur
                cmdtps.Text = cmdtps.Text + " \r\n " + string.Join(", ", cmdtmp) + "\t\t" + objcmd.Text + " euros";
                //label1 est le label stockant le prix total de la commande
                label1.Text = Convert.ToString((Convert.ToDecimal(label1.Text) + Convert.ToDecimal(objcmd.Text)));
                //on efface la commande temporaire car elle a ete validee
                cmdtmp.Clear();
                break;

            default:
                break;
            }
            // Fermeture connection
            connection.Close();
        }