Пример #1
0
 /// <summary>
 /// 生产静态数据
 /// </summary>
 /// <returns></returns>
 public ActionResult CreateStaticDatas()
 {
     var bll=new BGoodInfo();
     var datas = bll.GetList(null,new OrderBy(){
         IsAsc=true,
         Name="Type"
     },new OrderBy(){
          IsAsc=false,
         Name="AddDateTime"
     });
     if (datas == null || datas.Count <= 0) Json(new {
         code = "101",
         msg = "数据集合为空!!"
     }, JsonRequestBehavior.AllowGet);
     StringBuilder rtnMsg=new StringBuilder();
     var msg=string.Empty;
     //分组生成
     bll.DoCreateGroupByType(datas, out msg);
     rtnMsg.Append(msg);
     msg = string.Empty;
     //所有分页
     bll.DoCreateAll(datas, out msg);
     rtnMsg.Append(msg);
     return Json(new {
         code = "100",
         msg = rtnMsg.ToString(),
     }, JsonRequestBehavior.AllowGet);
 }
Пример #2
0
 public ActionResult GetList(MGoodInfoSearch search)
 {
     var bll = new BGoodInfo();
     var pageSize = 20;
     var pageIndex = Request.GetQ("p").GetInt(0, false);
     long dataCount = 0;
     int pageCount = 0;
     var datas = bll.GetList(pageSize, pageIndex, out dataCount, search, new OrderBy {
          IsAsc=false,
          Name = "AddDateTime"
     },new OrderBy {
          IsAsc=false,
          Name = "IsHot"
     });
     pageCount = (dataCount.GetInt(0,false) + pageSize - 1) / pageSize;
     return Json(new {
         pageIndex=pageIndex,
         pageCount=pageCount,
         datas = bll.GetShowDatas(datas) ?? new List<object>()
     }, JsonRequestBehavior.AllowGet);
 }