public static string GetDrinks(Drinks drink)
        {
            switch (drink)
            {
            case Drinks.AppleJuice: return("Apple Juice");

            case Drinks.Cappuccino: return("Cappuccino");

            case Drinks.ChocolateMilkshake: return("Chocolate Milkshake");

            case Drinks.CokeSoda: return("Coke Soda");

            case Drinks.Espresso: return("Espresso");

            case Drinks.IceTea: return("Ice Tea");

            case Drinks.Latte: return("Latte");

            case Drinks.Lemonade: return("Lemonade");

            case Drinks.Macchiato: return("Macchiato");

            case Drinks.OrangeJuice: return("Orange Juice");

            default: return("");
            }
        }
Exemple #2
0
        public List <Drinks> GetDrinks_Topping(string type)
        {
            string sql = "SELECT * FROM DrinkToppingName WHERE Id LIKE '" + type + "%'";

            connect();
            try
            {
                SqlDataReader dr = ExecuteReader(sql);
                string        id, name;
                double        price;
                List <Drinks> list = new List <Drinks>();
                while (dr.Read())
                {
                    id    = dr[0].ToString();
                    name  = dr[1].ToString();
                    price = Convert.ToDouble(dr[2]);
                    Drinks drink = new Drinks(id, name, price);
                    list.Add(drink);
                }
                dr.Close();
                return(list);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
            finally
            {
                disconnect();
            }
        }
Exemple #3
0
 public static void SaveDrinks(Drinks drink)
 {
     using (IDbConnection connection = new SQLiteConnection(LoadConnectionString()))
     {
         connection.Execute("insert into Drinks (NomRecette) values (@NomRecette)", drink);
     }
 }
        private void label4_Click(object sender, EventArgs e)//Same as category next button
        {
            Drinks drinks = new Drinks();

            this.Hide();
            drinks.ShowDialog();
        }
        private List <Order> GetOrders()
        {
            ContentPlaceHolder      cph = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
            ControlFinder <TextBox> cf  = new ControlFinder <TextBox>();

            cf.findChildControlsRecursive(cph);
            var textBoxList = cf.foundsControls;

            List <Order> orderList = new List <Order>();

            foreach (TextBox textBox in textBoxList)
            {
                if (textBox.Text != "")
                {
                    int amountOfOrder = Convert.ToInt32(textBox.Text);
                    if (amountOfOrder > 0)
                    {
                        Drinks aDrinks = drinksGateway.GetDrinksById(int.Parse(textBox.ID));
                        Order  order   = new Order();
                        order.Client       = Session["logIn"].ToString();
                        order.Product      = aDrinks.Name;
                        order.Amount       = amountOfOrder;
                        order.Price        = aDrinks.Price;
                        order.Date         = DateTime.Now;
                        order.OrderShipped = false;

                        orderList.Add(order);
                    }
                }
            }
            return(orderList);
        }
Exemple #6
0
        public void InsertDrink(Drinks drinks)
        {
            string query = $"insert into Drinks(NameOfDrink,Price,Stock,Alcohol) values('{drinks.NameOfDrink}',{drinks.Price},{drinks.Stock},{Convert.ToInt32( drinks.isAlcholic)});";

            SqlParameter[] sqlParameters = new SqlParameter[0];
            ExecuteEditQuery(query, sqlParameters);
        }
    //takes in drink type, loops through array of art assets
    void Spray(Drinks type)
    {
        GameObject currentSp;

        for (int i = 0; i < sprays.Length; i++)
        {
            // if the art asset is the same as the drink type, instantiate
            if (i == (int)type)
            {
                //creates sprays
                //flips sprays depending on where the gun is when its sprayed
                if (gun.transform.position.x < 0)
                {
                    currentSp = GameObject.Instantiate(sprays[i], new Vector3(offset.transform.position.x, offset.transform.position.y, offset.transform.position.z), transform.rotation * Quaternion.Euler(0f, 0f, sprayRotate));
                    currentSp.transform.SetParent(offset.transform);
                    sprayer.PlayOneShot(spray[Random.Range(0, spray.Length)]);
                    Debug.Log("Made " + type);
                    Destroy(currentSp, deathTime);
                }
                else
                {
                    currentSp = GameObject.Instantiate(sprays[i], new Vector3(offsetReverse.transform.position.x, offsetReverse.transform.position.y, offsetReverse.transform.position.z), transform.rotation * Quaternion.Euler(0f, 0f, -sprayRotate));
                    currentSp.transform.SetParent(offset.transform);
                    sprayer.PlayOneShot(spray[Random.Range(0, spray.Length)]);
                    Debug.Log("Made Reverse " + type);
                    Destroy(currentSp, deathTime);
                }
            }
        }
    }
Exemple #8
0
        public List <List <string> > GetDrinks()
        {
            var temp = Drinks.ToList();

            Drinks.Clear();
            return(temp);
        }
        public List <Drinks> GetAllDrinksType(string type)
        {
            List <Drinks> aDrinksList = new List <Drinks>();
            SqlConnection connection  = new SqlConnection(connectionString);
            string        query       = "SELECT * FROM DrinksTBL WHERE Type='" + type + "'";
            SqlCommand    command     = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                Drinks aDrinks = new Drinks();
                aDrinks.Id       = int.Parse(reader["Id"].ToString());
                aDrinks.Type     = reader["Type"].ToString();
                aDrinks.Name     = reader["Name"].ToString();
                aDrinks.Origin   = reader["OriginCountry"].ToString();
                aDrinks.Price    = decimal.Parse(reader["Price"].ToString());
                aDrinks.Quantity = reader["Quantity"].ToString();
                aDrinks.Review   = reader["Review"].ToString();
                aDrinks.Image    = reader["Image"].ToString();

                aDrinksList.Add(aDrinks);
            }
            reader.Close();
            connection.Close();
            return(aDrinksList);
        }
        public VendingFirst()
        {
            var cola  = new Drinks("Cola", "Brun dryck", 5);
            var fanta = new Drinks("Fanta", "Orange dryck", 5);
            var pepsi = new Drinks("Pepsi", "Brun dryck", 5);
            var zingo = new Drinks("Zingo", "Orange dryck", 5);

            var baguette      = new Food("Baguette", "Långt bröd med ost", 20, 200);
            var kycklingspett = new Food("Kycklingspett", "Kyckligng på spett", 30, 120);
            var rakburk       = new Food("Räkburk", "Burk med räkor", 500, 100);
            var smorgastarta  = new Food("Smörgåstårta", "Smörgås i lager", 195, 1000);
            var paj           = new Food("Paj", "Ost och skinkpaj", 30, 200);

            var sten       = new Stuff("Sten", "Vanlig sten", 1, 20);
            var diamant    = new Stuff("Diamant", "Dyr sten", 9999, 10);
            var skruv      = new Stuff("Skruv", "Vanlig skruv", 1, 5);
            var borrmaskin = new Stuff("Borrmaskin", "Maskin att borra med", 595, 2052);

            NumberOfFirst  = 4;
            NumberOfSecond = 5;
            NumberOfThird  = NumberOfFirst + NumberOfSecond;

            Stock = new IProduct[]
            {
                cola, fanta, pepsi, zingo, baguette, kycklingspett, rakburk, smorgastarta, paj, sten, diamant, skruv,
                borrmaskin
            };
        }
