private void CheckPriceAndPurchase(CoffeeType coffeeType, CoffeePrice price)
 {
     if (this.InsertedCoins >= (int)price)
     {
         this.CoffeesSold.Add(coffeeType);
         this.InsertedCoins = 0;
     }
 }
Beispiel #2
0
        public void BuyCoffee(string size, string type)
        {
            CoffeeType  coffeeType  = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);
            CoffeePrice coffeePrice = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), size);

            if (coins >= (int)coffeePrice)
            {
                this.coffeeSold.Add(coffeeType);
                this.coins = 0;
            }
        }
Beispiel #3
0
    public void BuyCoffee(string price, string type)
    {
        CoffeeType  coffeeType  = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);
        CoffeePrice coffeePrice = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), price);

        if (this.Coins >= (int)coffeePrice)
        {
            this.CoffeesSold.Add(coffeeType);
            this.Coins = 0;
        }
    }
Beispiel #4
0
    public void BuyCoffee(string size, string type)
    {
        CoffeeType  coffeeType = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);
        CoffeePrice price      = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), size);

        if (this.coinsValue >= (int)price)
        {
            this.CoffeesSold.Add(coffeeType);
            this.coinsValue -= (int)price;
        }
    }
Beispiel #5
0
    public void BuyCoffee(string size, string type)
    {
        CoffeePrice coffeePrice = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), size);
        int         price       = (int)coffeePrice;
        CoffeeType  coffeeType  = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);

        if (this.totalMoney >= price)
        {
            this.CoffeesSold.Add(coffeeType);
        }
    }
        public void BuyCoffee(string size, string type)
        {
            CoffeeType  coffeeType  = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);
            CoffeePrice coffeePrice = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), size);

            if (totalInsertedCoins >= (int)coffeePrice)
            {
                coffeesSold.Add(coffeeType);
                totalInsertedCoins = 0;
            }
        }
Beispiel #7
0
    public void BuyCoffee(string size, string type)
    {
        CoffeePrice coffeePrice   = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), size);
        var         intCoffePrice = (int)coffeePrice;
        CoffeeType  coffeeType    = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);

        if (allMoney >= intCoffePrice)
        {
            coffeesSold.Add(coffeeType);
            allMoney = 0;
        }
    }
Beispiel #8
0
        public void BuyCoffee(string size, string type)
        {
            CoffeeType  currentType   = Enum.Parse <CoffeeType>(type);
            CoffeePrice price         = Enum.Parse <CoffeePrice>(size);
            int         currentBudget = 0;

            this.coins.ForEach(x => currentBudget += (int)x);
            if (currentBudget >= (int)price)
            {
                this.CoffeesSold.Add(currentType);
                this.coins.Clear();
            }
        }
 private void CoffeeVariationToCoffeePrice()
 {
     if (Variation == CoffeeVariation.Small)
     {
         _price = CoffeePrice.Small;
     }
     else if (Variation == CoffeeVariation.Normal)
     {
         _price = CoffeePrice.Normal;
     }
     else
     {
         _price = CoffeePrice.Double;
     }
 }
    public void BuyCoffee(string size, string type)
    {
        CoffeePrice coffeePrice = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), size);
        CoffeeType  coffeeType  = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);

        if (this.coins >= (int)coffeePrice)
        {
            coffeeSold.Add(coffeeType);
            this.coins = 0;
        }
        else
        {
            throw new ArgumentException("Not enough money!");
        }
    }
    public void BuyCoffee(string size, string type)
    {
        var coinAmount = 0;

        foreach (var coin in this.coins)
        {
            coinAmount += (int)coin;
        }

        CoffeePrice coffeePrice = (CoffeePrice)Enum.Parse(typeof(CoffeePrice), size);

        if (coinAmount >= (int)coffeePrice)
        {
            CoffeeType coffeeType = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);
            this.CoffeesSold.Add(coffeeType);
            this.coins.Clear();
        }
    }
Beispiel #12
0
        private void CoffeecomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            decimal         CoffeePrice;
            MySqlConnection connect   = new MySqlConnection("server = localhost; database = mega; username = root; password=;");
            string          query     = "select* from coffee where Item = '" + CoffeecomboBox.Text + "' ;";
            MySqlCommand    Combodata = new MySqlCommand(query, connect);
            MySqlDataReader myreader;

            try
            {
                connect.Open();

                myreader = Combodata.ExecuteReader();

                while (myreader.Read())
                {
                    CoffeePrice = myreader.GetDecimal("Prices");

                    DirectDecimal = CoffeePrice;

                    //DrinkPriceBox.Text = "$"+DrinkPrice;
                    CoffeePricetextBox.Text = "$" + CoffeePrice.ToString();

                    byte[] img = (byte[])(myreader["Image"]);
                    if (img == null)

                    {
                        CoffeepictureBox.Image = null;
                    }
                    else
                    {
                        MemoryStream ImageStream = new MemoryStream(img);
                        CoffeepictureBox.Image = System.Drawing.Image.FromStream(ImageStream);
                    }
                }

                connect.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public Coffee()
 {
     _variation = CoffeeVariation.Normal;
     _price     = CoffeePrice.Normal;
 }
 public void BuyCoffee(string size, string type)
 {
     this.size = (CoffeePrice)Enum.Parse(typeof(CoffeeType), size);
     this.type = (CoffeeType)Enum.Parse(typeof(CoffeeType), type);
 }