示例#1
0
        /// <summary>
        /// 更新投票记录
        /// </summary>
        public void UpdateExperterVote(Vote vote, string schemeId, string userId)
        {
            var manager = new ExperterSchemeManager();
            var scheme  = manager.QueryExperterSchemeId(schemeId);

            var voteCount = manager.QueryIsVoteScheme(schemeId, userId);

            if (voteCount != null)
            {
                throw new LogicException("已参与本次订单投票,不能重复参与!");
            }

            var currentVoteAgainst = string.Empty;
            var currentVoteSupport = string.Empty;

            if (Vote.Against == vote)
            {
                scheme.Against     = scheme.Against + 1;
                currentVoteAgainst = userId;
            }
            else
            {
                scheme.Support     = scheme.Support + 1;
                currentVoteSupport = userId;
            }
            manager.UpdateExperterScheme(scheme);

            var entity = new ExperterSchemeSupport()
            {
                AgainstUserId = currentVoteAgainst,
                SupportUserId = currentVoteSupport,
                SchemeId      = schemeId,
                CreateTime    = DateTime.Now,
            };

            manager.AddExperterSchemeSupport(entity);
        }
 /// <summary>
 /// 添加名家方案支持率
 /// </summary>
 public void AddExperterSchemeSupport(ExperterSchemeSupport entity)
 {
     this.Add <ExperterSchemeSupport>(entity);
 }