Exemple #11
0
        public List <Drinks> GetAllData()
        {
            List <Drinks> listOfDrink = new List <Drinks>();

            string query = "SELECT * from Drinks";

            dcc.ConnectWithDB();
            SqlDataReader sdr = dcc.GetData(query);

            while (sdr.Read())
            {
                Drinks di = new Drinks();
                di.Did   = sdr["Did"].ToString();
                di.Dname = sdr["Dname"].ToString();

                di.Dsell = Convert.ToInt32(sdr["Dsell"].ToString());
                // emp.PhnNumber = sdr["PhnNumber"].ToStrings();
                //  emp.Dsell = sdr["Dsell"].ToString();
                //  emp.Designation = sdr["Designation"].ToString();

                listOfDrink.Add(di);
            }

            dcc.CloseConnection();

            return(listOfDrink);
        }
        public Drinks GetDrinksById(int id)
        {
            Drinks        aDrinks    = new Drinks();
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "SELECT * FROM DrinksTBL WHERE Id='" + id + "'";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                aDrinks.Id       = int.Parse(reader["Id"].ToString());
                aDrinks.Type     = reader["Type"].ToString();
                aDrinks.Name     = reader["Name"].ToString();
                aDrinks.Origin   = reader["OriginCountry"].ToString();
                aDrinks.Price    = decimal.Parse(reader["Price"].ToString());
                aDrinks.Quantity = reader["Quantity"].ToString();
                aDrinks.Review   = reader["Review"].ToString();
                aDrinks.Image    = reader["Image"].ToString();
            }
            reader.Close();
            connection.Close();
            return(aDrinks);
        }
        private void categoriesNxt_Click(object sender, EventArgs e)
        {
            Drinks drinks = new Drinks();

            this.Hide();
            drinks.ShowDialog();
        }
