Exemplo n.º 1
0
        public List<RestaurantAbstract> getRestaurentState(string CompanyId)
        {
            try
            {
                IParameterMapper ipmapper = new getRestaurentStateParameterMapper();
                DataAccessor<RestaurantAbstract> tableAccessor;
                string strSql = @"
             select rst.Id,rst.Name,rst.ContactPhone,rst.Address,rst.BusinessStartDate,
            rst.BusinessEndtDate,rst.RstType,ro.MapUrl,ro.VirtualUrl, null as Photo ,p.Name,
             isnull(ro.MaxTime,0) as MaxTime ,case when (ro.Reven=1 or ro.Rnoon=1)  then 1 else 0 end as isAcceptOrder
             from Restaurant rst left join ReceiveOrder ro on rst.Id=ro.RstId ,Province p
             where rst.CompanyId=@CompanyId and rst.usestate='01'
             and rst.CityId=p.Id and p.IsUse='1'";

                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper,MapBuilder<RestaurantAbstract>.MapAllProperties()
                        .Build());
                return tableAccessor.Execute(new string[] { CompanyId }).ToList(); ;

            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return null;
            }
        }
        public List <RestaurantAbstract> getRestaurentState(string CompanyId)
        {
            try
            {
                IParameterMapper ipmapper = new getRestaurentStateParameterMapper();
                DataAccessor <RestaurantAbstract> tableAccessor;
                string strSql = @"
 select rst.Id,rst.Name,rst.ContactPhone,rst.Address,rst.BusinessStartDate,
rst.BusinessEndtDate,rst.RstType,ro.MapUrl,ro.VirtualUrl, null as Photo ,p.Name,
 isnull(ro.MaxTime,0) as MaxTime ,case when (ro.Reven=1 or ro.Rnoon=1)  then 1 else 0 end as isAcceptOrder
 from Restaurant rst left join ReceiveOrder ro on rst.Id=ro.RstId ,Province p
 where rst.CompanyId=@CompanyId and rst.usestate='01'  
 and rst.CityId=p.Id and p.IsUse='1'";

                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <RestaurantAbstract> .MapAllProperties()
                                                           .Build());
                return(tableAccessor.Execute(new string[] { CompanyId }).ToList());;
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
                return(null);
            }
        }