Esempio n. 1
0
        /// <summary>
        ///     计算9种体质得分,并保存到P0102
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="testedTimes">已经测试的次数(不算本次)</param>
        /// <param name="now">当前时间</param>
        /// <param name="p0103">综合测试答案</param>
        /// <returns></returns>
        private Models.JsonClass.Core.ConstitutionScore CalConstitutionScoreAndSave(int userId, int testedTimes, DateTime now, Models.EF.P0103 p0103)
        {
            bool gender = Convert.ToBoolean(db.P0101.Where(c => c.id == userId).First().gender);

            Core.Core core = new Core.Core();
            Models.JsonClass.Core.ConstitutionScore constitutionScore = core.CalConstitutionScore(p0103, gender);

            //保存记录到P0102中
            Models.EF.P0102 p0102 = new Models.EF.P0102();
            p0102.userId      = userId;
            p0102.pinHZScore  = constitutionScore.pinHZ;
            p0102.qiXZScore   = constitutionScore.qiXZ;
            p0102.yinXZScore  = constitutionScore.yinXZ;
            p0102.yangXZScore = constitutionScore.yangXZ;
            p0102.tanSZScore  = constitutionScore.tanSZ;
            p0102.shiRZScore  = constitutionScore.shiRZ;
            p0102.xueYZScore  = constitutionScore.xueYZ;
            p0102.qiYZScore   = constitutionScore.qiYZ;
            p0102.teBZScore   = constitutionScore.teBZ;
            p0102.times       = testedTimes + 1;
            p0102.testTime    = now;

            db.P0102.Add(p0102);

            return(constitutionScore);
        }