public ActionResult GetIndexTopData() { try { NewsBll nbll = new NewsBll(); ProductBll productbll = new ProductBll(); DataSet priceset = productbll.getPriceFile("", "", "", 1, 5); DataTable pricedt = priceset.Tables[0]; //首页价格走势数据 DataTable newdt = nbll.GetNews(1, 5, 8); //首页热点资讯新闻数据(顶部) DataTable btnewdt = nbll.GetNews(1, 4, 8); //首页热点资讯新闻数据(底部) DataTable newggdt = nbll.GetNews(1, 5, 7); //首页平台公告新闻数据 DataTable yyaldt = nbll.GetNews(1, 3, 3); //首页案例数据 DataTable slhqdt = nbll.GetNews(1, 8, 2); //首页塑料行情 DataTable manufacturerdt = productbll.GetManufacturer(); //首页厂家信息 DataTable pdfdt = bll.GetListPDF(8); //认证报告数据 DataTable productdt = bll.GetProductList(8); //物性报告产品数据 List <pdflist> pdflist = Comm.ToDataList <pdflist>(pdfdt); List <tempproduct> prolist = Comm.ToDataList <tempproduct>(productdt); List <parminfo> typelist = cbll.listparminfo("", "", "0"); List <News> listnew = Comm.ToDataList <News>(newdt); List <News> yyallistnew = Comm.ToDataList <News>(yyaldt); List <News> slhqlistnew = Comm.ToDataList <News>(slhqdt); List <News> btlistnew = Comm.ToDataList <News>(btnewdt); List <News> gglistnew = Comm.ToDataList <News>(newggdt); List <Prices> pricelist = Comm.ToDataList <Prices>(pricedt); List <Manufacturer> mlist = Comm.ToDataList <Manufacturer>(manufacturerdt); DataTable dt = productbll.GetAnnotationList(16, 1, "", 0); var annotationlist = Comm.ToDataList <Annotation>(dt); string username = string.Empty; string userimg = string.Empty; if (AccountData != null) { username = AccountData.UserName; userimg = AccountData.HeadImage; } var returndata = new { newdata = listnew, yyaldata = yyallistnew, slhqldata = slhqlistnew, btnewdata = btlistnew, newggdata = gglistnew, pricedata = pricelist, manufacturerdata = mlist, annotationdata = annotationlist, typelistdata = typelist, pdfdata = pdflist, prodata = prolist, usname = username, usimg = userimg }; return(Json(Common.ToJsonResult("Success", "获取成功", returndata), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(Common.ToJsonResult("Fail", "获取失败", ex.Message), JsonRequestBehavior.AllowGet)); } }
public ActionResult GetNewsData() { try { DataTable topnewsdatadt = bll.GetNewsIndexTopData(); //顶部热门推荐 DataTable newsnewdatadt = bll.GetNewsIndexDataList(); //最新 DataTable newggdt = bll.GetNews(1, 4, 7); //首页平台公告新闻数据 DataTable bzphdt = bll.GetNewsIndexDataListOrderByHitAndTime(); //本周排行 DataTable rdtjdt = bll.GetNewsIndexDataListByHot(); //热点推荐 List <News> topdata = Comm.ToDataList <News>(topnewsdatadt); List <News> newdata = Comm.ToDataList <News>(newsnewdatadt); List <News> ggdata = Comm.ToDataList <News>(newggdt); List <News> bzphdata = Comm.ToDataList <News>(bzphdt); List <News> rdtjdata = Comm.ToDataList <News>(rdtjdt); var returndata = new { toplist = topdata, newlist = newdata, gglist = ggdata, bzphlist = bzphdata, rdtjlist = rdtjdata }; return(Json(Common.ToJsonResult("Success", "获取成功", returndata), JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(Common.ToJsonResult("Fail", "获取失败", ex.Message), JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 获取最近新闻 /// </summary> /// <returns></returns> public string GetLastNews() { var list = _bll.GetNews(); var jsonStr = JsonUtils.ObjToJson(list); return(jsonStr); }
protected void Page_Load(object sender, EventArgs e) { string newid = Request["newid"].ToString(); //System.Diagnostics.Debug.WriteLine(newid); NewsBll nb = new NewsBll(); newsId = nb.GetNews(int.Parse(newid)); }