예제 #1
0
 private string LoadSubCats(int parent)
 {
     string submenu = "";
     EGEMech.BLL.SubCategory scat = new EGEMech.BLL.SubCategory();
     scat.GetSubCategoryByCatID(parent);
     if (scat.RowCount > 0)
     {
         submenu = "<ul style='display: none;'>";
         for (int i = 0; i < scat.RowCount; i++)
         {
             submenu += "<li><a href='products.aspx?cid=" + scat.CategoryID.ToString() + "&scid=" + scat.SubCategoryID.ToString() + "'>" + scat.Name + "</a> </li>";
             scat.MoveNext();
         }
         submenu += "</ul>";
     }
     return submenu;
 }
        protected void uiGridViewSubCats_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditSubCat")
            {
                SubCategory subcat = new EGEMech.BLL.SubCategory();
                subcat.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                CurrentSubCategory = subcat;
                uiDropDownListCategory.SelectedValue = subcat.CategoryID.ToString();
                uiTextBoxName.Text = subcat.Name;

                uiPanelViewCats.Visible = false;
                uiPanelEdit.Visible = true;
            }
            else if (e.CommandName == "DeleteSubCat")
            {
                try
                {
                    SubCategory cat = new EGEMech.BLL.SubCategory();
                    cat.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                    cat.MarkAsDeleted();
                    cat.Save();
                    BindData();
                }
                catch (Exception ex)
                {
                    uiLabelError.Visible = true;
                }

            }
        }