private string SelectCategory(int catId, string moduleName, string message) { if (ExportFeedService.CheckCategoryHierical(moduleName, catId) || ExportFeedService.CheckCategory(moduleName, catId)) { return("<span style='color: blue;font-weight:bold;'>" + message + "</span>"); } return(message); }
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; } YaHelp.Visible = (ModuleName == "YandexMarket"); CsvHelp.Visible = (ModuleName == "CsvExport"); 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.CheckCategoryHierical(ModuleName, _catId); pnlCategorySet.Enabled = !flag; chbFull.Checked = ExportFeedService.CheckCategory(ModuleName, _catId); pnlData.Enabled = !chbFull.Checked && !flag; } PageSubheader.Visible = true; ModuleNameLiteral.Text = ModuleName; if (!IsPostBack) { var rootCategory = CategoryService.GetCategory(0); var node2 = new TreeNode { Text = SelectCategory(0, ModuleName, rootCategory != null ? rootCategory.Name : 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] 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 = ModuleName != "CsvExport" ? "and Offer.Price > 0 and ((Select Max(Amount) from Catalog.Offer where Offer.ProductID = Product.ProductID) > 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) { if (SaasDataService.IsSaasEnabled && !SaasDataService.CurrentSaasData.HaveExcel) { mainDiv.Visible = false; notInTariff.Visible = true; } lblCategoriesCount.Text = ExportFeedService.CheckCategory("CsvExport", 0) ? Resource.Admin_ExportCsv_AllCategories : ExportFeedService.GetCsvCategoriesCount("CsvExport") + " " + Resource.Admin_ExportCsv_Categories; //hrefAgaint.Visible = false; SetMeta(string.Format("{0} - {1}", SettingsMain.ShopName, Resource.Admin_ExportExcel_Title)); if (!IsPostBack) { ChbCategorySort.Checked = Request[CategorySort].TryParseBool(); ddlEncoding.Items.Clear(); foreach (var enumItem in (EncodingsEnum[])Enum.GetValues(typeof(EncodingsEnum))) { ddlEncoding.Items.Add(new ListItem(enumItem.ToString(), enumItem.StrName())); } ddlEncoding.SelectedValue = CsvSettings.CsvEnconing; ddlSeparetors.Items.Clear(); foreach (var enumItem in (SeparatorsEnum[])Enum.GetValues(typeof(SeparatorsEnum))) { ddlSeparetors.Items.Add(new ListItem(enumItem.ResourceKey(), enumItem.StrName())); } foreach (var enumItem in (SeparatorsEnum[])Enum.GetValues(typeof(SeparatorsEnum))) { if (CsvSettings.CsvSeparator == enumItem.StrName()) { ddlSeparetors.SelectedValue = enumItem.StrName(); } if (CsvSettings.CsvSeparator == SeparatorsEnum.Custom.StrName()) { txtCustomSeparator.Text = CsvSettings.CsvSeparator; } } txtColumSeparator.Text = CsvSettings.CsvColumSeparator; txtPropertySeparator.Text = CsvSettings.CsvPropertySeparator; chbCsvExportNoInCategory.Checked = CsvSettings.CsvExportNoInCategory; } if (choseDiv.FindControl("tblValues") != null && IsPostBack) { var cells = ((TableRow)choseDiv.FindControl("ddlRow")).Cells; foreach (TableCell item in cells) { var element = item.Controls.OfType <DropDownList>().FirstOrDefault(); if (element == null) { continue; } if (item.Controls.OfType <DropDownList>().First().SelectedValue == ProductFields.None.ConvertIntString()) { continue; } if (!FieldMapping.Contains((ProductFields)SQLDataHelper.GetInt(item.Controls.OfType <DropDownList>().First().SelectedValue))) { FieldMapping.Add((ProductFields)SQLDataHelper.GetInt((item.Controls.OfType <DropDownList>().First().SelectedValue)));//, cells.GetCellIndex(item)); } else { MsgErr(string.Format(Resource.Admin_ImportCsv_DuplicateMessage, item.Controls.OfType <DropDownList>().First().SelectedItem.Text)); return; } } if (ChbCategorySort.Checked) { var ind = FieldMapping.IndexOf(ProductFields.Category); if (ind > 0) { FieldMapping.Insert(ind + 1, ProductFields.Sorting); } else { FieldMapping.Add(ProductFields.Sorting); } } } if (FieldMapping.Count == 0 && IsPostBack) { MsgErr(Resource.Admin_ExportCsv_ListEmpty); return; } MsgErr(true); OutDiv.Visible = CommonStatistic.IsRun; linkCancel.Visible = CommonStatistic.IsRun; }