Example #1
0
    //排序菜单
    public List <CBaseObject> GetOrderMenu()
    {
        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;

        return(varObj.ToList());
    }
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);
    }
Example #3
0
    void PostData()
    {
        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();

        string GridData = Request["GridData"];

        if (string.IsNullOrEmpty(GridData))
        {
            Response.Write("字段不能空!");
            return;
        }

        string[] arr1 = GridData.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < arr1.Length; i++)
        {
            string[] arr2 = arr1[i].Split(":".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            //CMenu menu = (CMenu)m_UserMenuMgr.Find(new Guid(arr2[0]));

            foreach (CBaseObject civ in lstObj1)
            {
                if (typeof(CUserMenu) == civ.GetType())
                {
                    CUserMenu UserMenu = (CUserMenu)civ;
                    if (UserMenu.UI_Menu_id == new Guid(arr2[0]))
                    {
                        UserMenu.Idx = i + 1;
                        m_UserMenuMgr.Update(UserMenu);
                        if (m_UserMenuMgr.Save(true))
                        {
                        }
                    }
                }
                else if (typeof(CRoleMenu) == civ.GetType())
                {
                    CRoleMenu RoleMenu = (CRoleMenu)civ;
                    if (RoleMenu.UI_Menu_id == new Guid(arr2[0]))
                    {
                        RoleMenu.Idx = i + 1;
                        RoleMenu.m_ObjectMgr.Update(RoleMenu);
                        if (RoleMenu.m_ObjectMgr.Save(true))
                        {
                        }
                    }
                }
                else if (typeof(CDesktopApp) == civ.GetType())
                {
                    CDesktopApp App = (CDesktopApp)civ;
                    if (App.Id == new Guid(arr2[0]))
                    {
                        App.Idx = i + 1;
                        m_DesktopAppMgr.Update(App);
                        if (m_DesktopAppMgr.Save(true))
                        {
                        }
                    }
                }
            }

            // CUserMenu menu = (CUserMenu).GetCtx(Session["TopCompany"].ToString()).UserMenuMgr.Find(new Guid(arr2[0]));
            //// CMenu menu = (CMenu)Global.GetCtx(Session["TopCompany"].ToString()).MenuMgr.Find(new Guid(arr2[0]));
            // //CColumnInView civ = (CColumnInView)m_View.ColumnInViewMgr.Find(new Guid(arr2[0]));
            // //civ.Caption = arr2[1];
            // menu.Idx = i;
            // (CUserMenu).GetCtx(Session["TopCompany"].ToString()).UserMenuMgr.Update(menu);
            // m_View.ColumnInViewMgr.Update(menu);
        }
    }
Example #4
0
    void PostData()
    {
        string UType       = Request["UType"];
        string Uid         = Request["Uid"];
        string GroupId     = Request["GroupId"];
        Guid   guidGroupId = Guid.Empty;

        if (!string.IsNullOrEmpty(GroupId))
        {
            guidGroupId = new Guid(GroupId);
        }
        string postData = Request["postData"];
        CUser  user     = null;
        CRole  role     = null;

        if (UType == "0") //用户
        {
            user = (CUser)Global.GetCtx(Session["TopCompany"].ToString()).UserMgr.Find(new Guid(Uid));

            user.UserMenuMgr.RemoveByDesktopGroupId(guidGroupId);
            string[] arr1 = postData.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            foreach (string sItem1 in arr1)
            {
                Guid      menuid   = new Guid(sItem1);
                CUserMenu UserMenu = new CUserMenu();
                UserMenu.B_User_id          = user.Id;
                UserMenu.UI_Menu_id         = menuid;
                UserMenu.UI_DesktopGroup_id = guidGroupId;

                CUser user0 = (CUser)Session["User"];
                UserMenu.Creator = user0.Id;
                user.UserMenuMgr.AddNew(UserMenu);
            }
            if (!user.UserMenuMgr.Save(true))
            {
                Response.Write("保存失败!");
            }
        }
        else if (UType == "1") //角色
        {
            role = (CRole)m_Company.RoleMgr.Find(new Guid(Uid));

            role.RoleMenuMgr.RemoveByDesktopGroupId(guidGroupId);
            string[] arr1 = postData.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            foreach (string sItem1 in arr1)
            {
                Guid      menuid   = new Guid(sItem1);
                CRoleMenu RoleMenu = new CRoleMenu();
                RoleMenu.B_Role_id          = role.Id;
                RoleMenu.UI_Menu_id         = menuid;
                RoleMenu.UI_DesktopGroup_id = guidGroupId;

                CUser user0 = (CUser)Session["User"];
                RoleMenu.Creator = user0.Id;
                role.RoleMenuMgr.AddNew(RoleMenu);
            }
            if (!role.RoleMenuMgr.Save(true))
            {
                Response.Write("保存失败!");
            }
        }
    }
