示例#1
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);
        }