private void LoadProduct() { Product prod = new Product(); prod.ProductId = int.Parse(Request.QueryString["ProductId"]); ProcessGetProductByProductId getProduct = new ProcessGetProductByProductId(); getProduct.Product = prod; try { getProduct.Invoke(); } catch (Exception ex) { this.litError.Text = ex.StackTrace; } this.litProductName.Text = getProduct.Product.Name; this.litProductDescription.Text = getProduct.Product.Description; this.litPrice.Text = string.Format("{0:c}", getProduct.Product.Price); this.imgProduct.ImageUrl = "~/images/Catalogue/large/" + getProduct.Product.ImageUrl; this.ddlSizes.DataTextField = "Availability"; this.ddlSizes.DataValueField = "StockLevel"; this.ddlSizes.DataSource = getProduct.ProductSize; this.ddlSizes.DataBind(); this.hlProductImage.NavigateUrl = "~/images/Catalogue/large/" + getProduct.Product.ImageUrl; }
private void LoadProduct() { Product prod = new Product(); prod.ProductId = int.Parse(Request.QueryString["ProductId"]); ProcessGetProductByProductId getProduct = new ProcessGetProductByProductId(); getProduct.Product = prod; try { getProduct.Invoke(); } catch (Exception ex) { this.litError.Text = ex.StackTrace; } this.litProductName.Text = getProduct.Product.Name; this.litProductDescription.Text = getProduct.Product.Description; this.litPrice.Text = string.Format("{0:}", getProduct.Product.Price); this.imgProduct.ImageUrl = "images/Catalogue/large/" + getProduct.Product.ImageUrl; this.LoadSizes(prod.Name, prod.ProductColour.ProductColourId); }
private void LoadSubCategories() { Product prod = new Product(); prod.ProductId = int.Parse(Request.QueryString["ProductId"]); ProcessGetProductByProductId getProduct = new ProcessGetProductByProductId(); getProduct.Product = prod; getProduct.Invoke(); SubCategory subCategory = new SubCategory(); subCategory.ProductCategoryId = getProduct.Product.ProductCategoryId; ProcessGetSubCategoryByProductCategoryId processGetSubCategory = new ProcessGetSubCategoryByProductCategoryId(); processGetSubCategory.SubCategory = subCategory; try { processGetSubCategory.Invoke(); } catch (Exception ex) { Response.Redirect("~/ErrorPage.aspx"); } ddlSubCategory.DataTextField = "SubCategoryDisplayName"; ddlSubCategory.DataValueField = "SubCategoryId"; ddlSubCategory.DataSource = processGetSubCategory.ResultSet; ddlSubCategory.DataBind(); }
private void LoadProduct() { Product prod = new Product(); prod.ProductId = int.Parse( Request.QueryString["ProductId"] ); ProcessGetProductByProductId getProduct = new ProcessGetProductByProductId(); getProduct.Product = prod; ProcessGetProductStockLevelById getStockLevel = new ProcessGetProductStockLevelById(); getStockLevel.ProductId = prod.ProductId; try { getProduct.Invoke(); getStockLevel.Invoke(); this.txtName.Text = getProduct.Product.Name; this.txtDescription.Text = getProduct.Product.Description; this.txtPrice.Text = getProduct.Product.Price.ToString(); this.imgProductDetail.ImageUrl = "../Images/catalogue/small/" + getProduct.Product.ImageUrl.ToString(); this.ddlCategory.SelectedIndex = this.ddlCategory.Items.IndexOf(this.ddlCategory.Items.FindByText(getProduct.Product.ProductCategory.ProductCategoryName)); this.ddlSubCategory.SelectedIndex = this.ddlSubCategory.Items.IndexOf(this.ddlSubCategory.Items.FindByText(getProduct.Product.SubCategory.SubCategoryDisplayName)); this.ddlColour.SelectedIndex = this.ddlColour.Items.IndexOf(this.ddlColour.Items.FindByText(getProduct.Product.ProductColour.ProductColourName)); //this.ddlSize.SelectedIndex = this.ddlSize.Items.IndexOf(this.ddlSize.Items.FindByText(getProduct.Product.ProductSize.ProductSizeName)); this.ddlWeight.SelectedIndex = this.ddlWeight.Items.IndexOf(this.ddlWeight.Items.FindByText(getProduct.Product.ProductWeight.ProductWeightName)); this.litImageId.Text = getProduct.Product.ImageId.ToString(); if (getStockLevel.ResultSet.Tables[0].Rows.Count > 0) this.txtSmall.Text = getStockLevel.ResultSet.Tables[0].Rows[0]["StockLevel"].ToString(); else this.txtSmall.Text = "0"; if (getStockLevel.ResultSet.Tables[0].Rows.Count > 1) this.txtMedium.Text = getStockLevel.ResultSet.Tables[0].Rows[1]["StockLevel"].ToString(); else this.txtMedium.Text = "0"; if (getStockLevel.ResultSet.Tables[0].Rows.Count > 2) this.txtLarge.Text = getStockLevel.ResultSet.Tables[0].Rows[2]["StockLevel"].ToString(); else this.txtLarge.Text = "0"; //this.txtStockLevel.Text = getProduct.Product.StockLevel.ToString(); // Save product image Id in case user does not want to update image. SavedProductImageUrl = getProduct.Product.ImageUrl; SavedProductImageId = getProduct.Product.ImageId; } catch(Exception ex) { Response.Write(ex); } }