protected void BindNarrowByManufacturerPanel()
 {
     Trace.Write(this.GetType().ToString(), "Begin BindNarrowByManufacturerPanel");
     if (!ExpandManufacturerLink.Visible)
     {
         NarrowByManufacturerPanel.Visible = true;
         if (_manufacturers.Count > _MaximumManufacturers)
         {
             if (ShowAllManufacturers.Visible)
             {
                 int count = _manufacturers.Count - _MaximumManufacturers;
                 for (int i = 0; i < count; i++)
                 {
                     if (_manufacturers.Count > _MaximumManufacturers)
                     {
                         _manufacturers.RemoveAt(_MaximumManufacturers);
                     }
                 }
             }
         }
         else
         {
             ShowAllManufacturers.Visible = false;
         }
         ManufacturerList.DataSource = _manufacturers;
         ManufacturerList.DataBind();
         NarrowByManufacturerPanel.Visible = (ManufacturerList.Items.Count > 0);
     }
     else
     {
         NarrowByManufacturerPanel.Visible = false;
     }
     Trace.Write(this.GetType().ToString(), "End BindNarrowByManufacturerPanel");
 }
Ejemplo n.º 2
0
        private void BindManufacturers()
        {
            IList <Manufacturer> manufacturers = ManufacturerDataSource.LoadAll("Name");
            int index = manufacturers.IndexOf(_ManufacturerId);

            if (index > -1)
            {
                manufacturers.RemoveAt(index);
            }
            ManufacturerList.DataSource = manufacturers;
            ManufacturerList.DataBind();
        }
Ejemplo n.º 3
0
 protected void NewManufacturerLink_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(NewManufacturerName.Value))
     {
         Manufacturer manufacturer = ManufacturerDataSource.LoadForName(NewManufacturerName.Value, true);
         ManufacturerList.DataBind();
         ListItem selectedItem = ManufacturerList.Items.FindByValue(manufacturer.Id.ToString());
         if (selectedItem != null)
         {
             ManufacturerList.SelectedIndex = ManufacturerList.Items.IndexOf(selectedItem);
         }
     }
 }
        private void LoadSearchFilter()
        {
            ProductFilter criteria = Session["ProductSearchFilter"] as ProductFilter;

            if (criteria != null)
            {
                Name.Text = criteria.Name;
                SearchDescriptions.Checked = criteria.SearchDescriptions;
                Sku.Text = criteria.Sku;
                ListItem selectedItem = null;

                if (!_DisplayCategorySearch)
                {
                    CategoriesList.DataBind();
                    selectedItem = CategoriesList.Items.FindByValue(criteria.CategoryId.ToString());
                    if (selectedItem != null)
                    {
                        CategoriesList.SelectedIndex = CategoriesList.Items.IndexOf(selectedItem);
                    }
                }
                else
                {
                    Category selectedCategory = CategoryDataSource.Load(criteria.CategoryId);
                    if (selectedCategory != null)
                    {
                        CategoryAutoComplete.Text = selectedCategory.Name;
                    }
                    HiddenSelectedCategoryId.Value = criteria.CategoryId.ToString();
                }

                ManufacturerList.DataBind();
                selectedItem = ManufacturerList.Items.FindByValue(criteria.ManufacturerId.ToString());
                if (selectedItem != null)
                {
                    ManufacturerList.SelectedIndex = ManufacturerList.Items.IndexOf(selectedItem);
                }

                VendorList.DataBind();
                selectedItem = VendorList.Items.FindByValue(criteria.VendorId.ToString());
                if (selectedItem != null)
                {
                    VendorList.SelectedIndex = VendorList.Items.IndexOf(selectedItem);
                }

                ProductGroups.DataBind();
                selectedItem = ProductGroups.Items.FindByValue(criteria.GroupId.ToString());
                if (selectedItem != null)
                {
                    ProductGroups.SelectedIndex = ProductGroups.Items.IndexOf(selectedItem);
                }

                OnlyFeatured.Checked = criteria.Featured == BitFieldState.True;
                FromPrice.Text       = criteria.FromPrice.ToString();
                ToPrice.Text         = criteria.ToPrice.ToString();

                OnlyDigitalGoods.Checked      = criteria.DigitalGoodsOnly;
                OnlyGiftCertificates.Checked  = criteria.GiftCertificatesOnly;
                OnlyKits.Checked              = criteria.KitsOnly;
                OnlySubscriptions.Checked     = criteria.SubscriptionsOnly;
                ShowProductThumbnails.Checked = criteria.IncludeThumbnails;
            }
        }