示例#1
0
        public ActionResult ModuleTreeJson(string roleId)
        {
            var existModule = permissionBLL.GetModuleList(roleId);
            var data        = authorizeBLL.GetModuleList(SystemInfo.CurrentUserId);
            var treeList    = new List <TreeEntity>();

            foreach (ModuleEntity item in data)
            {
                TreeEntity tree        = new TreeEntity();
                bool       hasChildren = data.Count(t => t.ParentId == item.ModuleId) == 0 ? false : true;
                tree.id          = item.ModuleId;
                tree.text        = item.FullName;
                tree.value       = item.ModuleId;
                tree.title       = "";
                tree.checkstate  = existModule.Count(t => t.ItemId == item.ModuleId);
                tree.showcheck   = true;
                tree.isexpand    = true;
                tree.complete    = true;
                tree.hasChildren = hasChildren;
                tree.parentId    = item.ParentId;
                tree.img         = item.Icon;
                treeList.Add(tree);
            }
            return(Content(treeList.TreeToJson()));
        }
        public ActionResult ModuleTreeJson(string userId)
        {
            var existModule = permissionBLL.GetModuleList(userId);
            //var data = moduleBLL.GetList();
            //var treeList = new List<TreeEntity>();
            //foreach (ModuleEntity item in data)
            //{
            //    TreeEntity tree = new TreeEntity();
            //    bool hasChildren = data.Count(t => t.ParentId == item.ModuleId) == 0 ? false : true;
            //    tree.id = item.ModuleId;
            //    tree.text = item.FullName;
            //    tree.value = item.ModuleId;
            //    tree.title = "";
            //    tree.checkstate = existModule.Count(t => t.ItemId == item.ModuleId);
            //    tree.showcheck = true;
            //    tree.isexpand = true;
            //    tree.complete = true;
            //    tree.hasChildren = hasChildren;
            //    tree.parentId = item.ParentId;
            //    tree.img = item.Icon;
            //    treeList.Add(tree);
            //}
            //return Content(treeList.TreeToJson());
            //判断当前登陆人是否管理员,如果不是管理员找到对应账户创建者权限,在此基础上再次设置权限
            var treeList    = new List <TreeEntity>();
            var data        = new List <ModuleEntity>();
            var currentuser = userBLL.GetEntity(SystemInfo.CurrentUserId);

            if (currentuser != null)
            {
                var currentlogin = OperatorProvider.Provider.Current();
                if (currentlogin.Account == Util.Config.GetValue("SysAccount"))
                {
                    data = authorizeBLL.GetModuleList(currentlogin.UserId).ToList();
                }
                else
                {
                    data = authorizeBLL.GetModuleList(currentuser.UserId).ToList();
                }
                foreach (ModuleEntity item in data)
                {
                    TreeEntity tree        = new TreeEntity();
                    bool       hasChildren = data.Count(t => t.ParentId == item.ModuleId) == 0 ? false : true;
                    tree.id          = item.ModuleId;
                    tree.text        = item.FullName;
                    tree.value       = item.ModuleId;
                    tree.title       = "";
                    tree.checkstate  = existModule.Count(t => t.ItemId == item.ModuleId);
                    tree.showcheck   = true;
                    tree.isexpand    = true;
                    tree.complete    = true;
                    tree.hasChildren = hasChildren;
                    tree.parentId    = item.ParentId;
                    tree.img         = item.Icon;
                    treeList.Add(tree);
                }
            }
            return(Content(treeList.TreeToJson()));
        }
        private object GetMenuData()
        {
            var data = authorizeBLL.GetModuleList(SystemInfo.CurrentUserId);
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            foreach (ModuleEntity item in data)
            {
                var fieldItem = new
                {
                    EnCode   = item.EnCode,
                    FullName = item.FullName
                };
                dictionary.Add(item.ModuleId, fieldItem);
            }
            return(dictionary);
        }
示例#4
0
 /// <summary>
 /// 获取功能数据
 /// </summary>
 /// <returns></returns>
 private object GetModuleData()
 {
     return(authorizeBLL.GetModuleList(SystemInfo.CurrentUserId));
 }
