public Boolean AddTopicJoin(TopicJoin topicJoin) { String sql = @"INSERT INTO [topic_join]([topic_id], [current_id]) VALUES(@topic_id, @current_id)"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@topic_id", topicJoin.TopicId), new SqlParameter("@current_id", topicJoin.CurrentId) }; Int32 line = (Int32)connector.Execute("non", sql, parameters); return(line <= 0 ? false : true); }
/// <summary> /// 添加话题参与记录 /// </summary> /// <param name="currentId">动态 ID</param> /// <returns>是否成功</returns> protected bool AddTopicJoin(Int64 currentId) { List <Int64> topicIdList = GetSelectedTopicId(); try { foreach (Int64 topicId in topicIdList) { TopicJoin topicJoin = new TopicJoin() { CurrentId = currentId, TopicId = topicId }; return(TopicJoinService.AddTopicJoin(topicJoin)); } } catch (Exception ex) { PromptInfo.Text = ex.Message; } return(false); }
/// <summary> /// 添加话题参与记录 /// </summary> /// <param name="topicJoin">实体对象</param> /// <returns>是否插入成功</returns> public static Boolean AddTopicJoin(TopicJoin topicJoin) { return(iTopicJoinDao.AddTopicJoin(topicJoin)); }