Example #5
0
        void LoadList()
        {
            if (string.IsNullOrEmpty(Program.User.Name))
            {
                return;
            }

            this.flowLayoutPanel.Controls.Clear();

            if (Program.User.IsRole("管理员") && m_guidDesktopGroupId == Guid.Empty)
            {
                DesktopItem adminBox = new DesktopItem();
                adminBox.Title      = "系统管理";
                adminBox.Icon       = "admin.png";
                adminBox.ItemType   = enumDesktopItemType.Admin;
                adminBox.ClickItem += new ClickEventHandler(adminBox_ClickItem);
                this.flowLayoutPanel.Controls.Add(adminBox);
            }
            //用户菜单
            List <CBaseObject> lstObj = Program.User.UserMenuMgr.GetList();

            foreach (CBaseObject obj in lstObj)
            {
                CUserMenu UserMenu = (CUserMenu)obj;
                if (UserMenu.UI_DesktopGroup_id != m_guidDesktopGroupId)
                {
                    continue;
                }
                CMenu menu = (CMenu)Program.Ctx.MenuMgr.Find(UserMenu.UI_Menu_id);
                if (menu == null)
                {
                    continue;
                }

                DesktopItem Item = new DesktopItem();
                Item.Title        = menu.Name;
                Item.Icon         = menu.IconUrl;
                Item.ItemType     = (enumDesktopItemType)Convert.ToInt32(menu.MType);
                Item.m_BaseObject = menu;
                Item.ClickItem   += new ClickEventHandler(menu_ClickItem);
                this.flowLayoutPanel.Controls.Add(Item);
            }
            //角色菜单
            CCompany Company = (CCompany)Program.Ctx.CompanyMgr.Find(Program.User.B_Company_id);

            if (Company != null)
            {
                List <CBaseObject> lstObjR = Company.RoleMgr.GetList();
                foreach (CBaseObject objR in lstObjR)
                {
                    CRole Role = (CRole)objR;
                    if (!Program.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_guidDesktopGroupId)
                        {
                            continue;
                        }
                        CMenu menu = (CMenu)Program.Ctx.MenuMgr.Find(RoleMenu.UI_Menu_id);
                        if (menu == null)
                        {
                            continue;
                        }

                        DesktopItem Item = new DesktopItem();
                        Item.Title        = menu.Name;
                        Item.Icon         = menu.IconUrl;
                        Item.ItemType     = (enumDesktopItemType)Convert.ToInt32(menu.MType);
                        Item.m_BaseObject = menu;
                        Item.ClickItem   += new ClickEventHandler(menu_ClickItem);
                        this.flowLayoutPanel.Controls.Add(Item);
                    }
                }
            }
            //应用
            lstObj = Program.User.DesktopAppMgr.GetList();
            foreach (CBaseObject obj in lstObj)
            {
                CDesktopApp App = (CDesktopApp)obj;
                if (App.UI_DesktopGroup_id != m_guidDesktopGroupId)
                {
                    continue;
                }

                DesktopItem Item = new DesktopItem();
                Item.Title        = App.Name;
                Item.Icon         = App.IconUrl;
                Item.ItemType     = enumDesktopItemType.DesktopApp;
                Item.m_BaseObject = App;
                Item.ClickItem   += new ClickEventHandler(App_ClickItem);
                Item.ClickClose  += new ClickEventHandler(App_ClickClose);
                this.flowLayoutPanel.Controls.Add(Item);
            }
            //添加
            DesktopItem addBox = new DesktopItem();

            addBox.Title      = "添加应用";
            addBox.Icon       = "add.png";
            addBox.ItemType   = enumDesktopItemType.AddDesktopApp;
            addBox.ClickItem += new ClickEventHandler(addBox_ClickItem);
            this.flowLayoutPanel.Controls.Add(addBox);
        }