/// <summary>
 /// 商品咨询列表页
 ///  zhoub 20150827
 /// </summary>
 /// <param name="searchModel"></param>
 /// <returns></returns>
 public JsonResult List(SearchProductConsultModel searchModel)
 {
     var result = _productConsultService.GetPagingProductConsult(searchModel, ACultureHelper.GetLanguageID);
     var data = new
     {
         rows = result.Data,
         total = result.Data.TotalCount
     };
     return Json(data, JsonRequestBehavior.AllowGet);
 }
        /// <summary>
        /// 分页获取商品咨询信息.update by liujc
        /// zhoub 20150827
        /// </summary>
        /// <param name="model">用户搜索模型</param>
        /// <returns>用户列表数据</returns>
        public ResultModel GetPagingProductConsult(SearchProductConsultModel model, int languageID)
        {
            var pro = base._database.Db.ProductConsult;

            var where = new SimpleExpression(1, 1, SimpleExpressionType.Equal);

            if (model.UserID != 0)
            {
                //用户ID
                where = new SimpleExpression(where, pro.UserID == model.UserID, SimpleExpressionType.And);
            }
            if (model.ProductId != 0)
            {
                //商品id
                where = new SimpleExpression(where, pro.ProductId == model.ProductId, SimpleExpressionType.And);
            }
            if (model.ProductConsultId != 0)
            {
                where = new SimpleExpression(where, pro.ProductConsultId == model.ProductConsultId, SimpleExpressionType.And);
            }
            if (!string.IsNullOrEmpty(model.Phone))
            {
                where = new SimpleExpression(where, _database.Db.YH_User.Phone == model.Phone.Trim(), SimpleExpressionType.And);
            }

            dynamic cl;
            dynamic pc;

            var query = pro.Query()
                        .LeftJoin(_database.Db.Product_Lang, out cl).On(_database.Db.Product_Lang.ProductId == pro.ProductId && _database.Db.Product_Lang.LanguageID == languageID)
                        .LeftJoin(_database.Db.YH_User, out pc).On(_database.Db.YH_User.UserID == pro.UserID)
                        .Select(pro.ProductConsultId,
                                pro.ProductId,
                                pro.UserID,
                                pro.ConsultContent,
                                pro.ConsultDT,
                                pro.ReplyBy,
                                pro.ReplyDT,
                                pro.ReplyContent,
                                cl.ProductName,
                                pc.Phone,
                                pc.Account,
                                pro.ConsultType
                                )
                        .Where(where)
                        .OrderByConsultDTDescending();

            var result = new ResultModel()
            {
                Data = new SimpleDataPagedList <ProductConsultModel>(query, model.PagedIndex, model.PagedSize)
            };

            return(result);
        }
 /// <summary>
 /// 商品咨询回复数据查询
 /// zhoub 20150827
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult Create(long? id)
 {
     ProductConsultModel model = new ProductConsultModel();
     if (id.HasValue)
     {
         SearchProductConsultModel smodel = new SearchProductConsultModel();
         smodel.ProductConsultId = id.Value;
         smodel.PagedIndex = 0;
         smodel.PagedSize = 100;
         //查询列表 
         List<ProductConsultModel> List = this._productConsultService.GetPagingProductConsult(smodel, ACultureHelper.GetLanguageID).Data;
         if (List != null && List.Count > 0)
         {
             model = List[0];
         }
     }
     return PartialView(model);
 }