Exemple #14
0
        public ActionResult Index()
        {
            DrinksViewModel dvm = new DrinksViewModel();

            dvm.Drinks = Drinks.Get_AllDrinks();
            return(View(dvm));
        }
        public IActionResult Purchase(Drinks drinksModel)
        {
            int cokeQty  = drinksModel.CokeQty;
            int pepsiQty = drinksModel.PepsiQty;
            int sodaQty  = drinksModel.SodaQty;

            int chngPenny   = drinksModel.ChangePenny;
            int chngCents   = drinksModel.ChangeCents;
            int chngNickel  = drinksModel.ChangeNickel;
            int chngQuarter = drinksModel.ChangeQuarter;

            changePenny   = chngPenny;
            changeCents   = chngCents;
            changeNickel  = chngNickel;
            changeQuarter = chngQuarter;

            coke_count    -= cokeQty;
            pepsi_count   -= pepsiQty;
            soda_count    -= sodaQty;
            cents_count   += drinksModel.Cents;
            penny_count   += drinksModel.Penny;
            nickel_count  += drinksModel.Nickels;
            quarter_count += drinksModel.Quarter;

            cents_count   -= changeCents;
            penny_count   -= changePenny;
            nickel_count  -= changeNickel;
            quarter_count -= changeQuarter;

            return(RedirectToAction("Index"));
        }
        private void drinksBtn2_Click(object sender, EventArgs e)
        {
            Drinks drinks = new Drinks();

            this.Hide();
            drinks.ShowDialog();
        }
        public static List <Drinks> GetDrinks()
        {
            ISession      session = SessionManager.GetSession();
            List <Drinks> drinks  = new List <Drinks>();


            if (session == null)
            {
                return(null);
            }

            var drinksData = session.Execute("select * from drinks");


            foreach (var dData in drinksData)
            {
                Drinks d = new Drinks();
                // d.zaposleni_id = (int)zData["zaposleni_id"];
                d.Naziv = dData["naziv"] != null ? dData["naziv"].ToString() : string.Empty;
                d.Vrsta = dData["vrsta"] != null ? dData["vrsta"].ToString() : string.Empty;
                d.Cena  = (int)dData["cena"];



                drinks.Add(d);
            }



            return(drinks);
        }
 private void RemoveLastRow(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (Drinks.Count > 0)
     {
         Drinks.RemoveAt(Drinks.Count - 1);
     }
 }
