Exemplo n.º 1
0
        protected void FillGrid()
        {
            var dt = new DataTable();

            dt = BL_ChildMenu.GetChildMenu(2, Convert.ToInt32((string)ddlMainMenu.SelectedValue), ddlRoleName.SelectedValue);
            if (dt.Rows.Count > 0)
            {
                gvAllMenu.DataSource = dt;
                gvAllMenu.DataBind();
            }
            else
            {
                gvAllMenu.DataSource = new string[] { };
                gvAllMenu.DataBind();
            }
            dt = BL_MenuAssign.GetMenuAssign(1, Convert.ToInt32((string)ddlMainMenu.SelectedValue), 0, ddlRoleName.SelectedValue);
            if (dt.Rows.Count > 0)
            {
                gvAssignedMenu.DataSource = dt;
                gvAssignedMenu.DataBind();
            }
            else
            {
                gvAssignedMenu.DataSource = dt;
                gvAssignedMenu.DataBind();
            }
        }
Exemplo n.º 2
0
        private string FillMenu()
        {
            var menu = BK_Session.GetSession().MenuList;

            if (menu != null)
            {
                return(menu);
            }

            var dt        = BL_MenuAssign.GetMenuAssign(3, Convert.ToInt32(BK_Session.GetSession().RoleId), 0, "");
            var mainMenus = BK_Session.GetSession().Menus;
            var count     = mainMenus.Count;
            var strMenu   = new StringBuilder();

            if (count > 0)
            {
                strMenu.Append("<ul class=\"nav nav-pills nav-stacked\">");
                foreach (var item in mainMenus.Keys)
                {
                    var mm = mainMenus[item];
                    strMenu.Append("<li class=\"parent\">");
                    switch (mm.MenuName)
                    {
                    case "Import From Excel":
                        strMenu.Append("<a href=" + "#" + "><i class=\"fa fa-home\" ></i><span>" + mm.MenuName + "</span></a>");
                        break;

                    case "Reports":
                        strMenu.Append("<a href=" + "#" + "><i class=\"fa fa-file-text\" ></i><span>" + mm.MenuName + "</span></a>");
                        break;

                    case "Settings":
                        strMenu.Append("<a href=" + "#" + "><i class=\"fa fa-gears\" ></i><span>" + mm.MenuName + "</span></a>");
                        break;

                    case "correction":
                        strMenu.Append("<a href=" + "#" + "><i class=\"fa fa-suitcase\" ></i><span>" + mm.MenuName + "</span></a>");
                        break;

                    default:
                        strMenu.Append("<a href=" + "#" + "><i class=\"fa fa-suitcase\" ></i><span>" + mm.MenuName + "</span></a>");
                        break;
                    }

                    strMenu.Append(GetChildMenu(mm));
                    strMenu.Append("</li>");
                }
                strMenu.Append("</ul>");
            }
            BK_Session.GetSession().MenuList = strMenu.ToString();
            return(strMenu.ToString());
        }
Exemplo n.º 3
0
        private Dictionary <int, MainMenu> PrepareMenu(int roleId)
        {
            var dt        = BL_MenuAssign.GetMenuAssign(3, Convert.ToInt32(roleId), 0, "");
            var mainMenus = new Dictionary <int, MainMenu>();
            var count     = dt.Rows.Count;

            if (count > 0)
            {
                for (var i = 0; i < dt.Rows.Count; i++)
                {
                    var m = new MainMenu(int.Parse(dt.Rows[i]["MainMenuID"].ToString()), dt.Rows[i]["MainMenuName"].ToString());
                    this.PrepareChildMenu(ref m, roleId);
                    mainMenus.Add(int.Parse(dt.Rows[i]["MainMenuID"].ToString()), m);
                }
            }
            return(mainMenus);
        }
Exemplo n.º 4
0
 private void PrepareChildMenu(ref MainMenu mainMenu, int roleId)
 {
     try
     {
         var dt = BL_MenuAssign.GetMenuAssign(2, Convert.ToInt32(roleId), Convert.ToInt32(mainMenu.MainMenuID), "");
         if (dt.Rows.Count > 0)
         {
             for (var i = 0; i < dt.Rows.Count; i++)
             {
                 mainMenu.AddSubMenu(new ChildMenu(int.Parse(dt.Rows[i]["ChildMenuID"].ToString()), mainMenu.MainMenuID, dt.Rows[i]["ChildMenuName"].ToString(), dt.Rows[i]["NavigationURL"].ToString()));
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
     }
 }