Example #1
0
        protected void l3_Click(object sender, EventArgs e)
        {
            ENLootCrate loot = new ENLootCrate(0, "", 0.0F, "", Image4.ImageUrl.ToString(), "Lootcrate");

            if (loot.readLootCrate())
            {
                Response.Redirect("Product.aspx?lootid=" + loot.id);
            }
        }
        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