public string evapage() { int pageSize = 2;//每一页的行数 int pageNumber = 1;//当前页数 string html = ""; string skuid = ""; string where = ""; string where2 = ""; string skulist = ""; string sortby = " order by pa.pa_Id"; int mid = 0; if (LoginMember != null) { mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; } Model.ProductAppraiseBase cmodel = new Model.ProductAppraiseBase(); var clist = new BLL.ProductAppraiseBase().GetModelList(" m_Id=" + mid + " and pa_IsDel=0 and pa_StatusCode=0"); if (clist.Count > 0) { foreach (var item in clist) { skulist += item.sku_ID + ","; } skulist = skulist.Substring(0, skulist.Length - 1); where2 = " and vw.sku_ID in(" + skulist + ")"; where = " and sku_ID in(" + skulist + ")"; } if (!string.IsNullOrEmpty(RequestBase.GetString("pageNum"))) { pageNumber = Convert.ToInt32(RequestBase.GetString("pageNum")); } List<Model.vw_PInfo> list = new BLL.vw_PInfo().GetModelList(" p_IsDel=0 and p_SellStatus=1 and p_StatusCode=0 " + where); ViewBag.collect = new BLL.vw_PInfo().GetModelListPA(" pa.m_ID=" + mid + " and p_IsDel=0 and p_StatusCode=0 and p_SellStatus=1 and pa.pa_IsDel=0 " + where2, pageNumber, pageSize, sortby); //ViewBag.collect = list.ToPagedList(pageNumber, pageSize); foreach (var item in ViewBag.collect) { html += " <li><table class=\"order-list\"><tbody><tr><td width=\"345\"><div class=\"pro-imgs\"><a href=\"/ProDetail/ProDetail?skuid="+item.sku_ID+"\"><img name=\"page_cnt_1\" _src=\""+item.pi_Url+"\" alt=\""+item.p_Name+"\" /></a></div><p><a href=\"/ProDetail/ProDetail?skuid="+item.sku_ID+"\">"+item.p_Name+" "+ item.shuxing+"</a></p></td><td width=\"200\" align=\"center\">"; if (item.pa_Satisfied == 1) { html += "<div class=\"stars star-icon1\"></div>";} else if (item.pa_Satisfied == 2) { html +="<div class=\"stars star-icon2\"></div>";} else if (item.pa_Satisfied == 3) {html +="<div class=\"stars star-icon3\"></div>";} else if (item.pa_Satisfied == 4) { html +="<div class=\"stars star-icon4\"></div>";} else if (item.pa_Satisfied == 5) {html += "<div class=\"stars star-icon5\"></div>";} else { html += "<div class=\"stars star-icon5\"></div>"; } html += "</td><td width=\"320\">" + item.pa_Content + "</td></tr></tbody></table></li>"; } return html; }
/// <summary> /// 账户管理-商品评价页面 /// </summary> /// <returns></returns> public ActionResult vipMyEvaluation() { // Model.MemberBase model = null; var model = new ListModel(); string where = ""; string where2 = ""; string sortby = " order by pa.pa_Id"; int page = 1; int pagerows = 2; string skulist = ""; int mid = 0; if (LoginMember != null) { mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID; Model.ProductAppraiseBase cmodel = new Model.ProductAppraiseBase(); var clist = new BLL.ProductAppraiseBase().GetModelList(" m_Id=" + mid + " and pa_IsDel=0 and pa_StatusCode=0"); if (clist.Count > 0) { ViewData["Appraise"] = true; foreach (var item in clist) { skulist += item.sku_ID + ","; } skulist = skulist.Substring(0, skulist.Length - 1); where = " and vw.sku_ID in(" + skulist + ")"; where2 = " and sku_ID in(" + skulist + ")"; model.vmpinfolist = new BLL.vw_PInfo().GetModelListPA(" pa.m_ID=" + mid + " and p_IsDel=0 and p_StatusCode=0 and p_SellStatus=1 and pa.pa_IsDel=0 " + where, page, pagerows, sortby); ViewData["count"] = clist.Count; ViewData["pagerows"] = pagerows; ViewData["page"] = page; return View(model.vmpinfolist); } else { ViewData["Appraise"] = false; return View(); } } else { Response.Redirect("/Index/Index"); return View(); } }
/// <summary> /// 获得商品评论(通过SKUID) /// </summary> public List<Model.ProductAppraiseBase> GetModelListByskuId(string strWhere) { StringBuilder strSql = new StringBuilder(); strSql.Append("select pa.pa_ID,m.m_UserName,m.m_HeadImg,pa.pa_PraiseCount,pa.pa_CreatedOn,pa.pa_Content,pa_Satisfied,(select COUNT(m_Id) from MemberBase where m_ID in(select m_id from ProductAppraiseBase)) midcount,(select AVG(pa_Satisfied) from ProductAppraiseBase) as pavg from ProductAppraiseBase pa,MemberBase m where pa.m_ID=m.m_ID and pa.pa_StatusCode=0 and pa.pa_IsDel=0 and "); if (strWhere.Trim() != "") { strSql.Append(strWhere); } DataSet ds = DbHelperSQL.Query(strSql.ToString()); List<Model.ProductAppraiseBase> pinglun = new List<Model.ProductAppraiseBase>(); foreach (DataRow r in ds.Tables[0].Rows) { Model.ProductAppraiseBase p = new Model.ProductAppraiseBase(); p.pa_ID =int.Parse( r["pa_ID"].ToString()); p.pa_PraiseCount = int.Parse(r["pa_PraiseCount"].ToString()); p.pa_Content = r["pa_Content"].ToString(); p.pa_CreatedOn = DateTime.Parse(r["pa_CreatedOn"].ToString()); p.pa_Satisfied = int.Parse(r["pa_Satisfied"].ToString()); p.pavg = int.Parse(r["pavg"].ToString()); p.member = new Model.MemberBase { midcount=int.Parse(r["midcount"].ToString()), m_UserName = r["m_UserName"].ToString(), m_HeadImg = r["m_HeadImg"].ToString() }; pinglun.Add(p); } return pinglun; }