public void Show(string applicationId, string parentID)
        {
            SystemApplicationWrapper application = SystemApplicationWrapper.FindById(int.Parse(applicationId));

            if (application != null)
            {
                this.hidApplicationID.Text   = application.SystemApplicationID.ToString();
                this.lblApplicationName.Text = application.SystemApplicationName;


                if (parentID == "")
                {
                    this.lblParentMenuName.Text          = "作为主菜单";
                    this.fsMenuIsCategory.Disabled       = true;
                    this.fsMenuIsCategory.CheckboxToggle = false;
                }
                else
                {
                    this.lblParentMenuName.Text =
                        SystemMenuWrapper.FindById(int.Parse(parentID)).MenuName;
                    this.hidPMenuID.Text                 = parentID;
                    this.fsMenuIsCategory.Disabled       = false;
                    this.fsMenuIsCategory.CheckboxToggle = true;
                }

                this.txtMenuName.Text        = "";
                this.txtMenuDescription.Text = "";
            }

            this.winSystemMenuAdd.Show();
        }
        protected void btnSaveSystemMenu_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemMenuWrapper menuWrapper = SystemMenuWrapper.FindById(int.Parse(this.hidMenuID.Text));

                if (menuWrapper == null)
                {
                    winSystemMenuEdit.Hide();
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "Error Message:Record not existed.";
                    return;
                }

                menuWrapper.MenuName         = this.txtMenuName.Text.Trim();
                menuWrapper.MenuCode         = this.txtMenuCode.Text.Trim();
                menuWrapper.MenuDescription  = this.txtMenuDescription.Text.Trim();
                menuWrapper.ApplicationID    = SystemApplicationWrapper.FindById(int.Parse(this.hidApplicationID.Text));
                menuWrapper.MenuIsSystemMenu = this.chkMenuIsSystemMenu.Checked;
                menuWrapper.MenuIsEnable     = this.chkMenuIsEnable.Checked;
                menuWrapper.MenuIconUrl      = this.txtMenuIconUrl.Text.Trim();

                if (this.hidPMenuID.Text.Trim() != "")
                {
                    //menuWrapper.MenuOrder = SystemMenuWrapper.GetNewMaxMenuOrder(int.Parse(this.hidPMenuID.Text.Trim()), int.Parse(this.hidApplicationID.Text));
                    menuWrapper.ParentMenuID = SystemMenuWrapper.FindById(int.Parse(this.hidPMenuID.Text.Trim()));
                }
                else
                {
                    //menuWrapper.MenuOrder = SystemMenuWrapper.GetNewMaxMenuOrder(0, int.Parse(this.hidApplicationID.Text));
                }

                menuWrapper.MenuIsCategory = this.fsMenuIsCategory.Collapsed;

                if (!menuWrapper.MenuIsCategory)
                {
                    menuWrapper.MenuUrl       = this.txtMenuUrl.Text.Trim();
                    menuWrapper.MenuType      = this.cmbMenuType.SelectedItem.Value;
                    menuWrapper.MenuUrlTarget = this.cmbMenuUrlTarget.SelectedItem.Value;
                }
                else
                {
                    menuWrapper.MenuUrl       = "";
                    menuWrapper.MenuType      = "1";
                    menuWrapper.MenuUrlTarget = "1";
                }


                SystemMenuWrapper.Update(menuWrapper);

                winSystemMenuEdit.Hide();
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
            }
        }
        protected void btnSaveSystemMenu_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SystemMenuWrapper menuWrapper = new SystemMenuWrapper();
                menuWrapper.MenuName         = this.txtMenuName.Text.Trim();
                menuWrapper.MenuDescription  = this.txtMenuDescription.Text.Trim();
                menuWrapper.ApplicationID    = SystemApplicationWrapper.FindById(int.Parse(this.hidApplicationID.Text));
                menuWrapper.MenuIsSystemMenu = this.chkMenuIsSystemMenu.Checked;
                menuWrapper.MenuIsEnable     = this.chkMenuIsEnable.Checked;

                if (this.hidPMenuID.Text.Trim() != "")
                {
                    menuWrapper.MenuOrder    = SystemMenuWrapper.GetNewMaxMenuOrder(int.Parse(this.hidPMenuID.Text.Trim()), int.Parse(this.hidApplicationID.Text));
                    menuWrapper.ParentMenuID = SystemMenuWrapper.FindById(int.Parse(this.hidPMenuID.Text.Trim()));
                }
                else
                {
                    menuWrapper.MenuOrder = SystemMenuWrapper.GetNewMaxMenuOrder(0, int.Parse(this.hidApplicationID.Text));
                }

                menuWrapper.MenuIsCategory = this.fsMenuIsCategory.Collapsed;

                if (!menuWrapper.MenuIsCategory)
                {
                    menuWrapper.MenuIconUrl   = this.txtMenuIconUrl.Text.Trim();
                    menuWrapper.MenuUrl       = this.txtMenuUrl.Text.Trim();
                    menuWrapper.MenuType      = this.cmbMenuType.SelectedItem.Value;
                    menuWrapper.MenuUrlTarget = this.cmbMenuUrlTarget.SelectedItem.Value;
                }
                else
                {
                    menuWrapper.MenuIconUrl   = "";
                    menuWrapper.MenuUrl       = "";
                    menuWrapper.MenuType      = "1";
                    menuWrapper.MenuUrlTarget = "1";
                }


                SystemMenuWrapper.Save(menuWrapper);

                winSystemMenuAdd.Hide();
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
            }
        }
        public void Show(int id)
        {
            try
            {
                SystemMenuWrapper menu = SystemMenuWrapper.FindById(id);

                if (menu != null)
                {
                    this.hidMenuID.Text          = menu.MenuID.ToString();
                    this.hidApplicationID.Text   = menu.ApplicationID.SystemApplicationID.ToString();
                    this.lblApplicationName.Text = menu.ApplicationID.SystemApplicationName;


                    if (menu.ParentMenuID == null)
                    {
                        this.lblParentMenuName.Text          = "As root menu";
                        this.fsMenuIsCategory.Disabled       = true;
                        this.fsMenuIsCategory.CheckboxToggle = false;
                    }
                    else
                    {
                        this.lblParentMenuName.Text =
                            menu.ParentMenuID.MenuName;
                        this.hidPMenuID.Text                 = menu.ParentMenuID.MenuID.ToString();
                        this.fsMenuIsCategory.Disabled       = false;
                        this.fsMenuIsCategory.CheckboxToggle = true;
                    }

                    this.txtMenuName.Text            = menu.MenuName;
                    this.txtMenuCode.Text            = menu.MenuCode;
                    this.txtMenuDescription.Text     = menu.MenuDescription;
                    this.chkMenuIsSystemMenu.Checked = (menu.MenuIsSystemMenu.HasValue ? menu.MenuIsSystemMenu.Value : false);
                    this.chkMenuIsEnable.Checked     = (menu.MenuIsEnable.HasValue ? menu.MenuIsEnable.Value : false);
                    this.txtMenuIconUrl.Text         = menu.MenuIconUrl;

                    this.fsMenuIsCategory.Collapsed = menu.MenuIsCategory;


                    if (!menu.MenuIsCategory)
                    {
                        this.txtMenuUrl.Text = menu.MenuUrl;
                        if (string.IsNullOrEmpty(menu.MenuType))
                        {
                            this.cmbMenuType.SelectedIndex = 0;
                        }
                        else
                        {
                            this.cmbMenuType.SetValue(menu.MenuType);
                        }
                        if (string.IsNullOrEmpty(menu.MenuUrlTarget))
                        {
                            this.cmbMenuUrlTarget.SelectedIndex = 0;
                        }
                        else
                        {
                            this.cmbMenuUrlTarget.SetValue(menu.MenuUrlTarget);
                        }
                    }
                    else
                    {
                        this.txtMenuUrl.Text                = "";
                        this.cmbMenuType.SelectedIndex      = 0;
                        this.cmbMenuUrlTarget.SelectedIndex = 0;
                    }

                    winSystemMenuEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "Error Message:Record not existed";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = string.Format(this.GetGlobalResourceObject("GlobalResource", "msgServerErrorMsg").ToString(), ex.Message);
                return;
            }
        }
        public void Show(int id)
        {
            try
            {
                SystemMenuWrapper menu = SystemMenuWrapper.FindById(id);

                if (menu != null)
                {
                    this.hidMenuID.Text          = menu.MenuID.ToString();
                    this.hidApplicationID.Text   = menu.ApplicationID.SystemApplicationID.ToString();
                    this.lblApplicationName.Text = menu.ApplicationID.SystemApplicationName;


                    if (menu.ParentMenuID == null)
                    {
                        this.lblParentMenuName.Text          = "作为主菜单";
                        this.fsMenuIsCategory.Disabled       = true;
                        this.fsMenuIsCategory.CheckboxToggle = false;
                    }
                    else
                    {
                        this.lblParentMenuName.Text =
                            menu.ParentMenuID.MenuName;
                        this.hidPMenuID.Text                 = menu.ParentMenuID.MenuID.ToString();
                        this.fsMenuIsCategory.Disabled       = false;
                        this.fsMenuIsCategory.CheckboxToggle = true;
                    }

                    this.txtMenuName.Text            = menu.MenuName;
                    this.txtMenuDescription.Text     = menu.MenuDescription;
                    this.chkMenuIsSystemMenu.Checked = (menu.MenuIsSystemMenu.HasValue ? menu.MenuIsSystemMenu.Value : false);
                    this.chkMenuIsEnable.Checked     = (menu.MenuIsEnable.HasValue ? menu.MenuIsSystemMenu.Value : false);

                    this.fsMenuIsCategory.Collapsed = menu.MenuIsCategory;


                    if (!menu.MenuIsCategory)
                    {
                        this.txtMenuIconUrl.Text = menu.MenuIconUrl;
                        this.txtMenuUrl.Text     = menu.MenuUrl;
                        if (string.IsNullOrEmpty(menu.MenuType))
                        {
                            this.cmbMenuType.SelectedIndex = 0;
                        }
                        else
                        {
                            this.cmbMenuType.SetValue(menu.MenuType);
                        }
                        if (string.IsNullOrEmpty(menu.MenuUrlTarget))
                        {
                            this.cmbMenuUrlTarget.SelectedIndex = 0;
                        }
                        else
                        {
                            this.cmbMenuUrlTarget.SetValue(menu.MenuUrlTarget);
                        }
                    }
                    else
                    {
                        this.txtMenuIconUrl.Text            = "";
                        this.txtMenuUrl.Text                = "";
                        this.cmbMenuType.SelectedIndex      = 0;
                        this.cmbMenuUrlTarget.SelectedIndex = 0;
                    }

                    winSystemMenuEdit.Show();
                }
                else
                {
                    ResourceManager.AjaxSuccess      = false;
                    ResourceManager.AjaxErrorMessage = "错误信息:数据不存在";
                    return;
                }
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }