Пример #1
0
        /// <summary>
        /// Date Created:   22/08/2011
        /// Created By:     Josephine Gad
        /// (description)   Show/Hide view link if there is existing submenu
        /// </summary>
        ///
        protected bool ViewIsVisible(object colPageIDInt)
        {
            bool   IsVisibleBool = true;
            string PageString    = colPageIDInt.ToString();

            PageString = (PageString == "" ? "0" : PageString);

            DataTable SubMenuDataTable = null;

            try
            {
                SubMenuDataTable = UserRightsBLL.GetSubMenuAll(PageString);
                if (SubMenuDataTable.Rows.Count > 0)
                {
                    IsVisibleBool = true;
                }
                else
                {
                    IsVisibleBool = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (SubMenuDataTable != null)
                {
                    SubMenuDataTable.Dispose();
                }
            }
            return(IsVisibleBool);
        }
Пример #2
0
        /// <summary>
        /// Date Created:   22/08/2011
        /// Created By:     Josephine Gad
        /// (description)   Get Submenu
        /// ===================================
        /// Date Modified:   21/May/2014
        /// Modified By:     Josephine Gad
        /// (description)    Add   sMenuDisplayName to show menu name and description
        /// </summary>
        private void GetSubmenu()
        {
            uoTreeViewSubmenu.Nodes.Clear();
            DataTable SubMenuDataTable = null;
            DataTable ChildDataTable   = null;
            string    sMenuDisplayName;

            try
            {
                SubMenuDataTable = UserRightsBLL.GetSubMenuAll(Request.QueryString["mId"]);
                if (SubMenuDataTable.Rows.Count > 0)
                {
                    uoButtonSave.Visible = true;
                    uoDivMsg.Visible     = false;
                    //uoTreeViewSubmenu.DataSource = SubMenuDataTable;
                    //                   TreeNode NewNode = new TreeNode(

                    bool IsExistsBool = false;
                    foreach (DataRow SubMenuRow in SubMenuDataTable.Rows)
                    {
                        sMenuDisplayName = SubMenuRow["colDisplayNameVarchar"].ToString() + " - " + SubMenuRow["colDescriptionVarchar"].ToString();
                        TreeNode NewNode = new TreeNode(sMenuDisplayName, SubMenuRow["colPageIDInt"].ToString());
                        NewNode.ShowCheckBox = true;
                        IsExistsBool         = UserRightsBLL.IsMenuExists(GlobalCode.Field2String(Session["SelectedRoleKey"]), SubMenuRow["colPageIDInt"].ToString());
                        NewNode.Checked      = IsExistsBool;

                        ChildDataTable = UserRightsBLL.GetSubMenuAll(SubMenuRow["colPageIDInt"].ToString());
                        foreach (DataRow ChildRow in ChildDataTable.Rows)
                        {
                            sMenuDisplayName = ChildRow["colDisplayNameVarchar"].ToString() + " - " + ChildRow["colDescriptionVarchar"].ToString();
                            TreeNode ChileNode = new TreeNode(sMenuDisplayName, ChildRow["colPageIDInt"].ToString());
                            ChileNode.ShowCheckBox = true;
                            IsExistsBool           = UserRightsBLL.IsMenuExists(GlobalCode.Field2String(Session["SelectedRoleKey"]), ChildRow["colPageIDInt"].ToString());
                            ChileNode.Checked      = IsExistsBool;

                            NewNode.ChildNodes.Add(ChileNode);
                        }
                        uoTreeViewSubmenu.Nodes.Add(NewNode);
                        uoTreeViewSubmenu.NodeStyle.CssClass = "BlackText";
                    }
                }
                else
                {
                    uoButtonSave.Visible = false;
                    uoDivMsg.Visible     = true;
                }
                //uoGridViewSubMenu.DataSource = SubMenuDataTable;
                //uoGridViewSubMenu.Columns[0].Visible = true;
                //uoGridViewSubMenu.DataBind();
                //uoGridViewSubMenu.Columns[0].Visible = false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (SubMenuDataTable != null)
                {
                    SubMenuDataTable.Dispose();
                }
                if (ChildDataTable != null)
                {
                    ChildDataTable.Dispose();
                }
            }
        }