/// <summary> /// 根据名称模糊获取单品食物 /// </summary> /// <param name="searchName">查询名字</param> /// <returns></returns> public Result <PageList <Dish> > SearchDishInfoByName(string searchName, PageSearchParam param) { Result <PageList <Dish> > result = new Result <PageList <Dish> >() { Data = null, Status = true }; param.SearchCode = searchName; param.SearchType = 1; result.Data = new PageList <Dish>(); result.Data.PageIndex = param.PageIndex; result.Data.PageNumer = param.PageNumer; try { //查询符合条件的数据总条数 result.Data.Count = DBConnectionManager.Instance.Reader.Count(new DishCountForSelectPageSpefication(param).Satifasy()); //查询数据集合 IList <DishInfo> dish = DBConnectionManager.Instance.Reader.Select <DishInfo>(new DishSelectPagesPefication(param).Satifasy()); result.Data.List = dish.CopyList <DishInfo, Dish>(); } catch (Exception ex) { result.Status = false; result.Message = "查询单品食物出错:" + ex.Message; result.StatusCode = "SD001"; LoggerUtils.LogIn(LoggerUtils.ColectExceptionMessage(ex, "At service:SearchDishInfoByName() .DishService"), LogType.ErrorLog); } return(result); }
public ActionResult Index() { ViewBag.Account = base.CurrentAccount; //创建分页参数 PageSearchParam param = new PageSearchParam(); param.PageIndex = 1; param.PageNumer = 4; //获取推荐单品信息 MealTime meal = GetMealTimeForNow(); Result <PageList <Dish> > dishresult = ServiceObjectContainer.Get <IDishService>().SearchDishInfoByMealTime(meal, param); ViewBag.DishList = dishresult.Data; //获取推荐食谱信息 Result <PageList <Recipes> > recipesresult = ServiceObjectContainer.Get <IRecipesService>().GetPageRecipes(param); ViewBag.RecipesList = recipesresult.Data; ViewBag.Meal = meal; return(View()); }
/// <summary> /// 获取分页食谱信息 /// </summary> /// <param name="param"></param> /// <returns></returns> public Result <PageList <Recipes> > GetPageRecipes(PageSearchParam param) { Result <PageList <Recipes> > pagelistresult = new Result <PageList <Recipes> >() { Status = true }; pagelistresult.Data = new PageList <Recipes> { PageIndex = param.PageIndex, PageNumer = param.PageNumer }; param.SearchCode = ""; param.SearchType = 0; try { //获取总数 pagelistresult.Data.Count = DBConnectionManager.Instance.Reader.Count(new RecipesCountForSelectPageSpefication(param).Satifasy()); //获取分页信息 IList <RecipesInfo> selectresult = DBConnectionManager.Instance.Reader.Select <RecipesInfo>(new RecipesSelectPageSpefication(param).Satifasy()); pagelistresult.Data.List = selectresult.CopyList <RecipesInfo, Recipes>(); } catch (Exception ex) { pagelistresult.Status = false; LoggerUtils.LogIn(LoggerUtils.ColectExceptionMessage(ex, "At service:GetPageRecipes() .RecipesService"), LogType.ErrorLog); } return(pagelistresult); }
/// <summary> /// 模糊查询门店名称分页 /// </summary> /// <param name="shopName"></param> /// <param name="param"></param> /// <returns></returns> public Result <PageList <Shop> > SearchShopInfoByName(string shopName, PageSearchParam param) { Result <PageList <Shop> > pagelistresult = new Result <PageList <Shop> >() { Status = true }; param.SearchType = 1; param.SearchCode = shopName; pagelistresult.Data = new PageList <Shop>() { PageIndex = param.PageIndex, PageNumer = param.PageNumer }; try { //获取总数 pagelistresult.Data.Count = DBConnectionManager.Instance.Reader.Count(new ShopCountForSelectPageSpefication(param).Satifasy()); //获取分页信息 IList <ShopInfo> selectresult = DBConnectionManager.Instance.Reader.Select <ShopInfo>(new ShopSelectPageSpefication(param).Satifasy()); pagelistresult.Data.List = selectresult.CopyList <ShopInfo, Shop>(); } catch (Exception ex) { pagelistresult.Status = false; LoggerUtils.LogIn(LoggerUtils.ColectExceptionMessage(ex, "At service:GetShopPageList() .ShopService"), LogType.ErrorLog); } return(pagelistresult); }
public JsonResult GetShopPageList(int pageindex) { IShopService shops = ServiceObjectContainer.Get <IShopService>(); PageSearchParam param = new PageSearchParam(); param.PageNumer = 3; param.SearchType = 0; param.PageIndex = pageindex; return(Json(shops.GetShopPageList(param))); }
public RecipesCountForSelectPageSpefication(PageSearchParam param) { _param = param; }
/// <summary> /// 店铺分页查询规约 /// </summary> /// <param name="param">查询条件</param> /// <param name="type"> /// 条件类型 /// 0:直接分页查询 /// 1:根据店铺名称模糊查询 /// </param> public ShopSelectPageSpefication(PageSearchParam param) { _param = param; }
public DishCountForSelectPageSpefication(PageSearchParam param) { _param = param; }
/// <summary> /// 单品分页查询规约 /// </summary> /// <param name="param"></param> /// <remarks> /// 查询类型 /// 0:直接分页查询 /// 1:根据名字模糊查询 /// 2:根据用餐时间查询 /// 3:根据食物类型查询 /// /// </remarks> public DishSelectPagesPefication(PageSearchParam param) { _param = param; }