public override void LoadQualification() { var allCats = HccApp.CatalogServices.Categories.FindAll(); var available = CategoriesHelper.ListFullTreeWithIndents(allCats, true); var displayData = new List <FriendlyBvinDisplay>(); foreach (var bvin in TypedQualification.CurrentCategoryIds()) { var item = new FriendlyBvinDisplay(); item.bvin = bvin; item.DisplayName = bvin; var t = available.FirstOrDefault(y => y.Value == bvin); if (t != null) { item.DisplayName = t.Text; available.Remove(t); } displayData.Add(item); } lstProductCategories.Items.Clear(); foreach (var li in available) { lstProductCategories.Items.Add(li); } gvProductCategories.DataSource = displayData; gvProductCategories.DataBind(); }
private void PopulateCategories(string currentBvin = null) { // get a collection of categories to bind to the DLL (filtered to not allow assignment to children of current parent) var categories = HccApp.CatalogServices.Categories.FindAllSnapshotsPaged(1, int.MaxValue) .Where(x => currentBvin == null || x.ParentId != currentBvin) .ToList(); var parents = CategoriesHelper.ListFullTreeWithIndents(categories, true); ParentCategoryDropDownList.Items.Clear(); // iterate through each category and add to the DDL foreach (var category in parents) { // update the category name if it's empty category.Text = Regex.IsMatch(category.Text, EMPTY_CATEGORY_PATTERN) ? string.Concat(category.Text, NO_NAME_TEXT) : category.Text; // let the merchant know visually that this is the current category they're editing if (category.Value == currentBvin) { // change the name to reflect this category.Text = string.Concat(CURRENT_CATEGORY_TEXT, category.Text); } // create a new DLL item ParentCategoryDropDownList.Items.Add(category); } // add a default option for making the category a top-level category ParentCategoryDropDownList.Items.Insert(0, new ListItem(TOP_LEVEL_CATEGORY_TEXT, string.Empty)); }
private void PopulateCategories() { var tree = CategoriesHelper.ListFullTreeWithIndents(HccApp.CatalogServices.Categories); CategoryFilter.Items.Clear(); foreach (var li in tree) { CategoryFilter.Items.Add(li); } CategoryFilter.Items.Insert(0, new ListItem("- Any Category -", string.Empty)); }
private void PopulateCategories() { var tree = CategoriesHelper.ListFullTreeWithIndents(HccApp.CatalogServices.Categories); ddlCategoryFilter.Items.Clear(); foreach (var li in tree) { var item = new RadComboBoxItem(li.Text, li.Value); ddlCategoryFilter.Items.Add(item); } ddlCategoryFilter.Items.Insert(0, new RadComboBoxItem(Localization.GetString("AnyCategory"), string.Empty)); }
private void RenderCategoryTree() { var sb = new StringBuilder(); var allCats = HccApp.CatalogServices.Categories.FindAllSnapshotsPaged(1, 5000); lstParents.Items.Clear(); lstParents.Items.Add(new RadComboBoxItem("(Root)", string.Empty)); var parents = CategoriesHelper.ListFullTreeWithIndents(allCats, true); foreach (var li in parents) { lstParents.Items.Add(new RadComboBoxItem(li.Text, li.Value)); } RenderChildren(string.Empty, allCats, sb); litMain.Text = sb.ToString(); }
public override void LoadQualification() { if (ddlCalcMode.Items.Count == 0) { ddlCalcMode.Items.Add(new ListItem(Localization.GetString("TotalPrice"), "0")); ddlCalcMode.Items.Add(new ListItem(Localization.GetString("TotalCount"), "1")); } var allCats = HccApp.CatalogServices.Categories.FindAll(); var available = CategoriesHelper.ListFullTreeWithIndents(allCats, true); var displayData = new List <FriendlyBvinDisplay>(); foreach (var bvin in TypedQualification.CategoryIds()) { var item = new FriendlyBvinDisplay(); item.bvin = bvin; item.DisplayName = bvin; var t = available.FirstOrDefault(y => y.Value == bvin); if (t != null) { item.DisplayName = t.Text; available.Remove(t); } displayData.Add(item); } lstLineItemCategories.Items.Clear(); foreach (var li in available) { lstLineItemCategories.Items.Add(li); } ddlCalcMode.SelectedValue = ((int)TypedQualification.CalculationMode).ToString(); txtSumOrCount.Text = TypedQualification.SumAmount.ToString(); gvLineItemCategories.DataSource = displayData; gvLineItemCategories.DataBind(); }
private void LoadCategories() { chkCategories.Items.Clear(); var t = HccApp.CatalogServices.FindCategoriesForProduct(Request.QueryString["ID"]); var tree = CategoriesHelper.ListFullTreeWithIndents(HccApp.CatalogServices.Categories, true); foreach (var li in tree) { chkCategories.Items.Add(li); } foreach (var ca in t) { foreach (ListItem l in chkCategories.Items) { if (l.Value == ca.Bvin) { l.Selected = true; } } } }
public void BindCategories() { CategoriesGridView.DataSource = CategoriesHelper.ListFullTreeWithIndents(HccApp.CatalogServices.Categories); CategoriesGridView.DataKeyNames = new[] { "value" }; CategoriesGridView.DataBind(); }