Exemple #19
0
        public async Task <IActionResult> Edit(string id, [Bind("DrinkId,Title,Description,Price,Ingredients")] Drinks drinks)
        {
            if (id != drinks.DrinkId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(drinks);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DrinksExists(drinks.DrinkId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(drinks));
        }
Exemple #20
0
        public void DeleteDrink(Drinks drinks)
        {
            string query = $"Delete from Drinks where Id = {drinks.Id}";

            SqlParameter[] sqlParameters = new SqlParameter[0];
            ExecuteEditQuery(query, sqlParameters);
        }
Exemple #21
0
 public RegistrationContext(DbContextOptions <RegistrationContext> options)
     : base(options)
 {
     Database.EnsureCreated();
     if (!Colors.Any())
     {
         Colors.Add(new Color {
             name = "Красный"
         });
         Colors.Add(new Color {
             name = "Синий"
         });
         Colors.Add(new Color {
             name = "Желтый"
         });
         this.SaveChanges();
     }
     if (!Drinks.Any())
     {
         Drinks.Add(new Drink {
             name = "Чай"
         });
         Drinks.Add(new Drink {
             name = "Кофе"
         });
         Drinks.Add(new Drink {
             name = "Вода"
         });
         Drinks.Add(new Drink {
             name = "Сок"
         });
         this.SaveChanges();
     }
 }
Exemple #22
0
        public void UpdateDrink(Drinks drinks)
        {
            string query = $"update Drinks Set NameOfDrink = '{drinks.NameOfDrink}', Price = {drinks.Price},Stock= {drinks.Stock},Alcohol={Convert.ToInt32(drinks.isAlcholic)} where Id = {drinks.Id}";

            SqlParameter[] sqlParameters = new SqlParameter[0];
            ExecuteEditQuery(query, sqlParameters);
        }
        public ActionResult DeleteConfirmed(Guid id)
        {
            Drinks drinks = drinksDb.Drinks.Find(id);

            drinksDb.Drinks.Remove(drinks);
            drinksDb.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #24
0
 public Order(string name, string lastName, int tableNumber, Sets sets, Drinks drinks)
 {
     this.Name        = name;
     this.LastName    = lastName;
     this.TableNumber = tableNumber;
     this.Sets        = sets;
     this.Drinks      = drinks;
 }
Exemple #25
0
 /// <summary>
 /// adds the selected side to list
 /// </summary>
 /// <param name="side"></param>
 private void SelectDrinks(Drinks drinks)
 {
     if (DataContext is Order order)
     {
         order.Add(drinks);
         this.Drinks = drinks;
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Drinks drinks = db.Booze.Find(id);

            db.Booze.Remove(drinks);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #27
0
 public ActionResult Delete_Drink(string drink)
 {
     if (!string.IsNullOrEmpty(drink))
     {
         Drinks.Delete_Drink(drink);
     }
     return(RedirectToAction(nameof(Index)));
 }
Exemple #28
0
 public ActionResult Update_DrinkQuantity(string drink, int amt)
 {
     if (!string.IsNullOrEmpty(drink))
     {
         Drinks.Update_DrinkQuantity(drink, amt);
     }
     return(RedirectToAction(nameof(Index)));
 }
Exemple #29
0
 public ActionResult Add_Drink(Drink newDrink)
 {
     if (newDrink != null)
     {
         Drinks.Add_Drink(newDrink.Name, newDrink.Quantity);
     }
     return(RedirectToAction(nameof(Index)));
 }
Exemple #30
0
        public void DeleteDrinkAsync()
        {
            var request = new HttpRequestMessage(HttpMethod.Delete, $"api/drinks");

            request.Content = new StringContent(JsonConvert.SerializeObject(DrinkDeleteItem), Encoding.UTF8, "application/json");
            var response = this.client.SendAsync(request).Result;

            Drinks.Remove(this.DrinkDeleteItem);
        }
 public void Order(Guid orderId, Drinks drink)
 {
     Console.WriteLine("[Thread {2}] Order up! One {0} for receipt {1}", drink, orderId,
                       Thread.CurrentThread.ManagedThreadId);
     bus.Publish(new DrinkOrdered
                     {
                         Drink = drink,
                         OrderId = orderId,
                         Price = prices[drink]
                     });
 }
 public void PrepareDrink(Guid orderId, Drinks drink)
 {
     if (recentOrders.Contains(orderId))
     {
         Console.WriteLine("Already prepared this wtf");
         return;
     }
     Console.WriteLine("[Thread {1}] Preparing {0}", drink, Thread.CurrentThread.ManagedThreadId);
     Thread.Sleep(((int) drink + 1)*1000);
     Console.WriteLine("[Thread {1}] Done preparing {0}", drink, Thread.CurrentThread.ManagedThreadId);
     recentOrders.Add(orderId);
     bus.Publish(new DrinkPrepared
                     {
                         OrderId = orderId,
                         BaristaId = id,
                         Drink = drink
                     });
 }
Exemple #33
0
 public Pub(Music music, Drinks drinks)
 {
     this.Music = music;
     this.Drinks = drinks;
 }
Exemple #34
0
        private static decimal CalculateMoneyMissing(Drinks drink, decimal inputedMoney)
        {
            var result = Prices[drink] - inputedMoney;

            return result;
        }
Exemple #35
0
 private static string DrinkToString(Drinks drink)
 {
     switch (drink)
     {
         case Drinks.Tea:
             return "T";
         case Drinks.Chocolate:
             return "H";
         case Drinks.Coffee:
             return "C";
         case Drinks.Orange:
             return "O";
         default:
             throw new UnknownDrinkException();
     }
 }
Exemple #36
0
        public string Order(Drinks drink, int numberOfSugar, decimal inputedMoney, bool isExtraHot)
        {
            decimal amount;
            if (_checker.IsEmpty(DrinkToString(drink)))
            {
                _emailNotifier.NotifyMissingDrink(DrinkToString(drink));
                return string.Format("M:{0} is out, admin is notified", drink);
            }
            if ((amount = CalculateMoneyMissing(drink, inputedMoney)) > 0)
            {
                return string.Format("M:{0} missing", amount);
            }
            ReportOrderedDrink(drink);

            var str = DrinkToString(drink);
            var sugar = numberOfSugar > 0 ? numberOfSugar.ToString() : string.Empty;
            var touillette = numberOfSugar > 0 ? 0.ToString() : string.Empty;
            var extraHot = isExtraHot ? "h" : string.Empty;
            return string.Format("{0}{3}:{1}:{2}", str, sugar, touillette, extraHot);
        }
Exemple #37
0
 private static void ReportOrderedDrink(Drinks drink)
 {
     _report.SalesPerDrink[drink]++;
     _report.TotalMoneyEarned += CoffeeMachineComander.Prices[drink];
 }