/// <summary> /// 增加一条数据 /// </summary> public bool Add(MerVsCommentModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into MerVsComment("); strSql.Append("MerchantId,CommentId,VsType"); strSql.Append(") values ("); strSql.Append("@MerchantId,@CommentId,@VsType"); strSql.Append(") "); SqlParameter[] parameters = { new SqlParameter("@MerchantId", SqlDbType.Decimal, 9), new SqlParameter("@CommentId", SqlDbType.Decimal, 9), new SqlParameter("@VsType", SqlDbType.VarChar, 10) }; parameters[0].Value = model.MerchantId; parameters[1].Value = model.CommentId; parameters[2].Value = model.VsType; bool result = false; try { helper.ExecSqlReInt(strSql.ToString(), parameters); result = true; } catch (Exception ex) { this.helper.Close(); throw ex; } finally { } return(result); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(MerVsCommentModel model) { bool reValue = true; int reCount = 0; StringBuilder strSql = new StringBuilder(); strSql.Append("update MerVsComment set "); strSql.Append(" MerchantId = @MerchantId , "); strSql.Append(" CommentId = @CommentId , "); strSql.Append(" VsType = @VsType "); strSql.Append(" where MerchantId=@MerchantId and CommentId=@CommentId "); SqlParameter[] parameters = { new SqlParameter("@MerchantId", SqlDbType.Decimal, 9), new SqlParameter("@CommentId", SqlDbType.Decimal, 9), new SqlParameter("@VsType", SqlDbType.VarChar, 10) }; parameters[0].Value = model.MerchantId; parameters[1].Value = model.CommentId; parameters[2].Value = model.VsType; try {//异常处理 reCount = this.helper.ExecSqlReInt(strSql.ToString(), parameters); } catch (Exception ex) { this.helper.Close(); throw ex; } if (reCount <= 0) { reValue = false; } return(reValue); }
/// <summary> /// 添加一个商家点评 /// </summary> /// <param name="model"></param> public void SaveNewMerVsDal(MerVsCommentModel model) { MerCDal.Add(model); }