protected void Page_Load(object sender, EventArgs e) { if (Request.Params["cus_ID"] != null && Request.Params["stock_ID"] != null && Request.Params["re_text"] != null) { review = new ReviewVO() { Cus_no = int.Parse(Request.Params["cus_ID"]), Stock_ID = Request.Params["stock_ID"], Re_txt = Request.Params["re_text"] }; try { rvDao.InsertWishList(review); json = "500"; } catch (Exception) { json = "501"; } } else { json = "502"; } Response.Clear(); Response.ContentType = "application/json, charset=utf-8"; Response.Write(json); Response.Flush(); Response.End(); }
//public List<ReviewVO> SelectReviewForSeller(int seller_No) //{ // List<object> lstobj = new List<object>(); // List<ReviewVO> lstReview = new List<ReviewVO>(); // string query = "SelectReviewForCustomer"; // SqlParameter[] sqlp = { new SqlParameter("seller_No", seller_No) }; // lstobj = con.SendReadQuery(query, sqlp); // foreach (var item in lstobj) // { // lstReview.Add((ReviewVO)item); // } // return lstReview; //} //internal bool UpdateReview(int re_ID, string re_Comment) //{ // string query = "UpdateReview"; // SqlParameter[] sqlp = { new SqlParameter("re_ID", re_ID), new SqlParameter("re_Comment", re_Comment) }; // try // { // con.SendExqueteQuery(query, sqlp); // return true; // } // catch (Exception) // { // throw; // } //} internal void InsertWishList(ReviewVO review) { string query = "insert_review"; SqlParameter[] sqls = { new SqlParameter("cus_no", review.Cus_no), new SqlParameter("stock_ID", review.Stock_ID), new SqlParameter("re_text", review.Re_txt) }; try { con.SendExqueteQuery(query, sqls); } catch (Exception) { throw; } }
internal string ReadReview(string query, SqlParameter[] sqls) { List <ReviewVO> reviews = new List <ReviewVO>(); cmd.Connection = OpenConnection(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = query; cmd.Parameters.AddRange(sqls); SqlDataReader sdr = cmd.ExecuteReader(); while (sdr.Read()) { int temp; if (sdr["re_like"].ToString().Equals("True")) { temp = 1; } else { temp = 0; } ReviewVO review = new ReviewVO() { Re_image = sdr["re_image"].ToString(), Re_txt = sdr["re_txt"].ToString(), Re_date = sdr["re_date"].ToString(), Re_like = temp, Re_command = sdr["re_comment"].ToString(), Re_comment_date = sdr["re_comment_date"].ToString(), Cus_ID = sdr["cus_ID"].ToString(), Pro_name = sdr["pro_name"].ToString() }; reviews.Add(review); } return(JsonConvert.SerializeObject(reviews)); }