using PageAdmin.BLL;
using PageAdmin.Common;
using System.Web.Mvc;

namespace PageAdmin.Web.Areas.Admin.Controllers
{
    public class MemberMenuController : DefaultBaseController
    {
        public MemberMenuController() : base("pa_member_menu", "System/Configure")
        {
            base.MvcContext.IsMultilevelTable = true;

            base.EditExecuted = OnAdded;
            base.AddExecuted = OnAdded;
            base.DeleteExecuting = OnDeleteExecuting;
        }

        /// <summary>
        /// 添加或编辑后添加默认菜单项
        /// </summary>
        private void OnAdded()
        {
            MemberMenuBLL bll = new MemberMenuBLL();
            bll.AddDefaultItem(base.MvcContext.Data, base.MvcContext.DetailId);
        }
        private void OnDeleteExecuting()
        {
            base.MvcContext.SqlCondition = "isSys=0";
        }

        protected override void OnActionExecuted(ActionExecutedContext context)
        {
            MemberMenuBLL bll = new MemberMenuBLL();
            bll.InitMenuItem();
            base.OnActionExecuted(context);
        }

    }
}