Пример #1
0
        private void OnStart()
        {
            if (FrameWorkMenuTree.GetModuleLevel(ModuleID) >= 3)
            {
                MessageLit.Text = "<font color=red>以下模块超过3层,只有当菜单样式为\"多级菜单\"才能正常显示出来!</font>";
            }

            if (CMD == string.Empty)
            {
                //TabOptionWebControls1.SelectIndex = 1;
                TabOptionItem3.Visible = true;
            }

            //填充数据
            sys_ModuleTable SMT = new sys_ModuleTable();

            SMT = BusinessFacade.sys_ModuleDisp(ModuleID);
            this.M_ApplicationID_Txt.Text = S_ID_Name;
            if (ModuleID == 0)
            {
                this.M_PageCode.Text = SMT.M_PageCode;
            }
            if (CMD == "New" && ModuleID != 0)
            {
                this.M_ParentID_Txt.Text = SMT.M_CName + "(" + SMT.M_PageCode + ")";
            }
            else
            {
                this.M_ParentID_Txt.Text = SMT.M_ParentID == 0 ? "无" : BusinessFacade.sys_ModuleDisp(SMT.M_ParentID).M_CName;
            }
            this.M_PageCode_Txt.Text  = SMT.M_PageCode;
            this.M_CName_Txt.Text     = SMT.M_CName;
            this.M_Directory_Txt.Text = SMT.M_Directory;
            this.M_IsSystem_Txt.Text  = SMT.M_IsSystem == 0 ? "否" : "是";
            this.M_Close_Txt.Text     = SMT.M_Close == 0 ? "否" : "是";
            this.M_Icon_Txt.Text      = SMT.M_Icon;

            if (CMD == "Edit")
            {
                this.M_PageCode.Text  = SMT.M_PageCode;
                this.M_CName.Text     = SMT.M_CName;
                this.M_Directory.Text = SMT.M_Directory;
                this.M_Icon.Text      = SMT.M_Icon;
                ListItem ditem1 = this.M_IsSystem.Items.FindByValue(SMT.M_IsSystem.ToString());
                if (ditem1 != null)
                {
                    ditem1.Selected = true;
                }
                ListItem ditem2 = this.M_Close.Items.FindByValue(SMT.M_Close.ToString());
                if (ditem2 != null)
                {
                    ditem2.Selected = true;
                }
            }

            //绑定子模块
            QueryParam qp = new QueryParam();

            qp.Orderfld  = " M_Applicationid,M_OrderLevel ";
            qp.OrderType = 0;
            qp.Where     = string.Format("Where M_ParentID={0} and M_Applicationid={1}", ModuleID, S_ID);
            int       RecordCount = 0;
            ArrayList lst         = BusinessFacade.sys_ModuleList(qp, out RecordCount);

            GridView1.DataSource = lst;
            GridView1.DataBind();

            //绑定排序
            OrderByListItems.DataSource     = lst;
            OrderByListItems.DataTextField  = "M_CName";
            OrderByListItems.DataValueField = "ModuleID";
            OrderByListItems.DataBind();
            if (lst.Count > 0)
            {
                OrderByListItems.Rows = lst.Count;
            }

            //判断是否隐藏数据
            if (CMD == "New" || CMD == "Edit")
            {
                HiddenDisp();
            }
            else
            {
                HiddenInput();
                SubmitTr.Visible = false;
            }



            //if (ModuleID !=0 && SMT.M_OrderLevel.Substring(2, 2) != "00")
            //{
            //    TabOptionWebControls1.SelectIndex = 0;
            //    TabOptionItem2.Visible = false;
            //    TabOptionItem3.Visible = false;

            //    if (CMD!="New" && CMD!="Edit")
            //        TabOptionItem4.Visible = true;

            //    BindPermissionList();
            //    if (CMD == "Edit")
            //    {
            //        HeadMenuButtonItem m5 = new HeadMenuButtonItem();
            //        m5.ButtonIcon = "back.gif";
            //        m5.ButtonName = "返回";
            //        m5.ButtonPopedom = PopedomType.List;
            //        m5.ButtonUrl = string.Format("?ModuleID={0}&S_ID={1}", ModuleID, S_ID);
            //        HeadMenuWebControls1.ButtonList.Add(m5);
            //    }
            //}



            //生成修改按钮
            if (ModuleID != 0 && CMD == "")
            {
                HeadMenuButtonItem m3 = new HeadMenuButtonItem();
                m3.ButtonName    = "模块";
                m3.ButtonPopedom = PopedomType.Edit;
                m3.ButtonUrl     = string.Format("?CMD=Edit&ModuleID={0}&S_ID={1}", ModuleID, S_ID);
                HeadMenuWebControls1.ButtonList.Add(m3);


                //if (FrameWorkMenuTree.CheckModuleLastLevel(ModuleID))
                if (BusinessFacade.GetSuBCount(ModuleID) == 0)
                {
                    HeadMenuButtonItem m6 = new HeadMenuButtonItem();
                    m6.ButtonName    = "设定模块扩展权限";
                    m6.ButtonIcon    = "b.gif";
                    m6.ButtonPopedom = PopedomType.Edit;
                    m6.ButtonUrl     = string.Format("?CMD=ExtPermission&ModuleID={0}&S_ID={1}", ModuleID, S_ID);
                    HeadMenuWebControls1.ButtonList.Add(m6);
                }
            }

            //生成删除按钮
            if (CMD == "Edit")
            {
                HeadMenuButtonItem m4 = new HeadMenuButtonItem();
                m4.ButtonPopedom = PopedomType.Delete;
                m4.ButtonUrl     = string.Format("DelData('?CMD=Delete&S_ID={0}&ModuleID={1}')", S_ID, ModuleID);
                m4.ButtonUrlType = UrlType.JavaScript;
                HeadMenuWebControls1.ButtonList.Add(m4);
            }

            //判断是否执行删除
            if (CMD == "Delete")
            {
                SMT.DB_Option_Action_ = "Delete";
                if (SMT.M_IsSystem != 1)
                {
                    BusinessFacade.DeleteModule(ModuleID);
                }
                sys_Module_Cache.ReLoadCache(); //重新加载模块缓存
                EventMessage.MessageBox(1, "操作成功", "删除记录ID:(" + ModuleID + ")成功!", Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("ModuleList.aspx?S_ID={0}&AppName={1}", S_ID, S_ID_Name)));
            }

            //Button1.Attributes.Add("Onclick", "javascript:return checkForm(aspnetForm);");



            if (CMD == "ExtPermission")
            {
                TabOptionItem2.Visible            = false;
                TabOptionItem4.Visible            = true;
                TabOptionWebControls1.SelectIndex = 3;
                BindPermissionList();
            }
        }