示例#1
0
 public bool AddOrUpdateActivityVoteRecord(ActivityVote vote)
 {
     bool result = false;
     var conn = DBHelper.GetSqlConnection();
     try
     {
         conn.Open();
         result = activityDao.InsertOrUpdateActivityVote(conn, vote);
     }
     catch (Exception e)
     {
         LogService.Log("AddOrUpdateActivityVoteRecord--" + e.Message, e.ToString());
     }
     finally
     {
         conn.Close();
     }
     return result;
 }
示例#2
0
 public ActionResult UpdateVoteStatus(int activityId, bool isVoted)
 {
     var vote = new ActivityVote()
     {
         ActivityId = activityId,
         InsertedTimestamp = DateTime.Now,
         IsVoted = isVoted,
         LastUpdatedTimestamp = DateTime.Now,
         UserId = CurrentWeChatUser.UserId,
         WechatUserOpenId = CurrentWeChatUser.OpenId
     };
     var result = service.AddOrUpdateActivityVoteRecord(vote);
     var data = new
     {
         IsSuccessFul = result
     };
     return Json(data);
 }
示例#3
0
        public bool InsertOrUpdateActivityVote(SqlConnection conn, ActivityVote vote)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@VoteId", vote.VoteId),
                new SqlParameter("@UserId", vote.UserId),
                new SqlParameter("@WechatUserOpenId", vote.WechatUserOpenId),
                new SqlParameter("@ActivityId", vote.ActivityId),
                new SqlParameter("@IsVoted", vote.IsVoted),
                new SqlParameter("@InsertedTimestamp", vote.InsertedTimestamp),
                new SqlParameter("@LastUpdatedTimestamp", vote.LastUpdatedTimestamp)
            };

            DBHelper.CheckSqlSpParameter(parameters);

            return DBHelper.RunNonQueryProcedure(conn, "sp_InsertOrUpdateActivityVote", parameters) > 0;
        }