Example #1
0
        private void GetData(int id)
        {
            ProductSearchEngine.EntityClasses.ProductEntity product = new EntityClasses.ProductEntity(id);
            ProductTitle              = product.Title;
            ProductTitleTextBox.Text  = product.Title;
            ProductDetailTextBox.Text = product.DetailDescription;
            ProductFreeShippingStatusRadioButtonList.SelectedIndex = (bool)product.IsFreeShipping ? 1 : 0;
            ProductNewItemStatusRadioButtonList.SelectedIndex      = (bool)product.IsNewItem ? 1 : 0;
            ProductRedirectUrlTextBox.Text = product.RedirectUrl;
            ProductPriceTextBox.Text       = product.Price.ToString();


            CategoryDropDownList.DataSource     = new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCategories();
            CategoryDropDownList.DataTextField  = "Name";
            CategoryDropDownList.DataValueField = "Id";
            CategoryDropDownList.DataBind();

            CategoryDropDownList.Items.FindByValue(((int)new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCatehoryIdBySubCategoryId((int)product.CategoryId)).ToString()).Selected = true;
            CategoryDropDownList_DataBound();
            ListItem liSubCategory = SubCategoryDropDownList.Items.FindByValue(product.CategoryId.ToString());

            if (liSubCategory != null)
            {
                liSubCategory.Selected = true;
            }
            BrandDropDownList.DataSource     = new ProductSearchEngine.Business.Adapters.BrandAdapter().GetBrandList();
            BrandDropDownList.DataTextField  = "Name";
            BrandDropDownList.DataValueField = "Id";
            BrandDropDownList.DataBind();

            ListItem li = BrandDropDownList.Items.FindByValue(product.BrandId.ToString());

            if (li != null)
            {
                li.Selected = true;
            }

            ProductPhotosRepeater.DataSource = product.ProductPhotos;
            ProductPhotosRepeater.DataBind();

            ProductSpecificationsRepeater.DataSource = product.ProductSpecifications;
            ProductSpecificationsRepeater.DataBind();

            ProductKeywordRepeater.DataSource = product.ProductKeywords;
            ProductKeywordRepeater.DataBind();
        }
        private void GetData(int id)
        {
            ProductSearchEngine.EntityClasses.ProductEntity product = new EntityClasses.ProductEntity(id);
            ProductTitle = product.Title;
            ProductTitleTextBox.Text = product.Title;
            ProductDetailTextBox.Text = product.DetailDescription;
            ProductFreeShippingStatusRadioButtonList.SelectedIndex = (bool)product.IsFreeShipping ? 1 : 0;
            ProductNewItemStatusRadioButtonList.SelectedIndex = (bool)product.IsNewItem ? 1 : 0;
            ProductRedirectUrlTextBox.Text = product.RedirectUrl;
            ProductPriceTextBox.Text = product.Price.ToString();

            CategoryDropDownList.DataSource = new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCategories();
            CategoryDropDownList.DataTextField = "Name";
            CategoryDropDownList.DataValueField = "Id";
            CategoryDropDownList.DataBind();

            CategoryDropDownList.Items.FindByValue(((int)new ProductSearchEngine.Business.Adapters.CategoryAdapter().GetMainCatehoryIdBySubCategoryId((int)product.CategoryId)).ToString()).Selected = true;
            CategoryDropDownList_DataBound();
            ListItem liSubCategory = SubCategoryDropDownList.Items.FindByValue(product.CategoryId.ToString());
            if (liSubCategory != null)
                liSubCategory.Selected = true;
            BrandDropDownList.DataSource = new ProductSearchEngine.Business.Adapters.BrandAdapter().GetBrandList();
            BrandDropDownList.DataTextField = "Name";
            BrandDropDownList.DataValueField = "Id";
            BrandDropDownList.DataBind();

            ListItem li = BrandDropDownList.Items.FindByValue(product.BrandId.ToString());
            if (li != null)
                li.Selected = true;

            ProductPhotosRepeater.DataSource = product.ProductPhotos;
            ProductPhotosRepeater.DataBind();

            ProductSpecificationsRepeater.DataSource = product.ProductSpecifications;
            ProductSpecificationsRepeater.DataBind();

            ProductKeywordRepeater.DataSource = product.ProductKeywords;
            ProductKeywordRepeater.DataBind();
        }