Exemple #1
0
        private void PopulateControls(ProductDetails pd)
        {
            titleLabel.Text = pd.Name;
            descriptionLabel.Text = pd.Description;
            priceLabel.Text = String.Format("{0:c}", pd.Price);
            productImage.ImageUrl = "ProductImages/" + pd.Image;

            this.Title = GiftShopConfiguration.SiteName + " " + pd.Name;
        }
Exemple #2
0
        public static ProductDetails GetProductDetails(string productId)
        {
            DbCommand command = GenericDataAccess.CreateCommand();
            command.CommandText = "CatalogGetProductDetails";

            DbParameter parameter = command.CreateParameter();
            parameter.ParameterName = "@ProductID";
            parameter.Value = productId;
            parameter.DbType = DbType.Int32;

            command.Parameters.Add(parameter);

            DataTable table = GenericDataAccess.ExecuteSelectCommand(command);

            ProductDetails details = new ProductDetails();

            if (table.Rows.Count > 0)
            {
                DataRow dr = table.Rows[0];

                details.ProductID = int.Parse(productId);
                details.Name = dr["Name"].ToString();
                details.Description = dr["Description"].ToString();
                details.Price = Decimal.Parse(dr["Price"].ToString());
                details.Thumbnail = dr["Thumbnail"].ToString();
                details.Image = dr["Image"].ToString();
                details.PromoFront = bool.Parse(dr["PromoFront"].ToString());
                details.PromoDept = bool.Parse(dr["PromoDept"].ToString());
            }

            return details;
        }