//咨询  类4
        public ActionResult Zixunp4()
        {
            int zixunpageSize = 2;//每一页的个数
            int zixunpageNumber = 1;//当前页数

            //咨询
            model.prozixunp4 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='商品提问'");
            var zx4 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='商品提问'");
            ViewBag.zx4 = zx4.ToPagedList(zixunpageNumber, zixunpageSize);
            ViewData["p4"] = model.prozixunp4.Count;
            ViewData["zxp4count"] = model.prozixunp4.Count;
            ViewData["zxp4pagerows"] = zixunpageSize;
            ViewData["zxp4page"] = zixunpageNumber;
            return View(ViewBag.zx4);
        }
        //咨询 全部
        public ActionResult Zixunall()
        {
            int zixunpageSize = 2;//每一页的个数
            int zixunpageNumber = 1;//当前页数

            //咨询
            model.prozixunall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + "and pc_StatusCode=0 and pc_IsDel=0");
            var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid));
            ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize);
            ViewData["all"] = model.prozixunall.Count;
            ViewData["zxcount"] = model.prozixunall.Count;
            ViewData["zxpagerows"] = zixunpageSize;
            ViewData["zxpage"] = zixunpageNumber;
            return View(ViewBag.zxall);
        }
 //提交 评论type=pinglun/ 咨询type=zixun
 public string Tijiao()
 {
     string message = "";
     string type = "";
     string content = "";
     int skuid = 0;
     string radio = "0";
     int result = 0;
     HttpCookie user = Request.Cookies["UserInfo"];
     int mid = 0;
     string name = user.Value;
     if (LoginMember != null)//如果已登陆
     {
         mid = (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID;
         if (!string.IsNullOrEmpty(RequestBase.GetString("type")))
         {
             type = RequestBase.GetString("type").ToString();
         }
         if (!string.IsNullOrEmpty(RequestBase.GetString("content")))
         {
             content = RequestBase.GetString("content").ToString();
         }
         if (!string.IsNullOrEmpty(RequestBase.GetString("skuid")))
         {
             skuid = Convert.ToInt32(RequestBase.GetString("skuid"));
         }
         if (!string.IsNullOrEmpty(RequestBase.GetString("radio")))
         {
             radio = RequestBase.GetString("radio").ToString();
         }
         if (content == "")
         {
             return "请输入200个以内的字符";
         }
         if (type == "zixun")
         {
             Model.ProductConsultBase pcmodel = new ProductConsultBase();
             pcmodel.pc_Content = content;
             pcmodel.pc_CreatedOn = DateTime.Now;
             pcmodel.pc_CreatedBy = mid;//用户ID
             pcmodel.sku_ID = skuid;
             pcmodel.pc_huifu = 0;
             if (radio == "1")
                 pcmodel.pc_Type = "商品提问";
             if (radio == "2")
                 pcmodel.pc_Type = "促销活动提问";
             if (radio == "3")
                 pcmodel.pc_Type = "库存及物流提问";
             if (radio == "4")
                 pcmodel.pc_Type = "售后提问";
             if (radio == "undefined")
                 return "请选择提问类别";
             result = new BLL.ProductConsultBase().Add(pcmodel);
         }
         else if (type == "pinglun")
         {
             Model.ProductAppraiseBase pamodel = new ProductAppraiseBase();
             pamodel.pa_Content = content;
             pamodel.pa_CreatedOn = DateTime.Now;
             pamodel.pa_CreatedBy = mid;
             pamodel.m_ID = mid;
             pamodel.sku_ID = skuid;
             if (radio == "0")
                 return "请给商品评分";
             else
             {
                 pamodel.pa_Satisfied = int.Parse(radio);//满意度
             }
             result = new BLL.ProductAppraiseBase().Add(pamodel);
         }
         if (result > 0)
         {
             return "提交成功";
         }
         else
         {
             message = "提交失败,请稍后重试";
         }
         return message;
     }
     else
     {
         return "不登陆没有发言权";
     }
 }
 public string all()
 {
     int zixunpageSize = 2;//每一页的个数
     int zixunpageNumber = 1;//当前页数
     string html = "";
     string skuid = "";
     int type = 0;
     if (!string.IsNullOrEmpty(RequestBase.GetString("pageNum")))
     {
         zixunpageNumber = Convert.ToInt32(RequestBase.GetString("pageNum"));
     }
     if (!string.IsNullOrEmpty(RequestBase.GetString("skuid")))
     {
         skuid = RequestBase.GetString("skuid").ToString();
     }
     if (!string.IsNullOrEmpty(RequestBase.GetString("type")))
     {
         type = Convert.ToInt32(RequestBase.GetString("type"));
     }
     if (type == 1)
     {
         var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='促销活动提问'");
         ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize);
         foreach (var item in ViewBag.zxall)
         {
             html += "<li><dl><dt><div class=\"q-icon\"></div><div class=\"q-cont\"><p><span class=\"alignleft\">" + item.member.m_UserName + "</span><font class=\"alignright\">" + item.pc_CreatedOn + "</font></p><p>" + item.pc_Content + "</p></div></dt><dd><div class=\"a-icon\"></div><div class=\"a-cont\"><p><span class=\"alignleft\">月月兴食品商行客服回复:</span><font class=\"alignright\">" + item.preply.pr_CreatedOn + "</font></p><p>" + item.preply.pr_Content + "</p></div></dd></dl></li>";
         }
         return html;
     }
     else if (type == 2)
     {
         var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='库存及物流提问'");
         ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize);
         foreach (var item in ViewBag.zxall)
         {
             html += "<li><dl><dt><div class=\"q-icon\"></div><div class=\"q-cont\"><p><span class=\"alignleft\">" + item.member.m_UserName + "</span><font class=\"alignright\">" + item.pc_CreatedOn + "</font></p><p>" + item.pc_Content + "</p></div></dt><dd><div class=\"a-icon\"></div><div class=\"a-cont\"><p><span class=\"alignleft\">月月兴食品商行客服回复:</span><font class=\"alignright\">" + item.preply.pr_CreatedOn + "</font></p><p>" + item.preply.pr_Content + "</p></div></dd></dl></li>";
         }
         return html;
     }
     else if (type == 3)
     {
         var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='售后提问'");
         ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize);
         foreach (var item in ViewBag.zxall)
         {
             html += "<li><dl><dt><div class=\"q-icon\"></div><div class=\"q-cont\"><p><span class=\"alignleft\">" + item.member.m_UserName + "</span><font class=\"alignright\">" + item.pc_CreatedOn + "</font></p><p>" + item.pc_Content + "</p></div></dt><dd><div class=\"a-icon\"></div><div class=\"a-cont\"><p><span class=\"alignleft\">月月兴食品商行客服回复:</span><font class=\"alignright\">" + item.preply.pr_CreatedOn + "</font></p><p>" + item.preply.pr_Content + "</p></div></dd></dl></li>";
         }
         return html;
     }
     else if (type == 4)
     {
         var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='商品提问'");
         ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize);
         foreach (var item in ViewBag.zxall)
         {
             html += "<li><dl><dt><div class=\"q-icon\"></div><div class=\"q-cont\"><p><span class=\"alignleft\">" + item.member.m_UserName + "</span><font class=\"alignright\">" + item.pc_CreatedOn + "</font></p><p>" + item.pc_Content + "</p></div></dt><dd><div class=\"a-icon\"></div><div class=\"a-cont\"><p><span class=\"alignleft\">月月兴食品商行客服回复:</span><font class=\"alignright\">" + item.preply.pr_CreatedOn + "</font></p><p>" + item.preply.pr_Content + "</p></div></dd></dl></li>";
         }
         return html;
     }
     else
     {
         var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid));
         ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize);
         foreach (var item in ViewBag.zxall)
         {
             html += "<li><dl><dt><div class=\"q-icon\"></div><div class=\"q-cont\"><p><span class=\"alignleft\">" + item.member.m_UserName + "</span><font class=\"alignright\">" + item.pc_CreatedOn + "</font></p><p>" + item.pc_Content + "</p></div></dt><dd><div class=\"a-icon\"></div><div class=\"a-cont\"><p><span class=\"alignleft\">月月兴食品商行客服回复:</span><font class=\"alignright\">" + item.preply.pr_CreatedOn + "</font></p><p>" + item.preply.pr_Content + "</p></div></dd></dl></li>";
         }
         return html;
     }
 }
        public ActionResult ProDetail()
        {
            ViewData["skuid"] = skuid;
            string where = "";

            //添加历史浏览记录
            CookieHelper.AddandRepairGoodsToCookie("History", skuid);

            int zixunpageSize = 2;//每一页的行数
            int zixunpageNumber = 1;//当前页数
            if (skuid != "")
            {
                where = "  and sku_ID=" + int.Parse(skuid);
            }
            model.vmpinfolist = new BLL.vw_PInfo().GetModelList(" p_IsDel=0 and p_StatusCode=0 and p_SellStatus=1   " + where);//商品信息
            model.pimglist = new BLL.ProductImgBase().GetModelList(" sku_ID=" + int.Parse(skuid)+" and pi_IsDel=0 and pi_StatusCode=0");//图片列表
            model.productinfo = new BLL.ProductInfoBase().GetModelList(" p_ID=(select p_ID from SKUBase where sku_ID=" + skuid + ") and pin_StatusCode=0 and pin_IsDel=0 and pin_Type='商品介绍'");//商品介绍
            model.proattr = new BLL.ProductAttributesBase().GetModelListByskuId(" pad.sku_ID= " + int.Parse(skuid));//属性
            model.proattr2 = new BLL.ProductAttributesBase().GetModelListByPid(" and pa.pa_Type=2 and pa.pa_ID in(select pa_ID from ProductAttributeDetails where  sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + int.Parse(skuid) + "))) and sku.sku_ID in (select sku_ID from SKUBase where p_ID=(select p_ID from SKUBase where sku_ID=" + int.Parse(skuid) + "))");//规格
            model.zhoupaihang = new BLL.vw_PInfo().getmodelListPH();
            //评论
            model.pinglun = new BLL.ProductAppraiseBase().GetModelListByskuId(" sku_ID=" + int.Parse(skuid) + "and pa_StatusCode=0 and pa_IsDel=0");
            if (model.pinglun.Count > 0)
            {
                ViewData["pingluncount"] = model.pinglun.Count;
                ViewData["tiao"] = int.Parse(model.pinglun[0].pavg.ToString()) * 20;//显示满意度的箭头所指的地方
                ViewData["xing"] = int.Parse(model.pinglun[0].pavg.ToString()) * 68 / 5;//显示满意度的箭头所指的地方
            }
            else
            {
                ViewData["pingluncount"] = "0";
            }

            //咨询
            model.prozixunall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + "and pc_StatusCode=0 and pc_IsDel=0");
            var zxall = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid));
            ViewBag.zxall = zxall.ToPagedList(zixunpageNumber, zixunpageSize);
            ViewData["all"] = model.prozixunall.Count;

            model.prozixunp1 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='促销活动提问'");
            var zx1 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='促销活动提问'");
            ViewBag.zx1 = zx1.ToPagedList(zixunpageNumber, zixunpageSize);

            model.prozixunp2 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='库存及物流提问'");
            var zx2 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='库存及物流提问'");
            ViewBag.zx2 = zx2.ToPagedList(zixunpageNumber, zixunpageSize);

            model.prozixunp3 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='售后提问'");
            var zx3 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='售后提问'");
            ViewBag.zx3 = zx3.ToPagedList(zixunpageNumber, zixunpageSize);

            model.prozixunp4 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='商品提问'");
            var zx4 = new BLL.ProductConsultBase().GetModelListByskuId(" and sku_ID= " + int.Parse(skuid) + " and pc.pc_Type='商品提问'");
            ViewBag.zx4 = zx4.ToPagedList(zixunpageNumber, zixunpageSize);
            ViewData["p1"] = model.prozixunp1.Count;
            ViewData["p2"] = model.prozixunp2.Count;
            ViewData["p3"] = model.prozixunp3.Count;
            ViewData["p4"] = model.prozixunp4.Count;
            if (model.vmpinfolist.Any())
            {
                ViewData["youhui"] = model.vmpinfolist[0].sku_scPric - model.vmpinfolist[0].sku_Price;
                if (LoginMember != null)
                {
                    var clist = new BLL.VipCollectionBase().GetModelList(" m_ID=" + (CookieEncrypt.DeserializeObject(System.Web.HttpContext.Current.Request.Cookies["UserInfo"].Value) as Model.MemberBase).m_ID + " and sku_ID=" + model.vmpinfolist[0].sku_ID + " and vc_IsDel=0");
                    if (clist.Count > 0)
                    {
                        ViewData["collect"] = true;
                    }
                    else
                    {
                        ViewData["collect"] = false;
                    }
                    ViewData["logon"] = true;
                }
                else
                {
                    ViewData["collect"] = false;
                    ViewData["logon"] = false;
                }
            }
            else
            {
                ViewData["youhui"] = 0;
            }
            var groupbuy = new BLL.GroupPurchaseBase().GetModelList(" sku_ID=" + skuid + " and gp_StatusCode=0 and gp_IsDel=0 and gp_EndTime > '" + DateTime.Now + "'");
            if (groupbuy.Count > 0)
            {
                ViewBag.tuan = groupbuy[0];
            }
            else
            {
                ViewBag.tuan = null; ;
            }

            var zixunshuoming = _newsBase.GetModelList(" n_Title='咨询说明'  and n_StatusCode=0 and n_IsDel=0");
            if (zixunshuoming != null && zixunshuoming.Any())
            {
                ViewBag.zixunshuoming = zixunshuoming[0].n_Content;
            }
            else
            {
                ViewBag.zixunshuoming = "暂无咨询说明";
            }
            return View(model);
        }
        /// <summary>
        /// 添加/修改
        /// </summary>
        public ActionResult ProductConsultEdit(Model.vm_PCdetails vmBase)
        {
            bool result = false;

            try
            {
                int pcid = int.Parse(Request.Form["pc_ID"].ToString());
                string content = RequestBase.GetString("prContent");
                BLL.ProductReplyBase prbll = new BLL.ProductReplyBase();
                List<Model.ProductReplyBase> list = prbll.GetModelList(" pr_isdel=0 and pc_id=" + pcid);
                if (list.Count > 0)
                {
                    Model.ProductReplyBase model = list[0];
                    model.pr_Content = content;
                    Model.ProductConsultBase pcmodel = new BLL.ProductConsultBase().GetModel(pcid);
                    pcmodel.pc_huifu = 1;
                    result = new BLL.ProductReplyBase().Update(model);
                    result = new BLL.ProductConsultBase().Update(pcmodel);
                }
                else
                {
                    Model.ProductReplyBase model = new Model.ProductReplyBase();
                    model.pc_ID = pcid;
                    model.pr_Content = content;
                    model.pr_CreatedBy = EmployeeBase.e_ID;
                    model.pr_CreatedOn = DateTime.Now;
                    model.pr_IsDel = false;
                    model.pr_StatusCode = 0;
                    result = new BLL.ProductReplyBase().Add(model)>0? true:false;
                    if (result)
                    {
                        Model.ProductConsultBase pcmodel = new BLL.ProductConsultBase().GetModel(pcid);
                        pcmodel.pc_huifu = 1;
                        result = new BLL.ProductConsultBase().Update(pcmodel);
                        if (result == false)
                        {

                            new BLL.ProductReplyBase().DeleteList(" (select pr_id from ProductReplyBase where pc_id=" + pcid);
                        }
                    }
                }

                if (result)
                {

                    return Content(DWZUtil.GetAjaxTodoJson("200", "保存成功!!", "", "", "closeCurrent", "pcBox", ""));
                }
                else
                {

                    return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", ""));
                }
            }
            catch
            {

                return Content(DWZUtil.GetResultJson("300", "保存失败!!", "", "", ""));
            }
        }