示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int parentMenuID = -1;

            int.TryParse(this.Request.QueryString["pid"], out parentMenuID);

            int applicationID = -1;

            int.TryParse(this.Request.QueryString["appid"], out applicationID);

            SystemApplication application = systemApplicationServiceInstance.FindById(applicationID);


            if (parentMenuID >= 0)
            {
                SystemMenu systemMenu = systemMenuServiceInstance.GetNewDomainInstance();
                if (parentMenuID == 0)
                {
                    systemMenu.ParentMenuID = null;
                }
                else
                {
                    systemMenu.ParentMenuID = systemMenuServiceInstance.FindById(parentMenuID);
                }
                systemMenu.MenuName        = this.txtMenuName.Text.Trim();
                systemMenu.MenuDescription = this.txtMenuDescription.Value.Trim();

                systemMenu.MenuUrl          = this.txtMenuUrl.Text;
                systemMenu.MenuIsSystemMenu = false;
                systemMenu.MenuIsEnable     = true;

                systemMenu.ApplicationID = application;

                systemMenuServiceInstance.Create(systemMenu);

                //string showscript = "alert('添加子菜单成功!');window.dialogArguments.document.getElementById('" +
                //                    this.Request.QueryString["chid"] + "').value='" + parentMenuID +
                //                    "';window.dialogArguments.document.getElementById('" +
                //    this.Request.QueryString["cRebtn"] + "').click();window.close();";

                string showscript = "alert('添加子菜单成功!');window.dialogArguments.document.getElementById('" +
                                    this.Request.QueryString["cRebtn"] + "').click();window.close();";


                Anthem.Manager.AddScriptForClientSideEval(showscript);
            }
            else
            {
                Anthem.Manager.AddScriptForClientSideEval("alert('添加子菜单失败!');");
            }
        }
 protected override void SaveData(SystemMenu obj)
 {
     systemMenuServiceInstance.Create(obj);
 }