public List <RandomProduct> getRandomProduct(string RestaurantId, string peopleCount) { List <RandomProduct> list = null; try { IParameterMapper ipmapper = new getRandomProductParameterMapper(); DataAccessor <RandomProduct> tableAccessor; string strSql = @"select top " + peopleCount + " p.ProductName , p.id , p.Price,ap.Hot, ap.Popular,ap.ADescription from product p , Restaurant r, AutoMenusProduct ap" + " where p.RestaurantId=r.Id and p.Id=ap.ProductId and r.id=@RestaurantId and p.Status=1 order by newid() order by p.Code asc"; tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <RandomProduct> . MapAllProperties().Build()); list = tableAccessor.Execute(new string[] { RestaurantId }).ToList(); return(list); } catch (Exception ex) { Logger.Log(ex); return(null); } #endregion }
public List<RandomProduct> getRandomProduct(string RestaurantId, string peopleCount) { List<RandomProduct> list = null; try { IParameterMapper ipmapper = new getRandomProductParameterMapper(); DataAccessor<RandomProduct> tableAccessor; string strSql = @"select top " + peopleCount + " p.ProductName , p.id , p.Price,ap.Hot, ap.Popular,ap.ADescription from product p , Restaurant r, AutoMenusProduct ap" + " where p.RestaurantId=r.Id and p.Id=ap.ProductId and r.id=@RestaurantId and p.Status=1 order by newid() order by p.Code asc"; tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<RandomProduct>. MapAllProperties().Build()); list = tableAccessor.Execute(new string[] { RestaurantId }).ToList(); return list; } catch (Exception ex) { Logger.Log(ex); return null; } #endregion }