protected void Page_Load(object sender, EventArgs e)
 {
     if (Category != null && Category.CategoryId > 0) {
     DataSet ds = new CategoryController().FetchCategoryManufacturers(category.CategoryId);
     if (ds.Tables[0].Rows.Count > 0) {
       rptrNarrowByManufacturer.DataSource = ds;
       rptrNarrowByManufacturer.DataBind();
     }
       }
 }
 /// <summary>
 /// Loads the favorite categories.
 /// </summary>
 private void LoadFavoriteCategories()
 {
     if (base.MasterPage.SiteSettings.CollectBrowsingCategory) {
     DataSet ds = new CategoryController().FetchFavoriteCategories(WebUtility.GetUserName());
     if (ds.Tables[0].Rows.Count > 0) {
       rptrFavoriteCategories.DataSource = ds;
       rptrFavoriteCategories.DataBind();
     }
       }
 }
        category.Save(WebUtility.GetUserName());
        RefreshCache(categoryId);
        Reset();
        GetCategoryDataSet();
        LoadTreeView(ds);
        LoadChildren(category.ParentId);
        LoadParentCategoryDropDown(ds);
        Master.MessageCenter.DisplaySuccessMessage(LocalizationUtility.GetText("lblProductCategorySaved"));
      }
      catch(Exception ex) {
        Logger.Error(typeof(categoryedit).Name + ".btnSave_Click", ex);
        Master.MessageCenter.DisplayCriticalMessage(ex.Message);
      }
    }

    /// <summary>
    /// Handles the ItemReorder event of the Items control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
    protected void Items_ItemReorder(object sender, EventArgs e) {
      try {
        int categoryId = -1;
        ImageButton theButton = sender as ImageButton;
        bool isParsed = int.TryParse(theButton.CommandArgument.ToString(), out categoryId);
        if(isParsed) {
          Category selectedCategory = new Category(categoryId);
          Query query = new Query(Category.Schema).
            WHERE(Category.Columns.ParentId, Comparison.Equals, selectedCategory.ParentId).
            ORDER_BY(Category.Columns.SortOrder);
          CategoryCollection categoryCollection = new CategoryController().FetchByQuery(query);
          if(categoryCollection != null) {
            Category categoryMoved = categoryCollection.Find(delegate(Category category) {
              return category.CategoryId == categoryId;
            });
            int index = categoryCollection.IndexOf(categoryMoved);
            categoryCollection.RemoveAt(index);
            if(theButton.CommandName.ToLower() == "up") {
              categoryCollection.Insert(index - 1, categoryMoved);
            }
            else if(theButton.CommandName.ToLower() == "down") {
              categoryCollection.Insert(index + 1, categoryMoved);
            }
            int i = 1;
            foreach(Category category in categoryCollection) {
              category.SortOrder = i++;
            }
Esempio n. 4
0
 /// <summary>
 /// Loads the categories.
 /// </summary>
 private void LoadCategories()
 {
     DataSet ds = new CategoryController().FetchCategoryList();
       LoadParentCategoryDropDown(ds);
 }