/// <summary> /// Convert IDataReader To ProductCommentReplyInfo /// </summary> /// <param name="reader"></param> /// <returns></returns> public static ProductCommentReplyInfo SetValue(IDataReader reader) { ProductCommentReplyInfo info = new ProductCommentReplyInfo(); int idIndex = reader.GetOrdinal("ID"); int commentIDIndex = reader.GetOrdinal("CommentID"); int summaryIndex = reader.GetOrdinal("Summary"); info.Id = reader.GetInt32(idIndex); info.CommentID = reader.GetInt32(commentIDIndex); info.Summary = reader.GetString(summaryIndex); return info; }
public bool Insert(ProductCommentReplyInfo productCommentReplyInfo) { StringBuilder sql=new StringBuilder(); sql.Append("INSERT INTO"); sql.Append(" [Tbl_ProductCommentReply]("); sql.Append("[CommentID],"); sql.Append("[Summary]"); sql.Append(") VALUES("); sql.Append("@CommentID,"); sql.Append("@Summary"); sql.Append(");SELECT @@IDENTITY;"); using(NetShopHelper dbhelper=new NetShopHelper()) { IDbDataParameter[] p_Parms=new IDbDataParameter[]{ dbhelper.CreateParameter("@CommentID",productCommentReplyInfo.CommentID), dbhelper.CreateParameter("@Summary",productCommentReplyInfo.Summary) }; int ret=(int)dbhelper.ExecuteScalar(sql.ToString(),p_Parms); productCommentReplyInfo.Id=ret; return true; } }
public bool Update(ProductCommentReplyInfo productCommentReplyInfo) { StringBuilder sql = new StringBuilder(); sql.Append("UPDATE"); sql.Append(" [Tbl_ProductCommentReply]"); sql.Append(" SET"); sql.Append(" [CommentID]=@CommentID,"); sql.Append(" [Summary]=@Summary"); sql.Append(" WHERE"); sql.Append(" [ID]=@ID"); using(NetShopHelper dbhelper=new NetShopHelper()) { IDbDataParameter[] p_Parms = new IDbDataParameter[]{ dbhelper.CreateParameter("@ID",productCommentReplyInfo.Id) }; return 0 < dbhelper.ExecuteNonQuery(sql.ToString(),p_Parms); } }