protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies["damncookie"];

            if (cookie == null)
            {
                //Rating
                RatingLabel.Visible  = false;
                UpdatePanel1.Visible = false;

                //Comments
                CommentLabel.Visible   = false;
                CommentTextBox.Visible = false;

                //Boton send Rating
                SendRating.Visible = false;
            }

            ENProduct product = new ENProduct(0, "", 0.0F, 0, "", "", "", "");
            ENBottle  bottle  = new ENBottle();

            product.id = Convert.ToInt32(Request.QueryString["id"]);
            ENLootCrate loot = new ENLootCrate(0, "", 0.0F, "", "", "");

            loot.id = Convert.ToInt32(Request.QueryString["lootid"]);

            if (product.ReadProductFromCatalog() && loot.id == 0)
            {
                //Limt the amount to buy to the product stock
                AmountRV.MaximumValue = Convert.ToString(product.stock);
                AmountRV.MinimumValue = "1";

                //Image url
                ProductImage.ImageUrl = product.url;
                //Product Name
                ProductNameLabel.Text = product.name;
                //Product price
                ProductPriceLabel.Text = product.price.ToString() + "€";
                //Brand
                ProductBrandLabel.Text = product.brand;
                //Descripción
                DescriptionTextLabel.Text = product.description;

                if (product.type == "botella")
                {
                    bottle.id = product.id;

                    if (bottle.ReadBottle())
                    {
                        //Volume
                        VolumenLabel.Visible       = true;
                        ProductVolumeLabel.Visible = true;
                        ProductVolumeLabel.Text    = bottle.volume.ToString() + " mL";

                        //Gradde
                        GradoLabel.Visible        = true;
                        ProductGradeLabel.Visible = true;
                        ProductGradeLabel.Text    = bottle.grade.ToString() + " %";

                        //Alcoholic Type
                        TipoDeAlcoholLabel.Visible   = true;
                        ProdAlcoholTypeLabel.Visible = true;
                        ProdAlcoholTypeLabel.Text    = bottle.alcoholicType;
                    }
                }
            }
            else
            {
                if (loot.readLootCrateID())
                {
                    AmountRV.MinimumValue = "0";
                    AmountRV.MaximumValue = "1";
                    AmountRV.Enabled      = false;

                    //Hide Marca
                    MarcaLabel.Visible        = false;
                    ProductBrandLabel.Visible = false;

                    //Hide choose amount
                    ProdAmount.Visible    = false;
                    CantidadLabel.Visible = false;

                    //hide add to cart
                    AddCartButton.Visible = false;

                    //Show Image
                    ProductImage.ImageUrl = loot.url;

                    //Show name
                    ProductNameLabel.Text = loot.nameLootCrate;

                    //Show price
                    ProductPriceLabel.Text = Convert.ToString(loot.price);

                    //Show description
                    DescriptionTextLabel.Text = loot.descriptionLootCrate;
                }
            }
        }//end page load
        protected void addProductBT_Click(object sender, EventArgs e)
        {
            ENProduct newProduct = new ENProduct(0, "", 0.00F, 0, "", "", "", "");
            float     bottleGrade = 0.0F, bottleVolume = 0.0F;
            string    bottleType = "";
            int       productCod = 0;

            //para la url de la imagen
            HttpPostedFile file = pictureUpload.PostedFile;
            string         url  = "";

            //check file was submitted
            if (file != null && file.ContentLength > 0)
            {
                string fname = Path.GetFileName(file.FileName);
                url = Path.Combine("~/Imagenes/", fname);
                file.SaveAs(Server.MapPath(url));
            }
            else
            {
                url = "~/Imagenes/fotoPerfil.jpg";
            }

            try {
                //Get product properties
                newProduct.price = float.Parse(NewProdPriceTB.Text); //Puede dar excepcion
                newProduct.name  = NewProdNameTB.Text;
                newProduct.brand = NewProdBrandTB.Text;
                newProduct.stock = Convert.ToInt32(NewProdStockTB.Text);
                newProduct.url   = url;

                //Item[0] -> Botella Alcohol, Item[1] -> Miscelanea
                if (ProdTypeDropDown.Items[0].Selected)
                {
                    newProduct.type = "botella";
                }
                else if (ProdTypeDropDown.Items[1].Selected)
                {
                    newProduct.type = "miscelanea";
                }
                else if (ProdTypeDropDown.Items[2].Selected)
                {
                    newProduct.type = "pack";
                }

                //In case the description is not empty
                if (NewProdDescriptionTB.Text != "")
                {
                    newProduct.description = NewProdDescriptionTB.Text;
                }
                else
                {
                    newProduct.description = "Este producto aún tiene una descripción";
                }


                //When the product type is "miscelanea" or "pack"
                if (ProdTypeDropDown.Items[1].Selected || ProdTypeDropDown.Items[2].Selected)
                {
                    if (ProdTypeDropDown.Items[2].Selected)
                    {
                        ENPack pack = new ENPack(newProduct.name, newProduct.price, newProduct.description, newProduct.url, newProduct.stock, newProduct.brand);

                        if (pack.createPack())
                        {
                            ProductCreatedLabel.Visible = true;
                        }
                        else
                        {
                            ErrorCreatingProductLabel.Visible = true;
                        }
                    }
                    else
                    {
                        if (newProduct.CreateProduct())
                        {
                            ProductCreatedLabel.Visible = true;
                        }
                        else
                        {
                            ErrorCreatingProductLabel.Visible = true;
                        }
                    }

                    //product type is "botella"
                }
                else if (ProdTypeDropDown.Items[0].Selected)
                {
                    //Los parse pueden dar excepciones
                    bottleGrade  = float.Parse(NewProdGradeTB.Text);
                    bottleVolume = float.Parse(NewProdVolumeTB.Text);
                    bottleType   = AlcoholicTypeDropDown.Text;

                    if (newProduct.CreateProduct())  //Create base product

                    {
                        if (newProduct.ReadProductName())
                        {
                            productCod = newProduct.id;
                            ENBottle newBottle = new ENBottle(productCod, bottleGrade, bottleVolume, bottleType);

                            if (newBottle.CreateBottle())  //Create bottle

                            {
                                ProductCreatedLabel.Visible       = true;
                                ErrorCreatingProductLabel.Visible = false;
                            }
                        }
                        else
                        {
                            ErrorCreatingProductLabel.Visible = true;
                            ProductCreatedLabel.Visible       = false;
                        }
                    }
                }
                else
                {
                    ErrorCreatingProductLabel.Visible = true;
                    ProductCreatedLabel.Visible       = true;
                }
            }catch (Exception Ex) {
                Console.WriteLine("Se ha introducido texto en un campo destinao a ser númerico. ", Ex.Message);

                if (ProdTypeDropDown.Items[1].Selected)
                {
                    ConvertErrorLabel.Visible  = true;
                    NewProdPriceTB.BorderColor = System.Drawing.Color.Red;
                }
                else if (ProdTypeDropDown.Items[0].Selected)
                {
                    ConvertErrorLabel.Visible   = true;
                    NewProdPriceTB.BorderColor  = System.Drawing.Color.Red;
                    NewProdGradeTB.BorderColor  = System.Drawing.Color.Red;
                    NewProdVolumeTB.BorderColor = System.Drawing.Color.Red;
                }
            }
        }