Esempio n. 1
0
        public ActionResult GetSysGroup()
        {
            try
            {
                if (HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"] != null)
                {
                    string strUserId = HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"].Value;
                    string LoginName = Request.Cookies["LoginName"].Value;
                    if (LoginName.ToUpper() == "ADMIN")
                    {
                        //IList<SysGroupVM> groupvmList = new List<SysGroupVM>();
                        //SysGroupVM groupvm = new SysGroupVM();
                        //groupvm.id = "A00100B";
                        //groupvm.text = "超级管理员";
                        //groupvm.iconCls = "icon-system";
                        //groupvmList.Add(groupvm);


                        //SysGroupVM groupvmItem = new SysGroupVM();
                        //groupvmItem.id = "A00100B0-01";
                        //groupvmItem.text = "区域管理";
                        //groupvmItem.iconCls = "icon-system";
                        //groupvmItem.pid = "A00100B";
                        //groupvmItem.url = "/SysFrame/RegionArea/Index";
                        //groupvmItem.iconPosition = "top";
                        //groupvmList.Add(groupvmItem);

                        //groupvm = new SysGroupVM();
                        //groupvm.id = "A00100B0-02";
                        //groupvm.text = "机构管理";
                        //groupvm.iconCls = "icon-system";
                        //groupvm.pid = "A00100B";
                        //groupvm.url = "/SysFrame/Organization/Index";
                        //groupvm.iconPosition = "top";
                        //groupvmList.Add(groupvm);
                        //return Json(groupvmList, JsonRequestBehavior.AllowGet);

                        string Condition = " and orgid='888'";
                        IList <SysGroupEntity> groupList = IgroupLogic.LoadAll(Condition, 1000, 1, "groupid");
                        if (groupList.Count > 0)
                        {
                            IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                            foreach (SysGroupEntity enty in groupList)
                            {
                                SysGroupVM groupvm = new SysGroupVM();
                                groupvm.id           = enty.GroupID;
                                groupvm.text         = enty.GroupName;
                                groupvm.iconCls      = enty.IconCls;
                                groupvm.pid          = enty.ParentID;
                                groupvm.url          = enty.URL;
                                groupvm.iconPosition = "top";
                                groupvmList.Add(groupvm);
                            }

                            return(Json(groupvmList, JsonRequestBehavior.AllowGet));
                        }
                    }
                    else
                    {
                        UserInfoEntity         usermodel = IUserLogic.Load(LoginName);
                        IList <SysGroupEntity> groupList;
                        if ((usermodel != null) && (usermodel.RoleType == "1"))
                        {
                            groupList = IgroupLogic.LoadAll(" and orgid = '100' ", 1000, 1, "GroupID");
                        }
                        else
                        {
                            groupList = IgroupLogic.LoadGroupListByUserId(strUserId);
                        }


                        if (groupList.Count > 0)
                        {
                            IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                            foreach (SysGroupEntity enty in groupList)
                            {
                                SysGroupVM groupvm = new SysGroupVM();
                                groupvm.id           = enty.GroupID;
                                groupvm.text         = enty.GroupName;
                                groupvm.iconCls      = enty.IconCls;
                                groupvm.pid          = enty.ParentID;
                                groupvm.url          = enty.URL;
                                groupvm.iconPosition = "top";
                                groupvmList.Add(groupvm);
                            }

                            return(Json(groupvmList, JsonRequestBehavior.AllowGet));
                        }
                    }
                }
                else
                {
                    return(RedirectToAction("Login", "Home"));
                }

                return(Json(""));
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Esempio n. 2
0
        public PartialViewResult Menu()
        {
            if (HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"] != null)
            {
                string                 strUserId = HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"].Value;
                UserInfoEntity         usermodel = IUserLogic.Load(strUserId);
                string                 Condition = "  and ( ParentID is null or ParentID='') ";
                IList <SysGroupEntity> groupList;
                if ((usermodel != null) && (usermodel.RoleType == "1"))
                {
                    groupList = IgroupLogic.LoadAll("  and ( ParentID is null or ParentID='') ", 1000, 1, "GroupID");
                    IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                    foreach (SysGroupEntity enty in groupList)
                    {
                        SysGroupVM groupvm = new SysGroupVM();
                        groupvm.id           = enty.GroupID;
                        groupvm.text         = enty.GroupName;
                        groupvm.iconCls      = enty.IconCls;
                        groupvm.pid          = enty.ParentID;
                        groupvm.url          = enty.URL;
                        groupvm.HisType      = enty.HisType;
                        groupvm.iconPosition = "top";

                        Condition = " and ParentID = '" + enty.GroupID + "'";
                        IList <SysGroupEntity> itemList = IgroupLogic.LoadAll(Condition, 1000, 1, "groupid");
                        groupvm.subList = new List <SysGroupEntity>();
                        groupvm.subList = itemList;
                        groupvmList.Add(groupvm);
                    }

                    return(PartialView(new MenuModel {
                        Menus = groupvmList
                    }));
                }
                else
                {
                    groupList = IgroupLogic.LoadGroupListByUserId(strUserId);
                    if (groupList.Count > 0)
                    {
                        List <SysGroupEntity> groupListMenuOne = new List <SysGroupEntity>();
                        if (groupList.Count > 0)
                        {
                            foreach (SysGroupEntity enty in groupList)
                            {
                                if (string.IsNullOrEmpty(enty.ParentID))
                                {
                                    groupListMenuOne.Add(enty);
                                }
                            }
                        }

                        if (groupListMenuOne.Count > 0)
                        {
                            IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                            foreach (SysGroupEntity enty in groupListMenuOne)
                            {
                                SysGroupVM groupvm = new SysGroupVM();
                                groupvm.id           = enty.GroupID;
                                groupvm.text         = enty.GroupName;
                                groupvm.iconCls      = enty.IconCls;
                                groupvm.pid          = enty.ParentID;
                                groupvm.url          = enty.URL;
                                groupvm.HisType      = enty.HisType;
                                groupvm.iconPosition = "top";

                                Condition = " and ParentID = '" + enty.GroupID + "'";
                                Condition = " and UserInfo.userid = '" + strUserId + "' and SysGroup.parentid = '" + enty.GroupID + "'";
                                IList <SysGroupEntity> itemList = IgroupLogic.LoadAllByParentIdAndUserId(Condition, 1000, 1, "groupid");
                                groupvm.subList = new List <SysGroupEntity>();
                                groupvm.subList = itemList;
                                groupvmList.Add(groupvm);
                            }

                            return(PartialView(new MenuModel {
                                Menus = groupvmList
                            }));
                        }
                    }
                }
                return(null);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        public PartialViewResult MenuHis()
        {
            if (HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"] != null)
            {
                string strUserId = HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"].Value;
                string strOrgId  = HttpContext.ApplicationInstance.Context.Request.Cookies["OrgId"].Value;
                string LoginName = Request.Cookies["LoginName"].Value;
                if (LoginName.ToUpper() == "ADMIN")
                {
                    #region  管理员
                    string Condition = " and orgid='888' and ( ParentID is null or ParentID='') ";
                    IList <SysGroupEntity> groupList = IgroupLogic.LoadAll(Condition, 1000, 1, "groupid");
                    if (groupList.Count > 0)
                    {
                        IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                        foreach (SysGroupEntity enty in groupList)
                        {
                            if (enty.HisType != "1")
                            {
                                continue;
                            }
                            SysGroupVM groupvm = new SysGroupVM();
                            groupvm.id           = enty.GroupID;
                            groupvm.text         = enty.GroupName;
                            groupvm.iconCls      = enty.IconCls;
                            groupvm.pid          = enty.ParentID;
                            groupvm.url          = enty.URL;
                            groupvm.HisType      = enty.HisType;
                            groupvm.iconPosition = "top";

                            Condition = " and ParentID = '" + enty.GroupID + "'";
                            IList <SysGroupEntity> itemList = IgroupLogic.LoadAll(Condition, 1000, 1, "groupid");
                            groupvm.subList = new List <SysGroupEntity>();
                            groupvm.subList = itemList;
                            groupvmList.Add(groupvm);
                        }

                        return(PartialView(new MenuModel {
                            Menus = groupvmList
                        }));
                    }
                    #endregion
                }
                else
                {
                    #region
                    UserInfoEntity         usermodel = IUserLogic.Load(LoginName);
                    IList <SysGroupEntity> groupList;
                    string Condition = " and orgid='" + strOrgId + "' and ( ParentID is null or ParentID='') ";
                    if ((usermodel != null) && (usermodel.RoleType == "1"))
                    {
                        groupList = IgroupLogic.LoadAll(" and orgid = '100' and ( ParentID is null or ParentID='') ", 1000, 1, "GroupID");
                    }
                    else
                    {
                        groupList = IgroupLogic.LoadGroupListByUserId(strUserId);
                    }
                    //groupList = IgroupLogic.LoadAll(Condition, 1000, 1, "GroupID");

                    if (groupList.Count > 0)
                    {
                        IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                        foreach (SysGroupEntity enty in groupList)
                        {
                            SysGroupVM groupvm = new SysGroupVM();
                            groupvm.id           = enty.GroupID;
                            groupvm.text         = enty.GroupName;
                            groupvm.iconCls      = enty.IconCls;
                            groupvm.pid          = enty.ParentID;
                            groupvm.url          = enty.URL;
                            groupvm.HisType      = enty.HisType;
                            groupvm.iconPosition = "top";

                            Condition = " and ParentID = '" + enty.GroupID + "'";
                            IList <SysGroupEntity> itemList = IgroupLogic.LoadAll(Condition, 1000, 1, "groupid");
                            groupvm.subList = new List <SysGroupEntity>();
                            groupvm.subList = itemList;
                            groupvmList.Add(groupvm);
                        }

                        return(PartialView(new MenuModel {
                            Menus = groupvmList
                        }));
                    }
                    #endregion
                }
            }
            return(null);
        }
Esempio n. 4
0
        public IList <SysGroupEntity> GetSysGroup()
        {
            try
            {
                if (HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"] != null)
                {
                    string strUserId = HttpContext.ApplicationInstance.Context.Request.Cookies["UserId"].Value;
                    string LoginName = Request.Cookies["LoginName"].Value;
                    if (LoginName.ToUpper() == "ADMIN")
                    {
                        string Condition = " and orgid='888'";
                        IList <SysGroupEntity> groupList = IgroupLogic.LoadAll(Condition, 1000, 1, "groupid");
                        if (groupList.Count > 0)
                        {
                            IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                            foreach (SysGroupEntity enty in groupList)
                            {
                                SysGroupVM groupvm = new SysGroupVM();
                                groupvm.id           = enty.GroupID;
                                groupvm.text         = enty.GroupName;
                                groupvm.iconCls      = enty.IconCls;
                                groupvm.pid          = enty.ParentID;
                                groupvm.url          = enty.URL;
                                groupvm.iconPosition = "top";
                                groupvmList.Add(groupvm);
                            }

                            return(groupList);
                        }
                    }
                    else
                    {
                        UserInfoEntity         usermodel = IUserLogic.Load(LoginName);
                        IList <SysGroupEntity> groupList;
                        if ((usermodel != null) && (usermodel.RoleType == "1"))
                        {
                            groupList = IgroupLogic.LoadAll(" and orgid = '100' ", 1000, 1, "GroupID");
                        }
                        else
                        {
                            groupList = IgroupLogic.LoadGroupListByUserId(strUserId);
                        }


                        if (groupList.Count > 0)
                        {
                            IList <SysGroupVM> groupvmList = new List <SysGroupVM>();
                            foreach (SysGroupEntity enty in groupList)
                            {
                                SysGroupVM groupvm = new SysGroupVM();
                                groupvm.id           = enty.GroupID;
                                groupvm.text         = enty.GroupName;
                                groupvm.iconCls      = enty.IconCls;
                                groupvm.pid          = enty.ParentID;
                                groupvm.url          = enty.URL;
                                groupvm.iconPosition = "top";
                                groupvmList.Add(groupvm);
                            }

                            return(groupList);
                        }
                    }
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }