Beispiel #1
0
        public List <ProductNew> getProductByProductTypeId(string RestaurantId, string ProductTypeId)
        {
            if (string.IsNullOrEmpty(RestaurantId) || string.IsNullOrEmpty(ProductTypeId))
            {
                Logger.Log("RestaurantId= " + RestaurantId + ",ProductTypeId= " + ProductTypeId);
            }

            List <ProductNew> list = null;

            try
            {
                IParameterMapper          ipmapper = new getProductByProductTypeIdParameterMapper();
                DataAccessor <ProductNew> tableAccessor;
                string strSql = @" select
                        b.Id,b.ProductName
                      ,b.ProductType
                      ,b.Code
                      ,b.PinYin
                      ,b.Unit
                      ,b.MinUnit
                      ,b.MinCount
                      ,b.Price
                      ,b.BarCode
                      ,b.Status
                      ,b.RestaurantId
                      ,b.Type
                      ,b.MaterialId
                      ,b.IsDiscount 
                      ,b.MemberPrice,cl.CodeTypeListName
                       ,pf.LoveCount,pf.Count,pf.Hot,pf.Description ,pf.Popular from 
                        Product b
                        left join ProductConfigure pf on pf.ProductId=b.Id, S_CodeList cl
                        where 1=1 and b.Status=1 and  b.IsPause=0 and cl.CodeTypeListValue=b.Unit and cl.CodeType='ProductUnit'
                        and not exists(select 1 from productsisbook pb where b.id=pb.Productid and pb.isbook=0 )
                        and b.RestaurantId=@RestaurantId and  b.ProductType=@ProductTypeId order by b.IsDiscount asc";
                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <ProductNew> .
                                                           MapAllProperties().Build());
                list = tableAccessor.Execute(new string[] { RestaurantId, ProductTypeId }).ToList();
                return(list);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return(null);
            }
        }
Beispiel #2
0
        public List<ProductNew> getProductByProductTypeId(string RestaurantId, string ProductTypeId)
        {
            if (string.IsNullOrEmpty(RestaurantId) || string.IsNullOrEmpty(ProductTypeId))
            {
                Logger.Log("RestaurantId= " + RestaurantId + ",ProductTypeId= " + ProductTypeId);
            }

            List<ProductNew> list = null;
            try
            {
                IParameterMapper ipmapper = new getProductByProductTypeIdParameterMapper();
                DataAccessor<ProductNew> tableAccessor;
                string strSql = @" select
                        b.Id,b.ProductName
                      ,b.ProductType
                      ,b.Code
                      ,b.PinYin
                      ,b.Unit
                      ,b.MinUnit
                      ,b.MinCount
                      ,b.Price
                      ,b.BarCode
                      ,b.Status
                      ,b.RestaurantId
                      ,b.Type
                      ,b.MaterialId
                      ,b.IsDiscount 
                      ,b.MemberPrice,cl.CodeTypeListName
                       ,pf.LoveCount,pf.Count,pf.Hot,pf.Description ,pf.Popular from 
                        Product b
                        left join ProductConfigure pf on pf.ProductId=b.Id, S_CodeList cl
                        where 1=1 and b.Status=1 and  b.IsPause=0 and cl.CodeTypeListValue=b.Unit and cl.CodeType='ProductUnit'
                        and not exists(select 1 from productsisbook pb where b.id=pb.Productid and pb.isbook=0 )
                        and b.RestaurantId=@RestaurantId and  b.ProductType=@ProductTypeId order by b.IsDiscount asc";
                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<ProductNew>.
                    MapAllProperties().Build());
                list = tableAccessor.Execute(new string[] { RestaurantId, ProductTypeId }).ToList();
                return list;
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return null;
            }
        }