コード例 #1
0
        private void LoadProducts()
        {
            string menu = "";
            EGEMech.BLL.Category cats = new EGEMech.BLL.Category();
            cats.LoadAll();
            for (int i = 0; i < cats.RowCount; i++)
            {
                menu += "<li><a href='products.aspx?cid=" + cats.CategoryID.ToString() + "'>" + cats.Name + "</a> ";
                menu += LoadSubCats(cats.CategoryID);
                menu += "</li>";
                cats.MoveNext();
            }

            Literal2.Text = menu;
        }
コード例 #2
0
        protected void uiGridViewCats_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditCat")
            {
                Category cat = new EGEMech.BLL.Category();
                cat.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                CurrentCategory = cat;

                uiTextBoxName.Text = cat.Name;

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

            }
        }