コード例 #1
0
    public void LoadData()
    {
        var data = ProductOnMain.GetAdminProductsByType(Flag, 9);

        switch (Flag)
        {
        case ProductOnMain.TypeFlag.Bestseller:
            locName.Text = Resources.Resource.Admin_UserControls_MainPageProduct_Bestseller;
            break;

        case ProductOnMain.TypeFlag.New:
            locName.Text = Resources.Resource.Admin_UserControls_MainPageProduct_New;
            break;

        case ProductOnMain.TypeFlag.Discount:
            locName.Text = Resources.Resource.Admin_UserControls_MainPageProduct_Discount;
            break;
        }

        if (data.Rows.Count > 0)
        {
            rMainProduct.DataSource = data;
            rMainProduct.DataBind();
        }
        else
        {
            ProductsNoRecordsBlock.Visible = true;
        }
    }
コード例 #2
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        popTree.UpdateTree(ProductOnMain.GetProductIdByType(_typeFlag));

        if (grid.UpdatedRow != null && ValidationHelper.IsValidPositiveIntNumber(grid.UpdatedRow["ID"]) && ValidationHelper.IsValidPositiveIntNumber(grid.UpdatedRow["Sort"]))
        {
            var prodcutId = Convert.ToInt32(grid.UpdatedRow["ID"]);
            var sortOrder = Convert.ToInt32(grid.UpdatedRow["Sort"]);
            ProductOnMain.UpdateProductByType(prodcutId, sortOrder, _typeFlag);
        }

        DataTable data = _paging.PageItems;

        while (data.Rows.Count < 1 && _paging.CurrentPageIndex > 1)
        {
            _paging.CurrentPageIndex--;
            data = _paging.PageItems;
        }

        var clmn = new DataColumn("IsSelected", typeof(bool))
        {
            DefaultValue = _inverseSelection
        };

        data.Columns.Add(clmn);
        if ((_selectionFilter != null) && (_selectionFilter.Values != null))
        {
            for (int i = 0; i <= data.Rows.Count - 1; i++)
            {
                int intIndex = i;
                if (Array.Exists(_selectionFilter.Values, c => c == data.Rows[intIndex]["ID"].ToString()))
                {
                    data.Rows[i]["IsSelected"] = !_inverseSelection;
                }
            }
        }

        if (data.Rows.Count < 1)
        {
            goToPage.Visible = false;
        }

        grid.DataSource = data;
        grid.DataBind();


        pageNumberer.PageCount = _paging.PageCount;
        lblFound.Text          = _paging.TotalRowsCount.ToString(CultureInfo.InvariantCulture);

        if (!IsPostBack || _needReloadTree)
        {
            ibRecalculate.Attributes.Add("onmouseover", "this.src=\'images/broundarrow.gif\';");
            tree.Nodes.Clear();
            LoadRootCategories(tree.Nodes);
        }
    }
コード例 #3
0
 protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteProduct")
     {
         if (_typeFlag == ProductOnMain.TypeFlag.None)
         {
             return;
         }
         ProductOnMain.DeleteProductByType(Convert.ToInt32(e.CommandArgument), _typeFlag);
     }
 }
コード例 #4
0
    protected void popTree_Selected(object sender, Admin_UserControls_PopupTreeView.TreeNodeSelectedArgs args)
    {
        if (_typeFlag == ProductOnMain.TypeFlag.None)
        {
            return;
        }

        foreach (var altId in args.SelectedValues)
        {
            ProductOnMain.AddProductByType(Convert.ToInt32(altId), _typeFlag);
        }
        popTree.UpdateTree(ProductOnMain.GetProductIdByType(_typeFlag));
    }
コード例 #5
0
        protected void popTree_Selected(object sender, PopupTreeView.TreeNodeSelectedArgs args)
        {
            if (_typeFlag == ProductOnMain.TypeFlag.None)
            {
                return;
            }

            foreach (var altId in args.SelectedValues)
            {
                ProductOnMain.AddProductByType(SQLDataHelper.GetInt(altId), _typeFlag);
            }
            popTree.UpdateTree(ProductOnMain.GetProductIdByType(_typeFlag));
        }
