Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            prodcd = Request.QueryString["prodcd"].ToString();
            var prod = new Product();
            prod.GetProductByCode(prodcd);
            title.Text = prod.Name.ToString();
            productCode.Text = prod.ProductCode.ToString();
            brand.Text = prod.Brand.ToString();

            //Get configurations
            Configuration config = new Configuration();
            config.GetConfigurationByCode("xCurrencyCode");

            price.Text = "$" + prod.Msrp.ToString() + " " + config.Value;

            LabelDescription.Text = prod.Description.ToString();

            //If the unlimited quantity flag is set...
            if (Convert.ToBoolean(prod.IsQuantityUnlimited) == true)
            {
                quantity.Text = "Quantity Remaining: Unlimited";
            }
            else
            {
                quantity.Text = "Quantity Remaining: " + prod.QuantityInStock.ToString();
            }

            //Attempt to display image (if it is found)
            try
            {
                itemPic.ImageUrl = "~/Images/Product_Images/" + prodcd + ".jpg";
            }
            catch (Exception)
            {
                itemPic.ImageUrl = "";
            }

            //Fill gridview with available delivery types
            ProductDeliveryType pdt = new ProductDeliveryType();
            List<ProductDeliveryType> pdtypes = pdt.GetAllProductDeliveryTypesByProdCode(prodcd);

            List<DeliveryType> deliveryTypes = new List<DeliveryType>();
            foreach (ProductDeliveryType prodDelType in pdtypes)
            {
                DeliveryType dt = new DeliveryType();
                dt.GetDeliveryTypeByID(prodDelType.DeliveryTypeID);
                deliveryTypes.Add(dt);
            }

            GridViewDeliveryTypes.DataSource = deliveryTypes;
            GridViewDeliveryTypes.DataBind();

            //Don't show "Delivery Types" title if there are no delivery types listed
            if (deliveryTypes.Count == 0)
            {
                LabelDeliveryTypesTitle.Visible = false;
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AdministratorID"] == null)
                Response.Redirect("~/Admin/Login.aspx");
            else
            {
                if (!Page.IsPostBack)
                {
                    //Populate the featured product dropdowns
                    Product prod = new Product();
                    List<Product> products = prod.GetAllProducts(true);
                    DropDownListFeaturedProduct1.DataSource = products;
                    DropDownListFeaturedProduct1.DataTextField = "ProductCode";
                    DropDownListFeaturedProduct1.DataValueField = "ProductCode";
                    DropDownListFeaturedProduct1.DataBind();
                    Configuration config1 = new Configuration();
                    config1.GetConfigurationByCode("xFeaturedProduct1");
                    DropDownListFeaturedProduct1.SelectedValue = config1.Value.ToString();

                    DropDownListFeaturedProduct2.DataSource = products;
                    DropDownListFeaturedProduct2.DataTextField = "ProductCode";
                    DropDownListFeaturedProduct2.DataValueField = "ProductCode";
                    DropDownListFeaturedProduct2.DataBind();
                    Configuration config2 = new Configuration();
                    config2.GetConfigurationByCode("xFeaturedProduct2");
                    DropDownListFeaturedProduct2.SelectedValue = config2.Value.ToString();

                    DropDownListFeaturedProduct3.DataSource = products;
                    DropDownListFeaturedProduct3.DataTextField = "ProductCode";
                    DropDownListFeaturedProduct3.DataValueField = "ProductCode";
                    DropDownListFeaturedProduct3.DataBind();
                    Configuration config3 = new Configuration();
                    config3.GetConfigurationByCode("xFeaturedProduct3");
                    DropDownListFeaturedProduct3.SelectedValue = config3.Value.ToString();

                    DropDownListFeaturedProduct4.DataSource = products;
                    DropDownListFeaturedProduct4.DataTextField = "ProductCode";
                    DropDownListFeaturedProduct4.DataValueField = "ProductCode";
                    DropDownListFeaturedProduct4.DataBind();
                    Configuration config4 = new Configuration();
                    config4.GetConfigurationByCode("xFeaturedProduct4");
                    DropDownListFeaturedProduct4.SelectedValue = config4.Value.ToString();
                }
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //Load the slider images and details
            Configuration config = new Configuration();
            Product prod = new Product();

            //Slide 1
            config.GetConfigurationByCode("xFeaturedProduct1");
            prod.GetProductByCode(config.Value.ToString());

            //Attempt to display image (if it is found)
            try
            {
                ImageFeatured1.Src = "~/Images/Product_Images/" + prod.ProductCode + ".jpg";
            }
            catch (Exception)
            {
                ImageFeatured1.Src = "";
            }

            LabelFeaturedBrand1.Text = prod.Brand.ToString();
            LabelFeaturedName1.Text = prod.Name.ToString();
            LabelFeaturedPrice1.Text = "Only $" + prod.Msrp.ToString();
            LinkButtonFeatured1.PostBackUrl = "~/ProductInfo.aspx?prodcd=" + prod.ProductCode.ToString();

            //Slide 2
            config.GetConfigurationByCode("xFeaturedProduct2");
            prod.GetProductByCode(config.Value.ToString());

            //Attempt to display image (if it is found)
            try
            {
                ImageFeatured2.Src = "~/Images/Product_Images/" + prod.ProductCode + ".jpg";
            }
            catch (Exception)
            {
                ImageFeatured2.Src = "";
            }

            LabelFeaturedBrand2.Text = prod.Brand.ToString();
            LabelFeaturedName2.Text = prod.Name.ToString();
            LabelFeaturedPrice2.Text = "Only $" + prod.Msrp.ToString();

            //Slide 3
            config.GetConfigurationByCode("xFeaturedProduct3");
            prod.GetProductByCode(config.Value.ToString());

            //Attempt to display image (if it is found)
            try
            {
                ImageFeatured3.Src = "~/Images/Product_Images/" + prod.ProductCode + ".jpg";
            }
            catch (Exception)
            {
                ImageFeatured3.Src = "";
            }

            LabelFeaturedBrand3.Text = prod.Brand.ToString();
            LabelFeaturedName3.Text = prod.Name.ToString();
            LabelFeaturedPrice3.Text = "Only $" + prod.Msrp.ToString();

            //Slide 4
            config.GetConfigurationByCode("xFeaturedProduct4");
            prod.GetProductByCode(config.Value.ToString());

            //Attempt to display image (if it is found)
            try
            {
                ImageFeatured4.Src = "~/Images/Product_Images/" + prod.ProductCode + ".jpg";
            }
            catch (Exception)
            {
                ImageFeatured4.Src = "";
            }

            LabelFeaturedBrand4.Text = prod.Brand.ToString();
            LabelFeaturedName4.Text = prod.Name.ToString();
            LabelFeaturedPrice4.Text = "Only $" + prod.Msrp.ToString();

            //Load the data list (THIS IS A TEMPORARY WAY...CHOOSES FIRST 6 PRODUCTS)
            List<Product> allProducts = new List<Product>();
            allProducts = prod.GetAllProducts(true);
            List<Product> frontpageProducts = new List<Product>();
            for (int i = 0; i < 6; i++)
            {
                frontpageProducts.Add(allProducts[i]);
            }
            DataListProducts.DataSource = frontpageProducts;
            DataListProducts.DataBind();
        }