public ActionResult QueryConsultWithoutReply([DataSourceRequest] DataSourceRequest request, ProductConsultSearchModel searchModel, string fromDateTime, string toDateTime) { var service =new ProductConsultService(); string searchStr = this.BuildConsultSearchString(searchModel, fromDateTime, toDateTime); if (string.IsNullOrEmpty(searchStr)) { searchStr = "replyid is null"; } else { searchStr += " And replyid is null"; } int rowCount = 0, pageCount = 0; var paging = new Paging(searchStr, request.Page, request.PageSize); var list = service.QueryConsult(paging, out pageCount, out rowCount); if (list != null) { var modelList = new List<ProductConsultModel>(); foreach (var consult in list) { modelList.Add(DataTransfer.Transfer<ProductConsultModel>(consult, typeof(Product_Consult))); } var dataSource = new DataSource() { Data = modelList, Total = rowCount, TotalPages = pageCount }; return Json(dataSource, JsonRequestBehavior.AllowGet); } return Json(null); }
public ActionResult Advisory(string condition, int pageIndex = 1, int pageSize = 5) { ViewBag.searchText = condition; var service = new ProductConsultService(); int rowCount, pageCount; if (string.IsNullOrWhiteSpace(condition)) { condition = "[UserID] = " + this.UserSession.UserID; } else { condition = "[UserID] = " + this.UserSession.UserID + " And (Content like '%" + condition + "%' Or ConsultContent like '%" + condition + "%' Or ProductName like '%" + condition + "%')"; } var paging = new Paging("[view_Product_Consults_All]", null, "ID", condition, pageIndex, pageSize); var list = service.QueryConsult(paging, out pageCount, out rowCount); ViewBag.pageCount = pageCount; ViewBag.pageIndex = pageIndex; return this.View(list); }