public List <ProductType> getOneProductType(string RestaurantId)
        {
            List <ProductType> list = null;

            try
            {
                IParameterMapper           ipmapper = new getProductTypeParameterMapper();
                DataAccessor <ProductType> tableAccessor;
                string strSql = @" select
                                    pt.TypeId,
                                    pt.TypeName,
                                    pt.IsServiceType,
                                    pt.OrderNo,
                                    pt.ParentType,
                                    pt.PrintId,
                                    pt.RestaurantId
                                     from ProductType pt 
                                     where pt.IsServiceType=0  and pt.RestaurantId=@RestaurantId
                                    and pt.ParentType='00000000-0000-0000-0000-000000000000'

                                    and not exists(select 1 from producttypeisbook pb where pt.TypeId=pb.ProductTypeid and pb.isbook=0 )
                                    order by pt.OrderNo  ";
                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <ProductType> .
                                                           MapAllProperties().Build());
                list = tableAccessor.Execute(new string[] { RestaurantId }).ToList();
                return(list);
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return(null);
            }
        }
Exemplo n.º 2
0
 public List<ProductType> getProductType(string RestaurantId)
 {
     List<ProductType> list = null;
     try
     {
         IParameterMapper ipmapper = new getProductTypeParameterMapper();
         DataAccessor<ProductType> tableAccessor;
         string strSql = @" select
                             pt.TypeId,
                             pt.TypeName,
                             pt.IsServiceType,
                             pt.OrderNo,
                             pt.ParentType,
                             pt.PrintId,
                             pt.RestaurantId
                              from ProductType pt
                              where pt.IsServiceType=0  and pt.RestaurantId=@RestaurantId
                             and pt.ParentType!='00000000-0000-0000-0000-000000000000'
                             and exists(select 1 from Product p where pt.TypeId=p.ProductType and p.Status=1)
                             and not exists(select 1 from producttypeisbook pb where pt.TypeId=pb.ProductTypeid and pb.isbook=0 )
                             order by pt.OrderNo  ";
         tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder<ProductType>.
             MapAllProperties().Build());
         list = tableAccessor.Execute(new string[] { RestaurantId }).ToList();
         return list;
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
         return null;
     }
 }