Beispiel #1
0
 private string SelectCategory(int catId, string moduleName, string message)
 {
     if (ExportFeedService.CheakCategoryHierical(moduleName, catId) || ExportFeedService.CheakCategory(moduleName, catId))
     {
         return("<span style='color: blue;font-weight:bold;'>" + message + "</span");
     }
     return(message);
 }
Beispiel #2
0
    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;
            }
        }
    }