コード例 #6
0
 protected void lbDeleteSelected_Click(object sender, EventArgs e)
 {
     if ((_selectionFilter != null) && (_selectionFilter.Values != null))
     {
         if (!_inverseSelection)
         {
             foreach (var id in _selectionFilter.Values)
             {
                 ProductOnMain.DeleteProductByType(Convert.ToInt32(id), _typeFlag);
             }
         }
         else
         {
             var itemsIds = _paging.ItemsIds <int>("Product.ProductId as ID");
             foreach (int id in itemsIds.Where(id => !_selectionFilter.Values.Contains(id.ToString(CultureInfo.InvariantCulture))))
             {
                 ProductOnMain.DeleteProductByType(id, _typeFlag);
             }
         }
     }
 }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SettingsDesign.eMainPageMode currentMode = !Demo.IsDemoEnabled || !CommonHelper.GetCookieString("structure").IsNotEmpty()
                      ? SettingsDesign.MainPageMode
                      : (SettingsDesign.eMainPageMode)Enum.Parse(typeof(SettingsDesign.eMainPageMode), CommonHelper.GetCookieString("structure"));


        if (Mode != currentMode)
        {
            this.Visible = false;
            return;
        }

        const byte itemsPerLine     = 4;
        const byte itemsPerLineThin = 3;

        var countNew        = ProductOnMain.GetProductCountByType(ProductOnMain.TypeFlag.New);
        var countDiscount   = ProductOnMain.GetProductCountByType(ProductOnMain.TypeFlag.Discount);
        var countBestseller = ProductOnMain.GetProductCountByType(ProductOnMain.TypeFlag.Bestseller);

        switch (Mode)
        {
        case SettingsDesign.eMainPageMode.Default:

            mvMainPageProduct.SetActiveView(viewDefault);

            if (countBestseller == 0)
            {
                ItemsCount = 3;
            }
            if (countNew == 0)
            {
                ItemsCount = ItemsCount == 2 ? 3 : 6;
            }
            if (countDiscount == 0)
            {
                ItemsCount = ItemsCount == 2 ? 3 : 6;
            }

            if (countBestseller > 0)
            {
                liBestsellers.Attributes.Add("class", "block width-for-" + ItemsCount);
                lvBestSellers.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Bestseller, ItemsCount * SettingsDesign.CountLineOnMainPage);
                lvBestSellers.DataBind();
            }
            else
            {
                liBestsellers.Visible = false;
            }
            if (countNew > 0)
            {
                liNew.Attributes.Add("class", "block width-for-" + ItemsCount);
                lvNew.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.New, ItemsCount * SettingsDesign.CountLineOnMainPage);
                lvNew.DataBind();
            }
            else
            {
                liNew.Visible = false;
            }

            if (countDiscount > 0)
            {
                liDiscount.Attributes.Add("class", "block block-last width-for-" + ItemsCount);
                lvDiscount.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Discount, ItemsCount * SettingsDesign.CountLineOnMainPage);
                lvDiscount.DataBind();
            }
            else
            {
                liDiscount.Visible = false;
            }

            break;

        case SettingsDesign.eMainPageMode.TwoColumns:
            mvMainPageProduct.SetActiveView(viewAlternative);

            if (countBestseller > 0)
            {
                lvBestSellersAltervative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Bestseller, itemsPerLine * SettingsDesign.CountLineOnMainPage);
                lvBestSellersAltervative.DataBind();
            }
            else
            {
                pnlBest.Visible = false;
            }

            if (countNew > 0)
            {
                lvNewAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.New, itemsPerLine * SettingsDesign.CountLineOnMainPage);
                lvNewAlternative.DataBind();
            }
            else
            {
                pnlNew.Visible = false;
            }

            if (countDiscount > 0)
            {
                lvDiscountAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Discount, itemsPerLine * SettingsDesign.CountLineOnMainPage);
                lvDiscountAlternative.DataBind();
            }
            else
            {
                pnlDiscount.Visible = false;
            }
            break;

        case SettingsDesign.eMainPageMode.ThreeColumns:
            mvMainPageProduct.SetActiveView(viewAlternative);

            if (countBestseller > 0)
            {
                lvBestSellersAltervative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Bestseller, itemsPerLineThin * SettingsDesign.CountLineOnMainPage);
                lvBestSellersAltervative.DataBind();
            }
            else
            {
                pnlBest.Visible = false;
            }

            if (countNew > 0)
            {
                lvNewAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.New, itemsPerLineThin * SettingsDesign.CountLineOnMainPage);
                lvNewAlternative.DataBind();
            }
            else
            {
                pnlNew.Visible = false;
            }

            if (countDiscount > 0)
            {
                lvDiscountAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Discount, itemsPerLineThin * SettingsDesign.CountLineOnMainPage);
                lvDiscountAlternative.DataBind();
            }
            else
            {
                pnlDiscount.Visible = false;
            }
            break;

        default:
            throw new NotImplementedException();
        }
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        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;
        //changed by Evgeni for multiple price
        defaultDS.TableName = "[Catalog].[Product] LEFT JOIN [Catalog].[Offer] ON [Product].[ProductID] = [Offer].[ProductID]  AND [OfferListID] = 6 LEFT JOIN [Catalog].[Photo] ON [Product].[ProductID] = [Photo].[ObjId]  And Type='Product' AND [Main] = 1  LEFT JOIN [Catalog].[ShoppingCart] ON [Catalog].[ShoppingCart].[EntityID] = [Catalog].[Product].[ProductID] AND [Catalog].[ShoppingCart].[ShoppingCartTypeId] = 3 AND [ShoppingCart].[CustomerID] = @CustomerId  Left JOIN [Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=@CustomerId";
        defaultDS.AddParamSql(new SqlParam {
            ParamName = "@CustomerId", ParamValue = CustomerSession.CustomerId.ToString()
        });
        defaultDS.AddCondition("[Settings].[CountCategoriesByProduct](Product.ProductID) > 0");

        defaultDS.Fields["HirecalEnabled"].Filter = new EqualFieldFilter {
            Value = "1", ParamName = "@HirecalEnabled"
        };
        defaultDS.Fields["Enabled"].Filter = new EqualFieldFilter {
            Value = "1", ParamName = "@Enabled"
        };

        if (_typeFlag == ProductOnMain.TypeFlag.Bestseller)
        {
            var filterB = new EqualFieldFilter {
                ParamName = "@Bestseller", Value = "1"
            };
            defaultDS.Fields["Bestseller"].Filter = filterB;
            defaultDS.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"
            };
            defaultDS.Fields["New"].Filter = filterN;
            defaultDS.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"
            };
            defaultDS.Fields["Discount"].Filter = filterN;
            defaultDS.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();
    }
