Exemple #1
0
        /// <summary>
        /// 取出投資風險等級與等級明細
        /// </summary>
        /// <param name="riskEvaId">風險評估項目代號</param>
        /// <returns>投資風險等級資料</returns>
        private IEnumerable <RiskRankEntity> GetRiskRankEntities(string riskEvaId)
        {
            IEnumerable <RiskRankEntity> riskRankEntities = CacheProvider.GetCache(_cacheKeyRiskRankEntities)
                                                            as IEnumerable <RiskRankEntity>;

            if ((riskRankEntities == null) ||
                (riskRankEntities.Count() == 0))
            {
                IEnumerable <RiskRankDO> riskRankList = new RiskRankDAO().ReadAll(riskEvaId);

                IEnumerable <RiskRankDetailDO> riskRankDetailList = new RiskRankDetailDAO().ReadAll();

                riskRankEntities = riskRankList.OrderBy(x => x.MinScore).
                                   Select(riskRank => new RiskRankEntity()
                {
                    RiskEvaId    = riskRank.RiskEvaId,
                    MinScore     = riskRank.MinScore,
                    MaxScore     = riskRank.MaxScore,
                    RiskRankKind = riskRank.RiskRankKind,

                    RiskRankDetailEntities = ConvertRiskRankDetailDO(riskRankDetailList.
                                                                     Where(riskRankDetail => riskRankDetail.RiskRankUid == riskRank.Uid)),
                });

                CacheProvider.SetCache(_cacheKeyRiskRankEntities, riskRankEntities);
            }

            return(riskRankEntities);
        }
Exemple #2
0
 /// <summary>
 /// 取得暫存的風險評估資料
 /// </summary>
 /// <param name="key">風險評估結果識別代號</param>
 /// <returns>風險評估資料</returns>
 public RiskEvaResultDTO GetRiskResult(string key)
 {
     return(new RiskEvaResultDTO()
     {
         QuestionnaireResultEntity = CacheProvider.GetCache(
             $"{_cacheKeyQuestionResultEntity}-{key}") as QuestionnaireResultEntity,
     });
 }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            var cacheProvider = new CacheProvider();

            var result = cacheProvider.GetCache(
                "aaa",
                new DelegateWrapper <int>(
                    new Func <AdditionParameter, int>(new CalculatorService().Add),
                    new AdditionParameter {
                Number1 = 50, Number2 = 20
            }));

            this.textBox1.Text = result.ToString();
        }
Exemple #4
0
        public FlowUser(string companyid, string userid, OracleConnection con, string modelCode)
        {
            string names = "";

            try
            {
                ModelInfo      modelinfo = new ModelInfo();
                FlowUserInfo[] Users     = { };
                #region ModelInfo加入缓存
                object modelinfoObj = CacheProvider.GetCache(modelCode);
                if (modelinfoObj != null)
                {
                    modelinfo = (ModelInfo)modelinfoObj;
                    LogHelper.WriteLog("从缓存中获取 ModelInfo");
                }
                else
                {
                    LogHelper.WriteLog("从数据库获取 通过模块代码查询系统代码 开始 modelCode=" + modelCode);

                    modelinfo = FlowBLL.GetSysCodeByModelCode(con, modelCode);//对数据库操作
                    if (modelinfo != null)
                    {
                        CacheProvider.RemoveCache(modelCode);
                        CacheProvider.Add(modelCode, modelinfo);
                    }
                    else
                    {
                        LogHelper.WriteLog("从数据库获取 通过模块代码查询系统代码 结果为空");
                    }
                    LogHelper.WriteLog("从数据库获取 通过模块代码查询系统代码 结束 modelCode=" + modelCode);
                }
                #endregion
                this.ModelCode = modelCode;
                if (modelinfo != null)
                {
                    this.ModelName = modelinfo.ModelName;
                    this.SysCode   = modelinfo.SysCode;
                }
                #region FlowUserInfo加入缓存
                object FlowUserInfoObj = CacheProvider.GetCache(userid);
                if (FlowUserInfoObj != null)
                {
                    Users = (FlowUserInfo[])FlowUserInfoObj;
                    LogHelper.WriteLog("从缓存中获取 FlowUserInfo");
                }
                else
                {
                    LogHelper.WriteLog("创建服务 PermissionServiceClient 开始");
                    PermissionServiceClient WcfPermissionService = new PermissionServiceClient();
                    LogHelper.WriteLog("从数据库获取 FlowUserInfo 开始 userid=" + userid);
                    Users = WcfPermissionService.GetFlowUserByUserID(userid);//新的接口
                    if (Users != null)
                    {
                        CacheProvider.RemoveCache(userid);
                        CacheProvider.Add(userid, Users);
                    }
                    LogHelper.WriteLog("从数据库获取 FlowUserInfo  结束 userid=" + userid);
                }
                #endregion

                foreach (var user in Users)
                {
                    if (user.CompayID == companyid)
                    {
                        names += "公司ID=" + user.CompayID + "\r\n";
                        names += "部门ID=" + user.DepartmentID + "\r\n";
                        names += "岗位ID=" + user.PostID + "\r\n";
                        names += "用户ID=" + user.UserID + "\r\n";

                        names += "公司名称=" + user.CompayName + "\r\n";
                        names += "部门名称=" + user.DepartmentName + "\r\n";
                        names += "岗位名称=" + user.PostName + "\r\n";
                        names += "用户名称=" + user.EmployeeName + "\r\n";

                        #region 用户基本信息
                        this.CompayID     = user.CompayID;
                        this.DepartmentID = user.DepartmentID;
                        this.PostID       = user.PostID;
                        this.UserID       = user.UserID;

                        this.CompayName     = user.CompayName;
                        this.DepartmentName = user.DepartmentName;
                        this.PostName       = user.PostName;
                        this.UserName       = user.EmployeeName;
                        this.Roles          = new List <T_SYS_ROLE>();
                        foreach (var role in user.Roles)
                        {
                            if (role != null)
                            {
                                names += "角色ID=" + role.ROLEID + "\r\n";
                                names += "角色名称=" + role.ROLENAME + "\r\n\r\n";
                            }

                            this.Roles.Add(role);
                        }
                        #endregion
                    }
                }
                LogHelper.WriteLog("流程单据所属人身份:\r\n" + names);
            }
            catch (Exception e)
            {
                ErrorMsg += "获取当前提交,审核单据时的用户信息出错:names=" + names + "异常信息:\r\n" + e.ToString() + "\r\n";
                LogHelper.WriteLog("获取当前提交,审核单据时的用户信息出错:names=" + names + "异常信息:\r\n" + e.ToString());
            }
        }