示例#5
0
        /// <summary>
        /// 获取功能数据
        /// </summary>
        /// <returns></returns>
        private object GetModuleData()
        {
            var bzweb      = string.Empty;
            var appSetting = ConfigurationManager.AppSettings["bzweb"];

            if (appSetting != null)
            {
                bzweb = appSetting.ToString();
            }

            var user = ERCHTMS.Code.OperatorProvider.Provider.Current();
            List <ModuleEntity> list      = new List <ModuleEntity>();
            DataTable           dtModules = new DepartmentBLL().GetDataTable(string.Format("select moduleid from BASE_APPSETTINGASSOCIATION t where t.deptid='{0}' and PALTFORMTYPE=3", user.OrganizeId));

            if (dtModules.Rows.Count > 0)
            {
                string[] mIds = dtModules.AsEnumerable().Select(d => d.Field <string>("moduleid")).ToArray();
                list = moduleBLL.GetListBySql(string.Format("select * from base_module t where moduleid in('{0}') order by sortcode asc", string.Join(",", mIds).Replace(",", "','"))).ToList();
            }
            else
            {
                list = authorizeBLL.GetModuleList(SystemInfo.CurrentUserId).ToList();
            }
            var              di  = new ERCHTMS.Busines.SystemManage.DataItemDetailBLL();
            string           val = new DataItemDetailBLL().GetItemValue("TrainSyncWay"); //对接方式,0:账号,1:身份证,不配置默认为账号
            string           way = new DataItemDetailBLL().GetItemValue("WhatWay");      //对接平台 0:.net培训平台 1:java培训平台
            DepartmentEntity org = new DepartmentBLL().GetEntity(user.OrganizeId);

            foreach (ModuleEntity entity in list)
            {
                if (!string.IsNullOrEmpty(entity.UrlAddress))
                {
                    if (!string.IsNullOrEmpty(bzweb))
                    {
                        entity.UrlAddress = entity.UrlAddress.Replace("{bzweb}", bzweb);
                    }
                    if (entity.EnCode == "SafetyTrain")
                    {
                        string url = di.GetItemValue("TrainWebUrl");
                        if (!string.IsNullOrEmpty(url))
                        {
                            if (way == "1")
                            {
                                UserEntity ue      = new UserBLL().GetEntity(user.UserId);
                                string     account = string.IsNullOrWhiteSpace(ue.NewAccount) ? user.Account : ue.NewAccount;
                                entity.UrlAddress = url + "?account=" + account + "&psw=" + Md5Helper.MD5(account, 32).ToLower() + "&companyId=" + org.InnerPhone;
                            }
                            else
                            {
                                if (string.IsNullOrWhiteSpace(user.IdentifyID))
                                {
                                    entity.UrlAddress = url + "?tokenId=" + BSFramework.Util.DESEncrypt.EncryptString(user.Account);
                                }
                                else
                                {
                                    if (!string.IsNullOrWhiteSpace(val))
                                    {
                                        if (val == "0")
                                        {
                                            entity.UrlAddress = url + "?tokenId=" + BSFramework.Util.DESEncrypt.EncryptString(user.Account);
                                        }
                                        else
                                        {
                                            entity.UrlAddress = url + "?tokenId=" + BSFramework.Util.DESEncrypt.EncryptString(user.IdentifyID);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        string bzUrl = di.GetItemValue("bzWebUrl");
                        if (!string.IsNullOrWhiteSpace(bzUrl))
                        {
                            if (entity.UrlAddress.ToLower().StartsWith("http://") && entity.UrlAddress.ToLower().Contains(bzUrl.ToLower()))
                            {
                                string args = args = BSFramework.Util.DESEncrypt.Encrypt(string.Concat(user.Account, "^" + entity.UrlAddress + "^", System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "^DLBZ"));
                                entity.UrlAddress = bzUrl + "login/signin?args=" + args;
                            }
                        }

                        if (entity.EnCode == "TaskSchedulerManager")
                        {
                            entity.UrlAddress += "?args=" + BSFramework.Util.DESEncrypt.Encrypt("admin|1", "!2#3@1YV");
                        }
                    }
                }
            }
            return(list);
        }