Example #1
0
    //生成菜单
    public string MakeContextMenu()
    {
        string             sRet   = "";
        List <CBaseObject> lstObj = m_UserMenuMgr.GetList();

        for (int i = 0; i < lstObj.Count; i++)
        {
            CUserMenu UserMenu = (CUserMenu)lstObj[i];
            CMenu     menu     = (CMenu)Global.GetCtx(Session["TopCompany"].ToString()).MenuMgr.Find(UserMenu.UI_Menu_id);
            if (menu == null || menu.MType != enumMenuType.CatalogMenu)
            {
                continue;
            }
            LoadMenu(ref sRet, menu);
        }
        return(sRet);
    }
Example #2
0
    void GetData()
    {
        List <CBaseObject> lstRet = new List <CBaseObject>();

        //用户菜单
        List <CBaseObject> lstObj = m_UserMenuMgr.GetList();

        for (int i = 0; i < lstObj.Count; i++)
        {
            CUserMenu UserMenu = (CUserMenu)lstObj[i];
            if (UserMenu.UI_DesktopGroup_id != m_guidCurGroupId)
            {
                continue;
            }

            lstRet.Add(UserMenu);
        }
        //角色菜单
        List <CBaseObject> lstObjR = m_Company.RoleMgr.GetList();

        foreach (CBaseObject objR in lstObjR)
        {
            CRole Role = (CRole)objR;
            if (!((CUser)Session["User"]).IsRole(Role.Name))
            {
                continue;
            }
            List <CBaseObject> lstObjRM = Role.RoleMenuMgr.GetList();
            foreach (CBaseObject objRM in lstObjRM)
            {
                CRoleMenu RoleMenu = (CRoleMenu)objRM;
                if (RoleMenu.UI_DesktopGroup_id != m_guidCurGroupId)
                {
                    continue;
                }

                lstRet.Add(RoleMenu);
            }
        }
        //桌面应用
        lstObj = m_DesktopAppMgr.GetList();
        for (int i = 0; i < lstObj.Count; i++)
        {
            CDesktopApp App = (CDesktopApp)lstObj[i];
            if (App.UI_DesktopGroup_id != m_guidCurGroupId)
            {
                continue;
            }

            lstRet.Add(App);
        }

        var varObj = from obj in lstRet
                     orderby obj.m_arrNewVal["idx"].IntVal
                     select obj;
        List <CBaseObject> lstObj1 = varObj.ToList();



        // List<CBaseObject> lstObj = m_View.ColumnInViewMgr.GetList();
        //List<CColumnInView> sortObj = new List<CColumnInView>();
        //foreach (CBaseObject obj in lstObj)
        //{
        //    CColumnInView civ = (CColumnInView)obj;
        //    sortObj.Add(civ);
        //}
        //sortObj.Sort();

        string sData = "";

        int iCount = 0;

        foreach (CBaseObject civ in lstObj1)
        {
            //CColumn col = (CColumn)m_Table.ColumnMgr.Find(civ.FW_Column_id);
            //if (col == null)
            //    continue;
            if (typeof(CUserMenu) == civ.GetType())
            {
                CUserMenu UserMenu = (CUserMenu)civ;
                CMenu     menu     = (CMenu)Global.GetCtx(Session["TopCompany"].ToString()).MenuMgr.Find(UserMenu.UI_Menu_id);
                sData += string.Format("{{ \"id\": \"{0}\",\"ColName\":\"{1}\"}},", menu.Id, menu.Name);

                iCount++;
            }
            else if (typeof(CRoleMenu) == civ.GetType())
            {
                CRoleMenu RoleMenu = (CRoleMenu)civ;
                CMenu     menu     = (CMenu)Global.GetCtx(Session["TopCompany"].ToString()).MenuMgr.Find(RoleMenu.UI_Menu_id);

                sData += string.Format("{{ \"id\": \"{0}\",\"ColName\":\"{1}\"}},", menu.Id, menu.Name);

                iCount++;
            }
            else if (typeof(CDesktopApp) == civ.GetType())
            {
                CDesktopApp App = (CDesktopApp)civ;
                sData += string.Format("{{ \"id\": \"{0}\",\"ColName\":\"{1}\"}},", App.Id, App.Name);
                iCount++;
            }
        }
        sData = sData.TrimEnd(",".ToCharArray());
        sData = "[" + sData + "]";
        string sJson = string.Format("{{\"Rows\":{0},\"Total\":\"{1}\"}}"
                                     , sData, iCount);

        Response.Write(sJson);
    }