void SimpleProductFilter_FilterChanged(object sender, System.EventArgs e) { this.criteria = (ProductSearchCriteria)sender; SaveQuerySettings(); this.currentPage = 1; LoadProducts(); }
private ProductSearchCriteria GetCurrentCriteria() { MerchantTribe.Commerce.Catalog.ProductSearchCriteria c = new MerchantTribe.Commerce.Catalog.ProductSearchCriteria(); if (this.FilterField.Text.Trim().Length > 0) { c.Keyword = this.FilterField.Text.Trim(); } if (this.ManufacturerFilter.SelectedValue != "") { c.ManufacturerId = this.ManufacturerFilter.SelectedValue; } if (this.VendorFilter.SelectedValue != "") { c.VendorId = this.VendorFilter.SelectedValue; } if (this.CategoryFilter.SelectedValue != "") { c.CategoryId = this.CategoryFilter.SelectedValue; } if (this.ExcludeCategoryBvin.Trim().Length > 0) { c.NotCategoryId = this.ExcludeCategoryBvin.Trim(); } c.DisplayInactiveProducts = true; return(c); }
protected void GoPressed(ProductSearchCriteria criteria) { this.Session[criteriaSessionKey] = criteria; //GridView1.DataSource = Catalog.Product.FindByCriteria(criteria) GridView1.DataBind(); GridView1.PageIndex = 0; topLabel.Visible = (GridView1.PageCount > 1); BottomLabel.Visible = (GridView1.PageCount > 1); MultiView1.ActiveViewIndex = (int)Mode.EditView; }
protected void BindGiftCertificateGridView() { ProductSearchCriteria criteria = new ProductSearchCriteria(); //criteria.SpecialProductTypeOne = SpecialProductTypes.GiftCertificate; //criteria.SpecialProductTypeTwo = SpecialProductTypes.ArbitrarilyPricedGiftCertificate; criteria.DisplayInactiveProducts = true; GiftCertificatesGridView.DataSource = MTApp.CatalogServices.Products.FindByCriteria(criteria); GiftCertificatesGridView.DataKeyNames = new string[] { "bvin" }; GiftCertificatesGridView.DataBind(); }
public ProductSearchCriteria LoadProductCriteria() { ProductSearchCriteria c = new ProductSearchCriteria(); if (this.FilterField.Text.Trim().Length > 0) { c.Keyword = this.FilterField.Text.Trim(); } if (this.ManufacturerFilter.SelectedValue != "") { c.ManufacturerId = this.ManufacturerFilter.SelectedValue; } if (this.VendorFilter.SelectedValue != "") { c.VendorId = this.VendorFilter.SelectedValue; } if (this.CategoryFilter.SelectedValue != "") { c.CategoryId = this.CategoryFilter.SelectedValue; } if (this.StatusFilter.SelectedValue != "") { c.Status = (ProductStatus)int.Parse(this.StatusFilter.SelectedValue); } if (this.InventoryStatusFilter.SelectedValue != "") { c.InventoryStatus = (ProductInventoryStatus)int.Parse(this.InventoryStatusFilter.SelectedValue); } if (this.ProductTypeFilter.SelectedValue != "") { c.ProductTypeId = this.ProductTypeFilter.SelectedValue; } //If products.Count = 1 Then // Me.lblResults.Text = "1 product found" //Else // Me.lblResults.Text = products.Count & " products found" //End If // Save Setting to Session SessionManager.AdminProductCriteriaKeyword = this.FilterField.Text.Trim(); SessionManager.AdminProductCriteriaCategory = this.CategoryFilter.SelectedValue; SessionManager.AdminProductCriteriaManufacturer = this.ManufacturerFilter.SelectedValue; SessionManager.AdminProductCriteriaVendor = this.VendorFilter.SelectedValue; SessionManager.AdminProductCriteriaStatus = this.StatusFilter.SelectedValue; SessionManager.AdminProductCriteriaInventoryStatus = this.InventoryStatusFilter.SelectedValue; SessionManager.AdminProductCriteriaProductType = this.ProductTypeFilter.SelectedValue; c.DisplayInactiveProducts = true; return c; }
protected override void OnLoad(System.EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { LoadQuerySettings(); this.criteria = SimpleProductFilter.LoadProductCriteria(); LoadProducts(); this.SimpleProductFilter.Focus(); } RenderNewButtons(); }
public ProductSearchCriteria Clone() { ProductSearchCriteria result = new ProductSearchCriteria(); result.CategoryId = this.CategoryId; result.InventoryStatus = this.InventoryStatus; result.Keyword = this.Keyword; result.ManufacturerId = this.ManufacturerId; result.NotCategoryId = this.NotCategoryId; result.ProductTypeId = this.ProductTypeId; result.Status = this.Status; result.VendorId = this.VendorId; result.DisplayInactiveProducts = this.DisplayInactiveProducts; return result; }
private ProductSearchCriteria GetCurrentCriteria() { MerchantTribe.Commerce.Catalog.ProductSearchCriteria c = new MerchantTribe.Commerce.Catalog.ProductSearchCriteria(); if (this.FilterField.Text.Trim().Length > 0) { c.Keyword = this.FilterField.Text.Trim(); } if (this.ManufacturerFilter.SelectedValue != "") { c.ManufacturerId = this.ManufacturerFilter.SelectedValue; } if (this.VendorFilter.SelectedValue != "") { c.VendorId = this.VendorFilter.SelectedValue; } if (this.CategoryFilter.SelectedValue != "") { c.CategoryId = this.CategoryFilter.SelectedValue; } if (this.ExcludeCategoryBvin.Trim().Length > 0) { c.NotCategoryId = this.ExcludeCategoryBvin.Trim(); } c.DisplayInactiveProducts = true; return c; }
public List <Product> FindByCriteria(ProductSearchCriteria criteria, int pageNumber, int pageSize, ref int totalCount) { var profiler = MiniProfiler.Current; using (profiler.Step("Find By Criteria")) { List <Product> result = new List <Product>(); if (pageNumber < 1) { pageNumber = 1; } int take = pageSize; int skip = (pageNumber - 1) * pageSize; long storeId = context.CurrentStore.Id; IQueryable <Data.EF.bvc_Product> items = repository.Find() .Where(y => y.StoreId == storeId); using (profiler.Step("Build Expression Tree")) { // Display Inactive if (criteria.DisplayInactiveProducts == false) { items = items.Where(y => y.Status == 1); } // Status if (criteria.Status != ProductStatus.NotSet) { items = items.Where(y => y.Status == (int)criteria.Status); } // Inventory Status if (criteria.InventoryStatus != ProductInventoryStatus.NotSet) { if (criteria.InventoryStatus == ProductInventoryStatus.NotAvailable) { items = items.Where(y => y.IsAvailableForSale == false); } else { items = items.Where(y => y.IsAvailableForSale == true); } } // Manufacturer if (criteria.ManufacturerId != string.Empty) { items = items.Where(y => y.ManufacturerID == criteria.ManufacturerId); } // Vendor if (criteria.VendorId != string.Empty) { items = items.Where(y => y.VendorID == criteria.VendorId); } // Keywords if (criteria.Keyword != string.Empty) { items = items.Where(y => y.SKU.Contains(criteria.Keyword) || y.ProductName.Contains(criteria.Keyword) || y.MetaDescription.Contains(criteria.Keyword) || y.MetaKeywords.Contains(criteria.Keyword) || y.ShortDescription.Contains(criteria.Keyword) || y.LongDescription.Contains(criteria.Keyword) || y.Keywords.Contains(criteria.Keyword)); } if (criteria.CategoryId != string.Empty) { items = items.Where(y => y.bvc_ProductXCategory.Where(z => z.CategoryId == criteria.CategoryId).FirstOrDefault() != null); // Sort switch (criteria.CategorySort) { case CategorySortOrder.ProductName: items = items.OrderBy(y => y.ProductName); break; case CategorySortOrder.ProductPriceAscending: items = items.OrderBy(y => y.SitePrice); break; case CategorySortOrder.ProductPriceDescending: items = items.OrderByDescending(y => y.SitePrice); break; default: // TODO: This needs to respect merchant set sort order instead. items = items.OrderBy(y => y.ProductName); items = items.OrderBy(y => y.bvc_ProductXCategory.Where(z => z.CategoryId == criteria.CategoryId).Select(z => z.SortOrder).FirstOrDefault()); break; } } else { items = items.OrderBy(y => y.ProductName); } } // Get Total Count IQueryable <Data.EF.bvc_Product> itemsForCount = items; using (profiler.Step("Count Items")) { totalCount = itemsForCount.Count(); } // Get Paged using (profiler.Step("Page Items")) { items = items.Skip(skip).Take(take); } if (items != null) { using (profiler.Step("List Poco Products")) { result = ListPoco(items); } } return(result); } }
public List <Product> FindByCriteria(ProductSearchCriteria criteria) { int temp = -1; return(FindByCriteria(criteria, 1, int.MaxValue, ref temp)); }