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;
        }
 protected void saveButton_Click(object sender, EventArgs e)
 {
     try
     {
         Drinks newDrinks = new Drinks();
         newDrinks.Name = nameTextBox.Text;
         newDrinks.Type = typeTextBox.Text;
         newDrinks.Flavors = flavorTextBox.Text;
         newDrinks.Price = decimal.Parse(priceTextBox.Text);
         newDrinks.Origin = countryTextBox.Text;
         newDrinks.Quantity = weightTextBox.Text;
         newDrinks.Review = reviewTextBox.Text;
         newDrinks.Image = "../Images/DrinksImages/" + imageDropDownList.SelectedValue;
         outPutLabel.Text = aDrinksGateway.SaveDrinks(newDrinks);
         ClearAllTextBox();
         resultLabel.Text = "";
     }
     catch (Exception) {
         outPutLabel.Text = "Save Faild!";
     }
 }
        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;
        }
 public string SaveDrinks(Drinks aDrinks)
 {
     SqlConnection connection = new SqlConnection(connectionString);
     string query = "INSERT INTO DrinksTBL VALUES('" + aDrinks.Name + "','" + aDrinks.Type + "','" + aDrinks.Flavors + "','" + aDrinks.Price + "','" + aDrinks.Origin + "','" + aDrinks.Quantity + "','" + aDrinks.Review + "','" + aDrinks.Image + "')";
     SqlCommand command = new SqlCommand(query, connection);
     connection.Open();
     int rowAffected = command.ExecuteNonQuery();
     connection.Close();
     if (rowAffected > 0)
     {
         return "Saved Successful!";
     }
     else {
         return "Save Faild!";
     }
 }