using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KstCmsBase.Entities;

namespace KstCMS.KstCMS_Manager.SystemSet.SoftFace.Menu
{
    public partial class AddSubMenu : KstCmsBase.WebPage.FrmControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Click += new EventHandler(Button1_Click);
            if (!IsPostBack)
            {
                Set_Validator();
                Button1.Enabled = isAdmin;
            }
            

        }

        void Button1_Click(object sender, EventArgs e)
        {
            System.Threading.Thread.Sleep(500);
            string MenuId = sMENU_ID.Text + MENU_ID.Text.Trim();
            string[] SubMenuFieldValues = new string[]{
                MenuId,
                MENU_NAME.Text.Trim(),
                MENU_CODE.Text.Trim(),
                MENU_IMAGE.Text.Trim()
            };
            KstCmsBase.DAL.SysMenu.SubMenu_Insert(SubMenuFieldValues, "MENU_ID", "MENU_NAME", "MENU_CODE", "MENU_IMAGE");
            ShowMsgModle("增加成功！", "location.href='SubMenuList.aspx?MenuId=" + sMENU_ID.Text.Trim() + "';");
           // this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('操作成功！');location.href='SubMenuList.aspx?MenuId=" + sMENU_ID.Text.Trim() + "';", true);

        }



        private void Set_Validator()
        {
            sMENU_ID.Text = Request.QueryString.Get("MenuId");
            sMENU_ID.ReadOnly = true;
            string[] Attr = new string[5];
            Attr[0] = "菜单代码~4:int!";
            Attr[1] = "菜单名称~!";
            Attr[2] = "菜单图标~noChinese!";
            Attr[3] = "模块地址~noChinese!";

            Set_Control(Attr, MENU_ID, MENU_NAME, MENU_IMAGE, MENU_CODE);
        }
    }
}