コード例 #9
0
        private void AddNewContentInFooter()
        {
            SettingsDesign.eMainPageMode currentMode = !Demo.IsDemoEnabled || !CommonHelper.GetCookieString("structure").IsNotEmpty()
                                                           ? SettingsDesign.MainPageMode
                                                           : (SettingsDesign.eMainPageMode)Enum.Parse(typeof(SettingsDesign.eMainPageMode), CommonHelper.GetCookieString("structure"));


            if (SettingsDesign.Template == TemplateService.DefaultTemplateId && Mode != currentMode)
            {
                this.Visible = false;
                return;
            }

            LoadModules();

            var countNew        = ProductOnMain.GetProductCountByType(ProductOnMain.TypeFlag.New);
            var countDiscount   = ProductOnMain.GetProductCountByType(ProductOnMain.TypeFlag.Discount);
            var countBestseller = ProductOnMain.GetProductCountByType(ProductOnMain.TypeFlag.Bestseller);
            var countRecomended = ProductOnMain.GetProductCountByType(ProductOnMain.TypeFlag.Recomended);

            switch (Mode)
            {
            case SettingsDesign.eMainPageMode.Default:

                mvMainPageProduct.SetActiveView(viewDefault);

                int ItemsCount = 3;

                if (countBestseller == 0)
                {
                    ItemsCount = 3;
                }
                if (countNew == 0)
                {
                    ItemsCount = ItemsCount == 2 ? 3 : 6;
                }
                if (countDiscount == 0)
                {
                    ItemsCount = ItemsCount == 2 ? 3 : 6;
                }
                if (countRecomended == 0)
                {
                    ItemsCount = ItemsCount == 2 ? 3 : 6;
                }

                if (countBestseller > 0)
                {
                    liBestsellers.Attributes.Add("class", "block width-for-" + ItemsCount);     //SettingsDesign.CountLineOnMainPage);
                    //lvBestSellers.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Bestseller, ItemCountInRow);
                    lvBestSellers.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Bestseller, 12);
                    lvBestSellers.DataBind();
                }
                else
                {
                    liBestsellers.Visible = false;
                }
                if (countNew > 0)
                {
                    liNew.Attributes.Add("class", "block width-for-" + ItemsCount);     //SettingsDesign.CountLineOnMainPage);
                    //lvNew.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.New, ItemCountInRow);
                    lvNew.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.New, 12);
                    lvNew.DataBind();
                }
                else
                {
                    liNew.Visible = false;
                }

                if (countDiscount > 0)
                {
                    liDiscount.Attributes.Add("class", "block block-last width-for-" + ItemsCount);     //SettingsDesign.CountLineOnMainPage);
                    //lvDiscount.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.OnSale, ItemCountInRow);
                    lvDiscount.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.OnSale, 12);
                    lvDiscount.DataBind();
                }
                else
                {
                    liDiscount.Visible = false;
                }

                if (countRecomended > 0)
                {
                    liRecomended.Attributes.Add("class", "block width-for-" + ItemsCount);     //SettingsDesign.CountLineOnMainPage);
                    //lvRecomended.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Recomended, ItemCountInRow);
                    lvRecomended.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Recomended, 12);
                    lvRecomended.DataBind();
                }
                else
                {
                    liRecomended.Visible = false;
                }

                break;

            case SettingsDesign.eMainPageMode.TwoColumns:
                mvMainPageProduct.SetActiveView(viewDefault);

                if (countBestseller > 0)
                {
                    lvBestSellers.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Bestseller, ItemCountInRow);
                    lvBestSellers.DataBind();
                }
                else
                {
                    pnlBest.Visible = false;
                }

                if (countNew > 0)
                {
                    lvNewAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.New, ItemCountInRow);
                    lvNewAlternative.DataBind();
                }
                else
                {
                    pnlNew.Visible = false;
                }

                if (countDiscount > 0)
                {
                    lvDiscountAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Discount, ItemCountInRow);
                    lvDiscountAlternative.DataBind();
                }
                else
                {
                    pnlDiscount.Visible = false;
                }

                if (countRecomended > 0)
                {
                    lvRecomended.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Recomended, ItemCountInRow);
                    lvRecomended.DataBind();
                }
                else
                {
                    pnlRecomended.Visible = false;
                }
                break;

            case SettingsDesign.eMainPageMode.ThreeColumns:
                mvMainPageProduct.SetActiveView(viewDefault);

                if (countBestseller > 0)
                {
                    lvBestSellers.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Bestseller, ItemCountInRow);
                    lvBestSellers.DataBind();
                }
                else
                {
                    pnlBest.Visible = false;
                }

                if (countNew > 0)
                {
                    lvNewAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.New, ItemCountInRow);
                    lvNewAlternative.DataBind();
                }
                else
                {
                    pnlNew.Visible = false;
                }

                if (countDiscount > 0)
                {
                    lvDiscountAlternative.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Discount, ItemCountInRow);
                    lvDiscountAlternative.DataBind();
                }
                else
                {
                    pnlDiscount.Visible = false;
                }

                if (countRecomended > 0)
                {
                    lvRecomended.DataSource = ProductOnMain.GetProductsByType(ProductOnMain.TypeFlag.Recomended, ItemCountInRow);
                    lvRecomended.DataBind();
                }
                else
                {
                    pnlRecomended.Visible = false;
                }
                break;

            default:
                throw new NotImplementedException();
            }
        }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _paging = new SqlPaging();
            _paging.From("[Catalog].[Product]");
            _paging.Inner_Join("[Catalog].[ProductExt]  ON [Product].[ProductID] = [ProductExt].[ProductID]");
            _paging.Left_Join("[Catalog].[Photo]  ON [Photo].[PhotoId] = [ProductExt].[PhotoId]");
            _paging.Left_Join("[Catalog].[Offer] ON [ProductExt].[OfferID] = [Offer].[OfferID]");

            _paging.Left_Join("[Catalog].[ShoppingCart] ON [ShoppingCart].[OfferID] = [Offer].[OfferID] AND [ShoppingCart].[ShoppingCartType] = 3 AND [ShoppingCart].[CustomerID] = {0}", CustomerContext.CustomerId);
            _paging.Left_Join("[Catalog].[Ratio] on Product.ProductId= Ratio.ProductID and Ratio.CustomerId=[ShoppingCart].[CustomerID]");


            _paging.Select(
                "[Product].[ProductID]",
                "CountPhoto",
                "Photo.PhotoId",
                "PhotoName AS Photo",
                "Photo.Description as PhotoDesc",
                "BriefDescription",
                "Product.ArtNo",
                "Name",
                "Recomended",
                "Bestseller",
                "New",
                "OnSale",
                "[Product].Discount",
                "Offer.OfferID",
                "MaxAvailable AS Amount",
                "MinAmount",
                "MaxAmount",
                "Enabled",
                "AllowPreOrder",
                "Ratio",
                "RatioID",
                "ShoppingCartItemId",
                "UrlPath",
                "Offer.ColorID",
                "null as AdditionalPhoto"
                );

            if (SettingsCatalog.ComplexFilter)
            {
                _paging.Select(
                    "Colors",
                    "NotSamePrices as MultiPrices",
                    "MinPrice as Price"
                    );
            }
            else
            {
                _paging.Select(
                    "null as Colors",
                    "0 as MultiPrices",
                    "Price"
                    );
            }

            if (string.IsNullOrEmpty(Request["type"]) || !Enum.TryParse(Request["type"], true, out _typeFlag) ||
                _typeFlag == ProductOnMain.TypeFlag.None)
            {
                Error404();
            }

            switch (_typeFlag)
            {
            case ProductOnMain.TypeFlag.Bestseller:
                PageName = Resource.Client_ProductList_AllBestSellers;
                SetMeta(new MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_Bestsellers_Header), string.Empty);
                break;

            case ProductOnMain.TypeFlag.New:
                PageName = Resource.Client_ProductList_AllNew;
                SetMeta(new MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_New_Header), string.Empty);
                break;

            case ProductOnMain.TypeFlag.Discount:
                PageName = Resource.Client_ProductList_AllDiscount;
                SetMeta(new MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_Discount_Header), string.Empty);
                break;

            case ProductOnMain.TypeFlag.OnSale:
                PageName = Resource.Client_ProductList_OnSale;
                SetMeta(new MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_OnSale_Header), string.Empty);
                break;

            case ProductOnMain.TypeFlag.Recomended:
                PageName = Resource.Client_ProductList_Recomended;
                SetMeta(new MetaInfo(SettingsMain.ShopName + " - " + Resource.Client_Recomended_Header), string.Empty);
                break;
            }

            ProductsCount       = ProductOnMain.GetProductCountByType(_typeFlag);
            pnlSort.Visible     = ProductsCount > 0;
            productView.Visible = ProductsCount > 0;

            breadCrumbs.Items.AddRange(new BreadCrumbs[]
            {
                new BreadCrumbs()
                {
                    Name = Resource.Client_MasterPage_MainPage,
                    Url  = UrlService.GetAbsoluteLink("/")
                },
                new BreadCrumbs()
                {
                    Name = PageName, Url = null
                }
            });

            BuildSorting();
            BuildFilter();
        }