public NewRestaurantAbstract GetRestaurentById(string restaurantId)
        {
            try
            {
                IParameterMapper ipmapper = new GetRestaurentByIdParameterMapper();
                DataAccessor <NewRestaurantAbstract> tableAccessor;
                string strSql = @"select rst.Id,rst.Name,rst.ContactPhone,rst.Address,rst.BusinessStartDate,
rst.BusinessEndtDate,rst.RstType,rst.[Description],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.Id=@restaurantId;";

                tableAccessor = db.CreateSqlStringAccessor(strSql, ipmapper, MapBuilder <NewRestaurantAbstract> .MapAllProperties()
                                                           .Build());
                return(tableAccessor.Execute(new string[] { restaurantId }).ToList().FirstOrDefault());
            }
            catch
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public NewRestaurantAbstract GetRestaurentById(string restaurantId)
        {
            try
            {
                IParameterMapper ipmapper = new GetRestaurentByIdParameterMapper();
                DataAccessor<NewRestaurantAbstract> tableAccessor;
                string strSql = @"select rst.Id,rst.Name,rst.ContactPhone,rst.Address,rst.BusinessStartDate,
            rst.BusinessEndtDate,rst.RstType,rst.[Description],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.Id=@restaurantId;";

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

            }
            catch
            {
                throw;
            }
        }