protected void Page_Load(object sender, EventArgs e) { SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resources.Resource.Admin_Brands_Header)); if (!IsPostBack) { _paging = new SqlPaging { TableName = "[Catalog].[Brand] left join Catalog.Photo on Photo.ObjId = Brand.BrandID and Type = @Type ", ItemsPerPage = 10 }; _paging.AddFieldsRange(new List<Field> { new Field { Name = "BrandID as ID", IsDistinct = true }, new Field {Name = "ProductsCount", SelectExpression="(Select Count(ProductID) from Catalog.Product Where Product.BrandID=Brand.BrandID) as ProductsCount"}, new Field {Name = "PhotoName as BrandLogo"}, new Field {Name = "Enabled"}, new Field {Name = "SortOrder", Sorting = SortDirection.Ascending}, new Field {Name = "BrandName", Sorting=SortDirection.Ascending} }); _paging.AddParam(new SqlParam { Value = PhotoType.Brand.ToString(), ParameterName = "@Type" }); grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif"); _paging.ItemsPerPage = 10; pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; ViewState["Paging"] = _paging; } else { _paging = (SqlPaging)(ViewState["Paging"]); _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue); if (_paging == null) { throw (new Exception("Paging lost")); } string strIds = Request.Form["SelectedIds"]; if (!string.IsNullOrEmpty(strIds)) { strIds = strIds.Trim(); string[] arrids = strIds.Split(' '); _selectionFilter = new InSetFieldFilter(); if (arrids.Contains("-1")) { _selectionFilter.IncludeValues = false; _inverseSelection = true; } else { _selectionFilter.IncludeValues = true; } _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray(); } } }
protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(Request["categoryid"]) || !Int32.TryParse(Request["categoryid"], out _categoryId)) { Error404(); } Category = CategoryService.GetCategory(_categoryId); if (Category == null || Category.Enabled == false || Category.ParentsEnabled == false) { Error404(); return; } Indepth = Request["indepth"] == "1" || Category.DisplayChildProducts; _priceField = CustomerSession.CurrentCustomer.PriceType.ToString(); _paging = new SqlPaging { TableName = "[Catalog].[Product] " + "LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] " + "inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] " + "Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] " + "LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId " + "Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId " + "LEFT JOIN [Customers].[LastPrice] ON [LastPrice].[ProductId] = [Product].[ProductId] AND [LastPrice].[CustomerId] = @CustomerId" }; _paging.AddFieldsRange( new List<Field> { new Field {Name = "[Product].[ProductID]", IsDistinct = true}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc"}, new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true}, new Field {Name = "BriefDescription"}, new Field {Name = "Product.ArtNo"}, new Field {Name = "Name"}, new Field {Name = string.Format("(CASE WHEN {0}=0 THEN 0 ELSE 1 END) as TempSort", _priceField), Sorting=SortDirection.Descending}, new Field {Name = "Recomended"}, new Field {Name = "Bestseller"}, new Field {Name = "New"}, new Field {Name = "OnSale"}, new Field {Name = "Discount"}, new Field {Name = "Offer.Main", NotInQuery=true}, new Field {Name = "Offer.OfferID"}, new Field {Name = "(Select Max(Offer.Amount) from catalog.Offer Where ProductId=[Product].[ProductID]) as Amount"}, new Field {Name = "(CASE WHEN (Select Max(Offer.Amount) from catalog.Offer Where ProductId=[Product].[ProductID]) <= 0 OR (Select Max(Offer.Amount) from catalog.Offer Where ProductId=[Product].[ProductID]) < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending}, new Field {Name = "MinAmount"}, new Field {Name = "MaxAmount"}, new Field {Name = "Multiplicity"}, new Field {Name = "Enabled"}, new Field {Name = "AllowPreOrder"}, new Field {Name = "Ratio"}, new Field {Name = "RatioID"}, new Field {Name = "DateModified"}, new Field {Name = "ShoppingCartItemId"}, new Field {Name = "UrlPath"}, new Field {Name = !Indepth ? "[ProductCategories].[SortOrder]" : "0 as SortOrder"}, new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true}, new Field {Name = "BrandID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true}, new Field {Name = "Offer.ColorID"}, new Field {Name = "CategoryEnabled", NotInQuery=true}, }); if (SettingsCatalog.ComplexFilter) { _paging.AddFieldsRange(new List<Field> { new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"}, new Field {Name = string.Format("(select max ({0}) - min ({0}) from catalog.offer where offer.productid=product.productid) as MultiPrices", _priceField)}, new Field {Name = string.Format("(select min ({0}) from catalog.offer where offer.productid=product.productid) as Price", _priceField)}, }); } else { _paging.AddFieldsRange(new List<Field> { new Field {Name = "null as Colors"}, new Field {Name = "0 as MultiPrices"}, new Field { Name = SettingsCatalog.UseLastPrice ? string.Format("(CASE WHEN ProductPrice IS NULL THEN {0} ELSE ProductPrice END) as Price", _priceField) : string.Format("{0} as Price", _priceField) }, }); } _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); ProductsCount = Indepth ? Category.TotalProductsCount : Category.GetProductCount(); categoryView.CategoryID = _categoryId; categoryView.Visible = Category.DisplayStyle == "True" || ProductsCount == 0; pnlSort.Visible = ProductsCount > 0; productView.Visible = ProductsCount > 0; catalogView.CategoryID = _categoryId; filterProperty.CategoryId = _categoryId; filterBrand.CategoryId = _categoryId; filterBrand.InDepth = Indepth; filterSize.CategoryId = _categoryId; filterSize.InDepth = Indepth; filterColor.CategoryId = _categoryId; filterColor.InDepth = Indepth; filterPrice.CategoryId = _categoryId; filterPrice.InDepth = Indepth; filterPrice.PriceType = CustomerSession.CurrentCustomer.PriceType; lblCategoryName.Text = _categoryId != 0 ? Category.Name : Resource.Client_MasterPage_Catalog; breadCrumbs.Items = CategoryService.GetParentCategories(_categoryId).Select(parent => new BreadCrumbs { Name = parent.Name, Url = UrlService.GetLink(ParamType.Category, parent.UrlPath, parent.CategoryId) }).Reverse().ToList(); breadCrumbs.Items.Insert(0, new BreadCrumbs { Name = Resource.Client_MasterPage_MainPage, Url = UrlService.GetAbsoluteLink("/") }); var categoryMeta = SetMeta(Category.Meta, Category.Name, page: paging.CurrentPage); lblCategoryName.Text = categoryMeta.H1; if (Category.DisplayChildProducts || Indepth) { var cfilter = new InChildCategoriesFieldFilter { CategoryId = _categoryId.ToString(), ParamName = "@CategoryID" }; _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter; } else { var cfilter = new EqualFieldFilter { Value = _categoryId.ToString(), ParamName = "@catalog" }; _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter; } _paging.Fields["Enabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@enabled" }; _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@CategoryEnabled" }; var logicalFilter = new LogicalFilter{ ParamName = "@Main", HideInCustomData = true }; logicalFilter.AddFilter(new EqualFieldFilter {Value = "1", ParamName = "@Main1", HideInCustomData = true}); logicalFilter.AddLogicalOperation("OR"); logicalFilter.AddFilter(new NullFieldFilter { Null = true, ParamName = "@Main2", HideInCustomData = true }); _paging.Fields["Offer.Main"].Filter = logicalFilter; BuildSorting(); BuildFilter(); }
protected void Page_Load(object sender, EventArgs e) { _paging = new SqlPaging { TableName = "[Catalog].[Product] LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId" }; _paging.AddFieldsRange( new List <Field> { new Field { Name = "[Product].[ProductID]", IsDistinct = true }, //new Field {Name = "PhotoName AS Photo"}, new Field { Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto" }, new Field { Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo" }, new Field { Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc" }, new Field { Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors" }, //new Field {Name = "[Photo].[Description] AS PhotoDesc"}, new Field { Name = "[ProductCategories].[CategoryID]", NotInQuery = true }, new Field { Name = "BriefDescription" }, new Field { Name = "Product.ArtNo" }, new Field { Name = "Name" }, new Field { Name = "(CASE WHEN Price=0 THEN 0 ELSE 1 END) as TempSort", Sorting = SortDirection.Descending }, new Field { Name = "Recomended" }, new Field { Name = "Bestseller" }, new Field { Name = "New" }, new Field { Name = "OnSale" }, new Field { Name = "Discount" }, new Field { Name = "Offer.Main", NotInQuery = true }, new Field { Name = "Offer.OfferID" }, new Field { Name = "Offer.Amount" }, new Field { Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting = SortDirection.Descending }, new Field { Name = "MinAmount" }, new Field { Name = "MaxAmount" }, new Field { Name = "Enabled" }, new Field { Name = "AllowPreOrder" }, new Field { Name = "Ratio" }, new Field { Name = "RatioID" }, new Field { Name = "DateModified" }, new Field { Name = "ShoppingCartItemId" }, new Field { Name = "UrlPath" }, new Field { Name = "[ProductCategories].[SortOrder]" }, new Field { Name = "[ShoppingCart].[CustomerID]", NotInQuery = true }, new Field { Name = "BrandID", NotInQuery = true }, new Field { Name = "Offer.ProductID as Size_ProductID", NotInQuery = true }, new Field { Name = "Offer.ProductID as Color_ProductID", NotInQuery = true }, new Field { Name = "Offer.ProductID as Price_ProductID", NotInQuery = true }, new Field { Name = "Offer.ColorID" }, new Field { Name = "CategoryEnabled", NotInQuery = true }, }); if (SettingsCatalog.ComplexFilter) { _paging.AddFieldsRange(new List <Field> { new Field { Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices" }, new Field { Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price" }, }); } else { _paging.AddFieldsRange(new List <Field> { new Field { Name = "0 as MultiPrices" }, new Field { Name = "Price" }, }); } _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerContext.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); if (string.IsNullOrEmpty(Request["categoryid"]) || !Int32.TryParse(Request["categoryid"], out _categoryId)) { _categoryId = 0; var sbMainPage = StaticBlockService.GetPagePartByKeyWithCache("MainPageSocial"); if (sbMainPage != null && sbMainPage.Enabled) { MainPageText = sbMainPage.Content; } } if (!string.IsNullOrEmpty(MainPageText)) { SetMeta(null, string.Empty); return; } category = CategoryService.GetCategory(_categoryId); if (category == null || category.Enabled == false || category.ParentsEnabled == false) { Error404(); return; } ProductsCount = category.GetProductCount(); categoryView.CategoryID = _categoryId; categoryView.Visible = true; pnlSort.Visible = ProductsCount > 0; productView.Visible = ProductsCount > 0; lblCategoryName.Text = _categoryId != 0 ? category.Name : Resource.Client_MasterPage_Catalog; //lblCategoryDescription.Text = category.Description; //imgCategoryImage.ImageUrl = string.IsNullOrEmpty(category.Picture) ? "" : string.Format("{0}", ImageFolders.GetImageCategoryPath(false, category.Picture)); breadCrumbs.Items = CategoryService.GetParentCategories(_categoryId).Select(parent => new BreadCrumbs { Name = parent.Name, Url = "social/catalogsocial.aspx?categoryid=" + parent.CategoryId }).Reverse().ToList(); breadCrumbs.Items.Insert(0, new BreadCrumbs { Name = Resource.Client_MasterPage_MainPage, Url = UrlService.GetAbsoluteLink("social/catalogsocial.aspx") }); SetMeta(category.Meta, category.Name); if (category.DisplayChildProducts) { var cfilter = new InChildCategoriesFieldFilter { CategoryId = _categoryId.ToString(), ParamName = "@CategoryID" }; _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter; } else { var cfilter = new EqualFieldFilter { Value = _categoryId.ToString(), ParamName = "@catalog" }; _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter; } _paging.Fields["Enabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@enabled" };; _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@CategoryEnabled" }; var logicalFilter = new LogicalFilter { ParamName = "@Main", HideInCustomData = true }; logicalFilter.AddFilter(new EqualFieldFilter { Value = "1", ParamName = "@Main1", HideInCustomData = true }); logicalFilter.AddLogicalOperation("OR"); logicalFilter.AddFilter(new NullFieldFilter { Null = true, ParamName = "@Main2", HideInCustomData = true }); _paging.Fields["Offer.Main"].Filter = logicalFilter; BuildSorting(); }
protected void Page_Load(object sender, EventArgs e) { _priceField = CustomerSession.CurrentCustomer.PriceType.ToString(); _paging = new SqlPaging { TableName = "[Catalog].[Product] " + "LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] and [Offer].Main = 1 " + "LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId " + "Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId " + "LEFT JOIN [Customers].[LastPrice] ON [LastPrice].[ProductId] = [Product].[ProductId] AND [LastPrice].[CustomerId] = @CustomerId" }; _paging.AddFieldsRange( new List<Field>() { new Field {Name = "[Product].[ProductID] as ProductID", IsDistinct = true}, new Field {Name = "null AS AdditionalPhoto"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc"}, new Field {Name = "BriefDescription"}, new Field {Name = "Product.ArtNo"}, new Field {Name = "Name"}, new Field { Name = SettingsCatalog.UseLastPrice ? string.Format("(CASE WHEN ProductPrice IS NULL THEN {0} ELSE ProductPrice END) as Price", _priceField) : string.Format("{0} as Price", _priceField) }, new Field {Name = string.Format("{0} - {0}*discount/100 as discountPrice", _priceField), NotInQuery = true}, new Field {Name = "0 as MultiPrices"}, new Field {Name = "Recomended"}, new Field {Name = "New"}, new Field {Name = "Bestseller"}, new Field {Name = "OnSale"}, new Field {Name = "Discount"}, new Field {Name = "UrlPath"}, new Field {Name = "[Offer].Amount"}, new Field {Name = "Offer.Main", NotInQuery = true}, new Field {Name = "Offer.OfferID"}, new Field {Name = "MinAmount"}, new Field {Name = "MaxAmount"}, new Field {Name = "Multiplicity"}, new Field {Name = "Enabled"}, new Field {Name = "ShoppingCartItemId"}, new Field {Name = "AllowPreOrder"}, new Field {Name = "Ratio"}, new Field {Name = "RatioID"}, new Field {Name = "DateModified"}, new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery = true}, new Field {Name = "BrandID", NotInQuery = true}, new Field {Name = "CategoryEnabled", NotInQuery = true}, new Field {Name = "Offer.ColorID as ColorID"}, new Field { Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors" } }); _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); if (string.IsNullOrEmpty(Request["type"]) || !Enum.TryParse(Request["type"], true, out _typeFlag) || _typeFlag == ProductOnMain.TypeFlag.None) { Error404(); } ProductsCount = ProductOnMain.GetProductCountByType(_typeFlag); pnlSort.Visible = ProductsCount > 0; productView.Visible = ProductsCount > 0; filterBrand.CategoryId = 0; filterBrand.InDepth = true; filterBrand.WorkType = _typeFlag; filterPrice.CategoryId = 0; filterPrice.InDepth = true; _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@CategoryEnabled" }; _paging.Fields["Enabled"].Filter = new EqualFieldFilter {Value = "1", ParamName = "@Enabled"}; if (_typeFlag == ProductOnMain.TypeFlag.Bestseller) { var filterB = new EqualFieldFilter {ParamName = "@Bestseller", Value = "1"}; _paging.Fields["Bestseller"].Filter = filterB; _paging.Fields.Add(new KeyValuePair<string, Field>("SortBestseller", new Field {Name = "SortBestseller as Sort"})); PageName = Resource.Client_ProductList_AllBestSellers; SetMeta( new AdvantShop.SEO.MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_Bestsellers_Header), string.Empty); } if (_typeFlag == ProductOnMain.TypeFlag.New) { var filterN = new EqualFieldFilter {ParamName = "@New", Value = "1"}; _paging.Fields["New"].Filter = filterN; _paging.Fields.Add(new KeyValuePair<string, Field>("SortNew", new Field {Name = "SortNew as Sort"})); PageName = Resource.Client_ProductList_AllNew; SetMeta(new AdvantShop.SEO.MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_New_Header), string.Empty); } if (_typeFlag == ProductOnMain.TypeFlag.Discount) { var filterN = new NotEqualFieldFilter() {ParamName = "@Discount", Value = "0"}; _paging.Fields["Discount"].Filter = filterN; _paging.Fields.Add(new KeyValuePair<string, Field>("SortDiscount", new Field {Name = "SortDiscount as Sort"})); PageName = Resource.Client_ProductList_AllDiscount; SetMeta(new AdvantShop.SEO.MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_Discount_Header), string.Empty); } breadCrumbs.Items.AddRange(new BreadCrumbs[] { new BreadCrumbs() { Name = Resource.Client_MasterPage_MainPage, Url = UrlService.GetAbsoluteLink("/") }, new BreadCrumbs() {Name = PageName, Url = null} }); BuildSorting(); BuildFilter(); }
public void AddParamSql(SqlParam param) { _paging.AddParam(param); }
private void BuildFilter() { foreach (Category c in (CategoryService.GetChildCategoriesByCategoryId(0, true).Where(p => p.Enabled))) { ddlCategory.Items.Add(new ListItem { Text = c.Name, Value = c.CategoryId.ToString(), Selected = Request["category"] == c.CategoryId.ToString() }); } _paging.Fields["[ProductCategories].[CategoryID]"].Filter = new InChildCategoriesFieldFilter { CategoryId = ddlCategory.SelectedValue, ParamName = "@CategoryID" }; if (Page.Request["name"].IsNotEmpty()) { var name = HttpUtility.UrlDecode(Page.Request["name"]).Trim(); txtName.Text = name; var productIds = LuceneSearch.Search(txtName.Text).AggregateString('/'); _paging.TableName += " inner join (select item, sort from [Settings].[ParsingBySeperator](@source,'/') ) as dtt on Product.ProductId=convert(int, dtt.item) "; _paging.AddParam(new SqlParam { ParameterName = "@source", Value = productIds }); if (_sort == ESortOrder.NoSorting) { _paging.Fields.Add("sort", new Field("sort")); _paging.Fields["sort"].Sorting = SortDirection.Ascending; } SearchTerm = HttpUtility.HtmlEncode(name); } filterPrice.CategoryId = 0; filterPrice.InDepth = true; if (!string.IsNullOrEmpty(Request["pricefrom"]) || !string.IsNullOrEmpty(Request["priceto"])) { int pricefrom = Request["pricefrom"].TryParseInt(0); int priceto = Request["priceto"].TryParseInt(int.MaxValue); filterPrice.CurValMin = pricefrom; filterPrice.CurValMax = priceto; _paging.Fields["Price_ProductID"].Filter = new PriceFieldFilter { ParamName = "@priceRange", From = pricefrom * CurrencyService.CurrentCurrency.Value, To = priceto * CurrencyService.CurrentCurrency.Value, CategoryId = 0, GetSubCategoryes = true }; } else { filterPrice.CurValMin = 0; filterPrice.CurValMax = int.MaxValue; } }
protected void Page_Load(object sender, EventArgs e) { SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resources.Resource.Admin_Brands_Header)); if (!IsPostBack) { _paging = new SqlPaging { TableName = "[Catalog].[Brand] left join Catalog.Photo on Photo.ObjId = Brand.BrandID and Type = @Type ", ItemsPerPage = 10 }; _paging.AddFieldsRange(new List <Field> { new Field { Name = "BrandID as ID", IsDistinct = true }, new Field { Name = "ProductsCount", SelectExpression = "(Select Count(ProductID) from Catalog.Product Where Product.BrandID=Brand.BrandID) as ProductsCount" }, new Field { Name = "PhotoName as BrandLogo" }, new Field { Name = "Enabled" }, new Field { Name = "SortOrder", Sorting = SortDirection.Ascending }, new Field { Name = "BrandName", Sorting = SortDirection.Ascending } }); _paging.AddParam(new SqlParam { Value = PhotoType.Brand.ToString(), ParameterName = "@Type" }); grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif"); _paging.ItemsPerPage = 10; pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; ViewState["Paging"] = _paging; } else { _paging = (SqlPaging)(ViewState["Paging"]); _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue); if (_paging == null) { throw (new Exception("Paging lost")); } string strIds = Request.Form["SelectedIds"]; if (!string.IsNullOrEmpty(strIds)) { strIds = strIds.Trim(); string[] arrids = strIds.Split(' '); _selectionFilter = new InSetFieldFilter(); if (arrids.Contains("-1")) { _selectionFilter.IncludeValues = false; _inverseSelection = true; } else { _selectionFilter.IncludeValues = true; } _selectionFilter.Values = arrids.Where(id => id != "-1").ToArray(); } } }
protected void Page_Load(object sender, EventArgs e) { _paging = new SqlPaging { TableName = "[Catalog].[Product] LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId] and Type='Product' AND Photo.[Main] = 1 inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferId] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId" }; _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); _paging.AddFieldsRange( new List<Field> { new Field {Name = "[Product].[ProductID]", IsDistinct = true}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc"}, new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true}, new Field {Name = "BriefDescription"}, new Field {Name = "Product.ArtNo"}, new Field {Name = "Name"}, new Field {Name = "Recomended"}, new Field {Name = "Bestseller"}, new Field {Name = "New"}, new Field {Name = "OnSale"}, new Field {Name = "Discount"}, new Field {Name = "Offer.Main", NotInQuery=true}, new Field {Name = "Offer.OfferID"}, new Field {Name = "Offer.Amount"}, new Field {Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending}, new Field {Name = "MinAmount"}, new Field {Name = "MaxAmount"}, new Field {Name = "Enabled"}, new Field {Name = "AllowPreOrder"}, new Field {Name = "Ratio"}, new Field {Name = "RatioID"}, new Field {Name = "DateModified"}, new Field {Name = "ShoppingCartItemId"}, new Field {Name = "UrlPath"}, new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true}, new Field {Name = "BrandID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true}, new Field {Name = "Offer.ColorID"}, new Field {Name = "CategoryEnabled", NotInQuery=true}, new Field {Name = "null as AdditionalPhoto"} }); if (SettingsCatalog.ComplexFilter) { _paging.AddFieldsRange(new List<Field> { new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"}, new Field {Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices"}, new Field {Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price"}, }); } else { _paging.AddFieldsRange(new List<Field> { new Field {Name = "null as Colors"}, new Field {Name = "0 as MultiPrices"}, new Field {Name = "Price"}, }); } _paging.Fields["[Product].[ProductID]"].Filter = new CountProductInCategory(); _paging.Fields["Enabled"].Filter = new EqualFieldFilter { ParamName = "@enabled", Value = "1" }; _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { ParamName = "@CategoryEnabled", Value = "1" }; BuildSorting(); BuildFilter(); SetMeta(null, string.Empty); txtName.Focus(); }
protected void Page_Load(object sender, EventArgs e) { _priceField = CustomerSession.CurrentCustomer.PriceType.ToString(); _paging = new SqlPaging { TableName = "[Catalog].[Product] " + "LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] AND [Offer].[Main] = 1 " + "LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId] and Type='product' and Photo.Main=1 " + "inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] " + "LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId " + "Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId " + "LEFT JOIN [Customers].[LastPrice] ON [LastPrice].[ProductId] = [Product].[ProductId] AND [LastPrice].[CustomerId] = @CustomerId" }; _paging.AddFieldsRange( new List<Field> { new Field {Name = "[Product].[ProductID]", IsDistinct = true}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc"}, new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true}, new Field {Name = "BriefDescription"}, new Field {Name = "Product.ArtNo"}, new Field {Name = "Name"}, new Field {Name = "Recomended"}, new Field {Name = "Bestseller"}, new Field {Name = "New"}, new Field {Name = "OnSale"}, new Field {Name = "Discount"}, new Field {Name = "Offer.Main", NotInQuery=true}, new Field {Name = "Offer.OfferID"}, new Field {Name = "Offer.Amount"}, new Field {Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending}, new Field {Name = "MinAmount"}, new Field {Name = "MaxAmount"}, new Field {Name = "Multiplicity"}, new Field {Name = "Enabled"}, new Field {Name = "AllowPreOrder"}, new Field {Name = "Ratio"}, new Field {Name = "RatioID"}, new Field {Name = "DateModified"}, new Field {Name = "ShoppingCartItemId"}, new Field {Name = "UrlPath"}, new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true}, new Field {Name = "BrandID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true}, new Field {Name = "Offer.ColorID"}, new Field {Name = "CategoryEnabled", NotInQuery=true}, new Field {Name = "null as AdditionalPhoto"} }); if (SettingsCatalog.ComplexFilter) { _paging.AddFieldsRange(new List<Field> { new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"}, new Field {Name = string.Format("(select max ({0}) - min ({0}) from catalog.offer where offer.productid=product.productid) as MultiPrices", _priceField)}, new Field {Name = string.Format("(select min ({0}) from catalog.offer where offer.productid=product.productid) as Price", _priceField)}, }); } else { _paging.AddFieldsRange(new List<Field> { new Field {Name = "null as Colors"}, new Field {Name = "0 as MultiPrices"}, new Field { Name = SettingsCatalog.UseLastPrice ? string.Format("(CASE WHEN ProductPrice IS NULL THEN {0} ELSE ProductPrice END) as Price", _priceField) : string.Format("{0} as Price", _priceField) }, }); } _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); BuildSorting(); BuildFilter(); var nmeta = new MetaInfo(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Client_Search_AdvancedSearch)); SetMeta(nmeta, string.Empty, page:paging.CurrentPage); txtName.Focus(); }
protected void Page_Load(object sender, EventArgs e) { SetMeta(string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resource.Admin_MasterPageAdminCatalog_Catalog)); if (string.IsNullOrEmpty(ModuleName)) { Response.Redirect("ExportFeed.aspx?ModuleId=YandexMarket"); return; } if (!string.IsNullOrEmpty(Request["CatId"])) { Int32.TryParse(Request["CatId"], out _catId); } Category cat = CategoryService.GetCategory(_catId); if (cat != null) { lblCategoryName.Text = cat.Name; sn.BuildNavigationAdmin(_catId); } if (!Page.IsPostBack) { var flag = ExportFeedService.CheakCategoryHierical(ModuleName, _catId); pnlCategorySet.Enabled = !flag; chbFull.Checked = ExportFeedService.CheakCategory(ModuleName, _catId); pnlData.Enabled = !chbFull.Checked && !flag; } PageSubheader.Visible = true; ModuleNameLiteral.Text = ModuleName; if (!IsPostBack) { var node2 = new TreeNode { Text = SelectCategory(0, ModuleName, Resource.Admin_m_Category_Root), Value = "0", Selected = true, NavigateUrl = ExportFeedNew + "?moduleid=" + ModuleName }; tree2.Nodes.Add(node2); LoadChildCategories2(tree2.Nodes[0]); _paging = new SqlPaging { TableName = "[Catalog].[Product] left JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] AND [Offer].Main=1 INNER JOIN Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] and ProductCategories.Main=1", ItemsPerPage = 100 }; var f = new Field { Name = "Product.ProductId as ID", IsDistinct = true }; _paging.AddField(f); f = new Field { Name = "Product.ArtNo" }; _paging.AddField(f); f = new Field { Name = "Name" }; _paging.AddField(f); f = new Field { Name = "(Select count(*) from Settings.ExportFeedSelectedProducts where ModuleName=@ModuleName and ExportFeedSelectedProducts.ProductID=Product.ProductId) as Cheaked" }; _paging.AddField(f); var pf = new EqualFieldFilter { Value = _catId.ToString(), ParamName = "@Parent" }; f = new Field { Name = "CategoryId", Filter = pf }; _paging.AddField(f); f = new Field { Name = "SortOrder", Sorting = SortDirection.Ascending }; _paging.AddField(f); _paging.AddParam(new SqlParam { ParameterName = "@ModuleName", Value = ModuleName }); _paging.ExtensionWhere = "and Offer.Price > 0 and (Offer.Amount > 0 or Product.AllowPreorder=1) and CategoryEnabled=1 and Enabled=1"; grid.ChangeHeaderImageUrl("arrowName", "images/arrowup.gif"); pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; ViewState["Paging"] = _paging; } else { _paging = (SqlPaging)(ViewState["Paging"]); _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue); if (_paging == null) { throw (new Exception("Paging lost")); } string strIds = Request.Form["SelectedIds"]; if (!string.IsNullOrEmpty(strIds)) { strIds = strIds.Trim(); string[] arrids = strIds.Split(' '); var ids = new string[arrids.Length]; _selectionFilter = new InSetFieldFilter { IncludeValues = true }; for (int idx = 0; idx <= ids.Length - 1; idx++) { int t = int.Parse(arrids[idx]); if (t != -1) { ids[idx] = t.ToString(); } else { _selectionFilter.IncludeValues = false; _inverseSelection = true; } } _selectionFilter.Values = ids; } } }
protected void Page_Load(object sender, EventArgs e) { bool categoryIdIsNum = false; int categoryId = -1; if (!string.IsNullOrEmpty(Request["newscategoryid"]) && Int32.TryParse(Request["newscategoryid"], out categoryId)) { categoryIdIsNum = categoryId != -1; } _paging = new SqlPaging { TableName = "Settings.News left join Catalog.Photo on Photo.objId=News.NewsID and Type=@Type", ItemsPerPage = SettingsNews.NewsPerPage }; _paging.AddField(new Field { Name = "NewsID" }); _paging.AddField(new Field { Name = "AddingDate", Sorting = SortDirection.Descending }); _paging.AddField(new Field { Name = "Title" }); _paging.AddField(new Field { Name = "PhotoName as Picture" }); _paging.AddField(new Field { Name = "TextToPublication" }); _paging.AddField(new Field { Name = "TextToEmail" }); _paging.AddField(new Field { Name = "TextAnnotation" }); _paging.AddField(new Field { Name = "UrlPath" }); _paging.AddParam(new SqlParam { ParamName = "@Type", ParamValue = PhotoType.News.ToString() }); if (categoryIdIsNum) { var f = new Field { Name = "NewsCategoryID", NotInQuery = true }; var filter = new EqualFieldFilter { ParamName = "@NewsCategoryID", Value = categoryId.ToString(CultureInfo.InvariantCulture) }; f.Filter = filter; _paging.AddField(f); } // MetaInfo ------------------------------------------------ MetaInfo nmeta = null; if ((SettingsNews.NewsMetaTitle != null) || (SettingsNews.NewsMetaKeywords != null) || (SettingsNews.NewsMetaDescription != null)) { nmeta = new MetaInfo { Type = MetaType.News, Title = (string.IsNullOrEmpty(SettingsNews.NewsMetaTitle)) ? null : SettingsMain.ShopName + " - " + SettingsNews.NewsMetaTitle, MetaKeywords = (string.IsNullOrEmpty(SettingsNews.NewsMetaKeywords)) ? null : SettingsNews.NewsMetaKeywords, MetaDescription = (string.IsNullOrEmpty(SettingsNews.NewsMetaDescription)) ? null : SettingsNews.NewsMetaDescription }; } // MetaInfo ------------------------------------------------ var category = NewsService.GetNewsCategoryById(categoryId); header.Text = category != null?string.Format("{0} / {1}", Resources.Resource.Client_News_News, category.Name) : Resources.Resource.Client_News_News; if (category != null) { ucBreadCrumbs.Items = new List <BreadCrumbs> { new BreadCrumbs { Name = Resources.Resource.Client_News_News, Url = UrlService.GetAbsoluteLink("news") }, new BreadCrumbs { Name = category.Name, Url = UrlService.GetLink(ParamType.NewsCategory, category.UrlPath, category.NewsCategoryID) } }; nmeta = new MetaInfo { Title = SettingsMain.ShopName + " - " + category.Name, MetaDescription = SettingsNews.NewsMetaKeywords, MetaKeywords = SettingsNews.NewsMetaDescription, Type = MetaType.News }; } else { ucBreadCrumbs.Visible = false; } SetMeta(nmeta, string.Empty); }
protected void Page_Load(object sender, EventArgs e) { Page.Title = string.Format("{0} - {1}", AdvantShop.Configuration.SettingsMain.ShopName, Resource.Admin_MasterPageAdminCatalog_Catalog); if (string.IsNullOrEmpty(ModuleName)) { Response.Redirect("ExportFeed.aspx?ModuleId=YandexMarket"); return; } if (!string.IsNullOrEmpty(Request["CatId"])) { Int32.TryParse(Request["CatId"], out _catId); } Category cat = CategoryService.GetCategory(_catId); if (cat != null) { lblCategoryName.Text = cat.Name; sn.BuildNavigationAdmin(_catId); } if (!Page.IsPostBack) { var flag = ExportFeedService.CheakCategoryHierical(ModuleName, _catId); pnlCategorySet.Enabled = !flag; chbFull.Checked = ExportFeedService.CheakCategory(ModuleName, _catId); pnlData.Enabled = !chbFull.Checked && !flag; } PageSubheader.Visible = true; ModuleNameLiteral.Text = ModuleName; if (!IsPostBack) { var node2 = new TreeNode { Text = SelectCategory(0, ModuleName, Resource.Admin_m_Category_Root), Value = "0", Selected = true, NavigateUrl = ExportFeedNew + "?moduleid=" + ModuleName }; tree2.Nodes.Add(node2); LoadChildCategories2(tree2.Nodes[0]); _paging = new SqlPaging { TableName = "[Catalog].[Product] left JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] AND [OfferListId]=6 INNER JOIN Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] and Main=1", ItemsPerPage = 100 }; var f = new Field { Name = "Product.ProductId as ID", IsDistinct = true }; _paging.AddField(f); f = new Field { Name = "ArtNo" }; _paging.AddField(f); f = new Field { Name = "Name" }; _paging.AddField(f); f = new Field { Name = "(Select count(*) from Settings.ExportFeedSelectedProducts where ModuleName=@ModuleName and ExportFeedSelectedProducts.ProductID=Product.ProductId) as Cheaked" }; _paging.AddField(f); var pf = new EqualFieldFilter { Value = _catId.ToString(), ParamName = "@Parent" }; f = new Field { Name = "CategoryId", Filter = pf }; _paging.AddField(f); f = new Field { Name = "SortOrder", Sorting = SortDirection.Ascending }; _paging.AddField(f); _paging.AddParam(new SqlParam { ParamName = "@ModuleName", ParamValue = ModuleName }); _paging.ExtensionWhere = "and Offer.Price > 0 and (Offer.Amount > 0 or Product.OrderByRequest=1) and HirecalEnabled=1 and Enabled=1"; grid.ChangeHeaderImageUrl("arrowName", "images/arrowup.gif"); pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; ViewState["Paging"] = _paging; } else { _paging = (SqlPaging)(ViewState["Paging"]); _paging.ItemsPerPage = Convert.ToInt32(ddRowsPerPage.SelectedValue); if (_paging == null) { throw (new Exception("Paging lost")); } string strIds = Request.Form["SelectedIds"]; if (!string.IsNullOrEmpty(strIds)) { strIds = strIds.Trim(); string[] arrids = strIds.Split(' '); var ids = new string[arrids.Length]; _selectionFilter = new InSetFieldFilter { IncludeValues = true }; for (int idx = 0; idx <= ids.Length - 1; idx++) { int t = int.Parse(arrids[idx]); if (t != -1) { ids[idx] = t.ToString(); } else { _selectionFilter.IncludeValues = false; _inverseSelection = true; } } _selectionFilter.Values = ids; } } }
protected void Page_Load(object sender, EventArgs e) { bool categoryIdIsNum = false; int categoryId = -1; if (!string.IsNullOrEmpty(Request["newscategoryid"]) && Int32.TryParse(Request["newscategoryid"], out categoryId)) { categoryIdIsNum = categoryId != -1; } _paging = new SqlPaging { TableName = "Settings.News left join Catalog.Photo on Photo.objId=News.NewsID and Type=@Type", ItemsPerPage = SettingsNews.NewsPerPage }; _paging.AddField(new Field { Name = "NewsID" }); _paging.AddField(new Field { Name = "AddingDate", Sorting = SortDirection.Descending }); _paging.AddField(new Field { Name = "Title" }); _paging.AddField(new Field { Name = "PhotoName as Picture" }); _paging.AddField(new Field { Name = "TextToPublication" }); _paging.AddField(new Field { Name = "TextToEmail" }); _paging.AddField(new Field { Name = "TextAnnotation" }); _paging.AddField(new Field { Name = "UrlPath" }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.News.ToString() }); if (categoryIdIsNum) { var f = new Field { Name = "NewsCategoryID", NotInQuery = true }; var filter = new EqualFieldFilter { ParamName = "@NewsCategoryID", Value = categoryId.ToString(CultureInfo.InvariantCulture) }; f.Filter = filter; _paging.AddField(f); } var category = NewsService.GetNewsCategoryById(categoryId); if (category != null) { ucBreadCrumbs.Items = new List <BreadCrumbs> { new BreadCrumbs { Name = Resources.Resource.Client_News_News, Url = UrlService.GetAbsoluteLink("news") }, new BreadCrumbs { Name = category.Name, Url = UrlService.GetLink(ParamType.NewsCategory, category.UrlPath, category.NewsCategoryID) } }; } else { ucBreadCrumbs.Visible = false; } MetaInfo meta = new MetaInfo { Type = MetaType.News, Title = SettingsNews.NewsMetaTitle, MetaKeywords = SettingsNews.NewsMetaKeywords, MetaDescription = SettingsNews.NewsMetaDescription, H1 = SettingsNews.NewsMetaH1 }; if (category != null && category.Meta != null) { meta = category.Meta; } meta = SetMeta(meta, category != null ? category.Name: string.Empty, page: paging.CurrentPage); header.Text = category != null ? meta.H1 : Resource.Client_News_News; if (GoogleTagManager.Enabled) { var tagManager = ((AdvantShopMasterPage)Master).TagManager; tagManager.PageType = GoogleTagManager.ePageType.info; } }
protected void Page_Load(object sender, EventArgs e) { _paging = new SqlPaging { TableName = "[Catalog].[Product] LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] AND [Offer].[Main] = 1 LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId] and Type='Product' AND Photo.[Main] = 1 inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferId] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId" }; _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerContext.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); _paging.AddFieldsRange( new List <Field> { new Field { Name = "[Product].[ProductID]", IsDistinct = true }, new Field { Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto" }, new Field { Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo" }, new Field { Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc" }, new Field { Name = "[ProductCategories].[CategoryID]", NotInQuery = true }, new Field { Name = "BriefDescription" }, new Field { Name = "Product.ArtNo" }, new Field { Name = "Name" }, new Field { Name = "Recomended" }, new Field { Name = "Bestseller" }, new Field { Name = "New" }, new Field { Name = "OnSale" }, new Field { Name = "Discount" }, new Field { Name = "Offer.Main", NotInQuery = true }, new Field { Name = "Offer.OfferID" }, new Field { Name = "Offer.Amount" }, new Field { Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting = SortDirection.Descending }, new Field { Name = "MinAmount" }, new Field { Name = "MaxAmount" }, new Field { Name = "Enabled" }, new Field { Name = "AllowPreOrder" }, new Field { Name = "Ratio" }, new Field { Name = "RatioID" }, new Field { Name = "DateModified" }, new Field { Name = "ShoppingCartItemId" }, new Field { Name = "UrlPath" }, new Field { Name = "[ShoppingCart].[CustomerID]", NotInQuery = true }, new Field { Name = "BrandID", NotInQuery = true }, new Field { Name = "Offer.ProductID as Size_ProductID", NotInQuery = true }, new Field { Name = "Offer.ProductID as Color_ProductID", NotInQuery = true }, new Field { Name = "Offer.ProductID as Price_ProductID", NotInQuery = true }, new Field { Name = "Offer.ColorID" }, new Field { Name = "CategoryEnabled", NotInQuery = true }, new Field { Name = "null as AdditionalPhoto" } }); if (SettingsCatalog.ComplexFilter) { _paging.AddFieldsRange(new List <Field> { new Field { Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors" }, new Field { Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices" }, new Field { Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price" }, }); } else { _paging.AddFieldsRange(new List <Field> { new Field { Name = "null as Colors" }, new Field { Name = "0 as MultiPrices" }, new Field { Name = "Price" }, }); } _paging.Fields["[Product].[ProductID]"].Filter = new CountProductInCategory(); _paging.Fields["Enabled"].Filter = new EqualFieldFilter { ParamName = "@enabled", Value = "1" }; _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { ParamName = "@CategoryEnabled", Value = "1" }; BuildSorting(); BuildFilter(); SetMeta(null, string.Empty); txtName.Focus(); }
protected void Page_Load(object sender, EventArgs e) { SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Carousels_Header)); if (!IsPostBack) { _paging = new SqlPaging { TableName = "[CMS].[Carousel] left join Catalog.Photo on Photo.ObjId=Carousel.CarouselID and Type=@Type", ItemsPerPage = 10 }; var f = new Field { Name = "CarouselID as ID", IsDistinct = true, Filter = _selectionFilter }; _paging.AddField(f); f = new Field { Name = "URL" }; _paging.AddField(f); f = new Field { Name = "SortOrder", Sorting = SortDirection.Ascending }; _paging.AddField(f); f = new Field { Name = "Enabled" }; _paging.AddField(f); f = new Field { Name = "PhotoName" }; _paging.AddField(f); f = new Field { Name = "Description" }; _paging.AddField(f); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Carousel.ToString() }); grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif"); _paging.ItemsPerPage = 10; pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; ViewState["Paging"] = _paging; txtSortedCarousel.Text = CarouselService.GetMaxSortOrder().ToString(CultureInfo.InvariantCulture); } else { _paging = (SqlPaging)(ViewState["Paging"]); _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue); if (_paging == null) { throw (new Exception("Paging lost")); } string strIds = Request.Form["SelectedIds"]; if (!string.IsNullOrEmpty(strIds)) { strIds = strIds.Trim(); string[] arrids = strIds.Split(' '); var ids = new string[arrids.Length]; _selectionFilter = new InSetFieldFilter { IncludeValues = true }; for (int idx = 0; idx <= ids.Length - 1; idx++) { int t = int.Parse(arrids[idx]); if (t != -1) { ids[idx] = t.ToString(); } else { _selectionFilter.IncludeValues = false; _inverseSelection = true; } } _selectionFilter.Values = ids; //_InverseSelection = If(ids(0) = -1, True, False) } } }
protected void Page_Load(object sender, EventArgs e) { _paging = new SqlPaging { TableName = "[Catalog].[Product] LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID] inner join Catalog.ProductCategories on ProductCategories.ProductId = [Product].[ProductID] Left JOIN [Catalog].[ProductPropertyValue] ON [Product].[ProductID] = [ProductPropertyValue].[ProductID] LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[OfferID] = [Catalog].[Offer].[OfferID] AND [Catalog].[ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId" }; _paging.AddFieldsRange( new List<Field> { new Field {Name = "[Product].[ProductID]", IsDistinct = true}, //new Field {Name = "PhotoName AS Photo"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select Count(PhotoName) From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) ELSE (Select Count(PhotoName) From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type) END) AS CountPhoto"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) PhotoName From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS Photo"}, new Field {Name = "(CASE WHEN Offer.ColorID is not null THEN (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE ([Photo].ColorID = Offer.ColorID or [Photo].ColorID is null) and [Product].[ProductID] = [Photo].[ObjId] and Type=@Type Order By main desc, [Photo].[PhotoSortOrder]) ELSE (Select TOP(1) [Photo].[Description] From [Catalog].[Photo] WHERE [Product].[ProductID] = [Photo].[ObjId] and Type=@Type AND [Photo].[Main] = 1) END) AS PhotoDesc"}, new Field {Name = "(select [Settings].[ProductColorsToString]([Product].[ProductID])) as Colors"}, //new Field {Name = "[Photo].[Description] AS PhotoDesc"}, new Field {Name = "[ProductCategories].[CategoryID]", NotInQuery=true}, new Field {Name = "BriefDescription"}, new Field {Name = "Product.ArtNo"}, new Field {Name = "Name"}, new Field {Name = "(CASE WHEN Price=0 THEN 0 ELSE 1 END) as TempSort", Sorting=SortDirection.Descending}, new Field {Name = "Recomended"}, new Field {Name = "Bestseller"}, new Field {Name = "New"}, new Field {Name = "OnSale"}, new Field {Name = "Discount"}, new Field {Name = "Offer.Main", NotInQuery=true}, new Field {Name = "Offer.OfferID"}, new Field {Name = "Offer.Amount"}, new Field {Name = "(CASE WHEN Offer.Amount=0 OR Offer.Amount < IsNull(MinAmount,0) THEN 0 ELSE 1 END) as TempAmountSort", Sorting=SortDirection.Descending}, new Field {Name = "MinAmount"}, new Field {Name = "MaxAmount"}, new Field {Name = "Enabled"}, new Field {Name = "AllowPreOrder"}, new Field {Name = "Ratio"}, new Field {Name = "RatioID"}, new Field {Name = "DateModified"}, new Field {Name = "ShoppingCartItemId"}, new Field {Name = "UrlPath"}, new Field {Name = "[ProductCategories].[SortOrder]"}, new Field {Name = "[ShoppingCart].[CustomerID]", NotInQuery=true}, new Field {Name = "BrandID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Size_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Color_ProductID", NotInQuery=true}, new Field {Name = "Offer.ProductID as Price_ProductID", NotInQuery=true}, new Field {Name = "Offer.ColorID"}, new Field {Name = "CategoryEnabled", NotInQuery=true}, }); if (SettingsCatalog.ComplexFilter) { _paging.AddFieldsRange(new List<Field> { new Field {Name = "(select max (price) - min (price) from catalog.offer where offer.productid=product.productid) as MultiPrices"}, new Field {Name = "(select min (price) from catalog.offer where offer.productid=product.productid) as Price"}, }); } else { _paging.AddFieldsRange(new List<Field> { new Field {Name = "0 as MultiPrices"}, new Field {Name = "Price"}, }); } _paging.AddParam(new SqlParam { ParameterName = "@CustomerId", Value = CustomerSession.CustomerId.ToString() }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Product.ToString() }); if (string.IsNullOrEmpty(Request["categoryid"]) || !Int32.TryParse(Request["categoryid"], out _categoryId)) { _categoryId = 0; var sbMainPage = StaticBlockService.GetPagePartByKeyWithCache("MainPageSocial"); if (sbMainPage != null && sbMainPage.Enabled) MainPageText = sbMainPage.Content; } if (!string.IsNullOrEmpty(MainPageText)) { SetMeta(null, string.Empty); return; } category = CategoryService.GetCategory(_categoryId); if (category == null || category.Enabled == false || category.ParentsEnabled == false) { Error404(); return; } ProductsCount = category.GetProductCount(); categoryView.CategoryID = _categoryId; categoryView.Visible = true; pnlSort.Visible = ProductsCount > 0; productView.Visible = ProductsCount > 0; lblCategoryName.Text = _categoryId != 0 ? category.Name : Resource.Client_MasterPage_Catalog; //lblCategoryDescription.Text = category.Description; //imgCategoryImage.ImageUrl = string.IsNullOrEmpty(category.Picture) ? "" : string.Format("{0}", ImageFolders.GetImageCategoryPath(false, category.Picture)); breadCrumbs.Items = CategoryService.GetParentCategories(_categoryId).Select(parent => new BreadCrumbs { Name = parent.Name, Url = "social/catalogsocial.aspx?categoryid=" + parent.CategoryId }).Reverse().ToList(); breadCrumbs.Items.Insert(0, new BreadCrumbs { Name = Resource.Client_MasterPage_MainPage, Url = UrlService.GetAbsoluteLink("social/catalogsocial.aspx") }); SetMeta(category.Meta, category.Name); if (category.DisplayChildProducts) { var cfilter = new InChildCategoriesFieldFilter { CategoryId = _categoryId.ToString(), ParamName = "@CategoryID" }; _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter; } else { var cfilter = new EqualFieldFilter { Value = _categoryId.ToString(), ParamName = "@catalog" }; _paging.Fields["[ProductCategories].[CategoryID]"].Filter = cfilter; } _paging.Fields["Enabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@enabled" }; ; _paging.Fields["CategoryEnabled"].Filter = new EqualFieldFilter { Value = "1", ParamName = "@CategoryEnabled" }; var logicalFilter = new LogicalFilter { ParamName = "@Main", HideInCustomData = true }; logicalFilter.AddFilter(new EqualFieldFilter { Value = "1", ParamName = "@Main1", HideInCustomData = true }); logicalFilter.AddLogicalOperation("OR"); logicalFilter.AddFilter(new NullFieldFilter { Null = true, ParamName = "@Main2", HideInCustomData = true }); _paging.Fields["Offer.Main"].Filter = logicalFilter; BuildSorting(); }
protected void Page_Load(object sender, EventArgs e) { bool categoryIdIsNum = false; int categoryId = -1; if (!string.IsNullOrEmpty(Request["newscategoryid"]) && Int32.TryParse(Request["newscategoryid"], out categoryId)) { categoryIdIsNum = categoryId != -1; } _paging = new SqlPaging { TableName = "Settings.News left join Catalog.Photo on Photo.objId=News.NewsID and Type=@Type", ItemsPerPage = SettingsNews.NewsPerPage }; _paging.AddField(new Field { Name = "NewsID" }); _paging.AddField(new Field { Name = "AddingDate", Sorting = SortDirection.Descending }); _paging.AddField(new Field { Name = "Title" }); _paging.AddField(new Field { Name = "PhotoName as Picture" }); _paging.AddField(new Field { Name = "TextToPublication" }); _paging.AddField(new Field { Name = "TextToEmail" }); _paging.AddField(new Field { Name = "TextAnnotation" }); _paging.AddField(new Field { Name = "UrlPath" }); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.News.ToString() }); if (categoryIdIsNum) { var f = new Field { Name = "NewsCategoryID", NotInQuery = true }; var filter = new EqualFieldFilter { ParamName = "@NewsCategoryID", Value = categoryId.ToString(CultureInfo.InvariantCulture) }; f.Filter = filter; _paging.AddField(f); } MetaInfo nmeta = new MetaInfo { Type = MetaType.News, Title = SettingsNews.NewsMetaTitle, MetaKeywords = SettingsNews.NewsMetaKeywords, MetaDescription = SettingsNews.NewsMetaDescription, H1 = SettingsNews.NewsMetaH1 }; var category = NewsService.GetNewsCategoryById(categoryId); header.Text = category != null ? string.Format("{0} / {1}", Resource.Client_News_News, category.Name) : Resource.Client_News_News; if (paging.CurrentPage > 1) { header.Text = header.Text + Resource.Client_Catalog_PageIs + paging.CurrentPage; } if (category != null) { ucBreadCrumbs.Items = new List<BreadCrumbs> { new BreadCrumbs { Name = Resource.Client_News_News, Url = UrlService.GetAbsoluteLink("news") }, new BreadCrumbs { Name = category.Name, Url = UrlService.GetLink(ParamType.NewsCategory, category.UrlPath, category.NewsCategoryID) } }; } else { ucBreadCrumbs.Visible = false; } if (paging.CurrentPage > 1) { nmeta.Title += Resource.Client_Catalog_PageIs + paging.CurrentPage; nmeta.MetaDescription += Resource.Client_Catalog_PageIs + paging.CurrentPage; } SetMeta(nmeta, string.Empty); }
protected void Page_Load(object sender, EventArgs e) { SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_Carousels_Header)); if (!IsPostBack) { _paging = new SqlPaging { TableName = "[CMS].[Carousel] left join Catalog.Photo on Photo.ObjId=Carousel.CarouselID and Type=@Type", ItemsPerPage = 10 }; var f = new Field { Name = "CarouselID as ID", IsDistinct = true, Filter = _selectionFilter }; _paging.AddField(f); f = new Field { Name = "URL" }; _paging.AddField(f); f = new Field { Name = "SortOrder", Sorting = SortDirection.Ascending }; _paging.AddField(f); f = new Field { Name = "Enabled" }; _paging.AddField(f); f = new Field { Name = "PhotoName" }; _paging.AddField(f); _paging.AddParam(new SqlParam { ParameterName = "@Type", Value = PhotoType.Carousel.ToString() }); grid.ChangeHeaderImageUrl("arrowSortOrder", "images/arrowup.gif"); _paging.ItemsPerPage = 10; pageNumberer.CurrentPageIndex = 1; _paging.CurrentPageIndex = 1; ViewState["Paging"] = _paging; txtSortedCarousel.Text = CarouselService.GetMaxSortOrder().ToString(CultureInfo.InvariantCulture); } else { _paging = (SqlPaging)(ViewState["Paging"]); _paging.ItemsPerPage = SQLDataHelper.GetInt(ddRowsPerPage.SelectedValue); if (_paging == null) { throw (new Exception("Paging lost")); } string strIds = Request.Form["SelectedIds"]; if (!string.IsNullOrEmpty(strIds)) { strIds = strIds.Trim(); string[] arrids = strIds.Split(' '); var ids = new string[arrids.Length]; _selectionFilter = new InSetFieldFilter { IncludeValues = true }; for (int idx = 0; idx <= ids.Length - 1; idx++) { int t = int.Parse(arrids[idx]); if (t != -1) { ids[idx] = t.ToString(); } else { _selectionFilter.IncludeValues = false; _inverseSelection = true; } } _selectionFilter.Values = ids; //_InverseSelection = If(ids(0) = -1, True, False) } } }